/* Generated by Cython 0.29.26 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "asyncpg/pgproto/debug.h"
        ],
        "extra_compile_args": [
            "-O2",
            "-fsigned-char",
            "-Wall",
            "-Wsign-compare",
            "-Wconversion"
        ],
        "include_dirs": [
            "./asyncpg/pgproto",
            "asyncpg/pgproto/"
        ],
        "name": "asyncpg.protocol.protocol",
        "sources": [
            "asyncpg/protocol/protocol.pyx",
            "asyncpg/protocol/record/recordobj.c"
        ]
    },
    "module_name": "asyncpg.protocol.protocol"
}
END: Cython Metadata */

#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_26"
#define CYTHON_HEX_VERSION 0x001D1AF0
#define CYTHON_FUTURE_DIVISION 1
#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__asyncpg__protocol__protocol
#define __PYX_HAVE_API__asyncpg__protocol__protocol
/* Early includes */
#include <stdint.h>
#include "debug.h"
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include "record/recordobj.h"
#include "./hton.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[] = {
  "asyncpg/protocol/scram.pyx",
  "asyncpg/protocol/protocol.pyx",
  "asyncpg/protocol/settings.pyx",
  "stringsource",
  "asyncpg/protocol/codecs/base.pyx",
  "asyncpg/protocol/codecs/array.pyx",
  "asyncpg/protocol/coreproto.pyx",
  "asyncpg/protocol/prepared_stmt.pyx",
  "asyncpg/protocol/encodings.pyx",
  "asyncpg/protocol/codecs/pgproto.pyx",
  "asyncpg/protocol/codecs/range.pyx",
  "asyncpg/protocol/codecs/record.pyx",
  "asyncpg/protocol/scram.pxd",
  "asyncpg/protocol/coreproto.pxd",
  "asyncpg/protocol/prepared_stmt.pxd",
  "asyncpg/protocol/protocol.pxd",
  "asyncpg/pgproto/./frb.pxd",
  "asyncpg/pgproto/./buffer.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "asyncpg/protocol/pgtypes.pxi",
};

/*--- Type declarations ---*/
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer;
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer;
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext;
struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec;
struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig;
struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings;
struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication;
struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol;
struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState;
struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close;
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation;
struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer;
struct __pyx_opt_args_7asyncpg_7pgproto_7pgproto_10ReadBuffer_redirect_messages;

/* "asyncpg/pgproto/frb.pxd":10
 * cdef:
 * 
 *     struct FRBuffer:             # <<<<<<<<<<<<<<
 *         const char* buf
 *         ssize_t len
 */
struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer {
  char const *buf;
  Py_ssize_t len;
};

/* "asyncpg/pgproto/buffer.pxd":62
 * 
 * 
 * ctypedef const char * (*try_consume_message_method)(object, ssize_t*)             # <<<<<<<<<<<<<<
 * ctypedef int32_t (*take_message_type_method)(object, char) except -1
 * ctypedef int32_t (*take_message_method)(object) except -1
 */
typedef char const *(*__pyx_t_7asyncpg_7pgproto_7pgproto_try_consume_message_method)(PyObject *, Py_ssize_t *);

/* "asyncpg/pgproto/buffer.pxd":63
 * 
 * ctypedef const char * (*try_consume_message_method)(object, ssize_t*)
 * ctypedef int32_t (*take_message_type_method)(object, char) except -1             # <<<<<<<<<<<<<<
 * ctypedef int32_t (*take_message_method)(object) except -1
 * ctypedef char (*get_message_type_method)(object)
 */
typedef int32_t (*__pyx_t_7asyncpg_7pgproto_7pgproto_take_message_type_method)(PyObject *, char);

/* "asyncpg/pgproto/buffer.pxd":64
 * ctypedef const char * (*try_consume_message_method)(object, ssize_t*)
 * ctypedef int32_t (*take_message_type_method)(object, char) except -1
 * ctypedef int32_t (*take_message_method)(object) except -1             # <<<<<<<<<<<<<<
 * ctypedef char (*get_message_type_method)(object)
 * 
 */
typedef int32_t (*__pyx_t_7asyncpg_7pgproto_7pgproto_take_message_method)(PyObject *);

/* "asyncpg/pgproto/buffer.pxd":65
 * ctypedef int32_t (*take_message_type_method)(object, char) except -1
 * ctypedef int32_t (*take_message_method)(object) except -1
 * ctypedef char (*get_message_type_method)(object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef char (*__pyx_t_7asyncpg_7pgproto_7pgproto_get_message_type_method)(PyObject *);

/* "asyncpg/pgproto/buffer.pxd":130
 *     cdef bytes consume_message(self)
 *     cdef discard_message(self)
 *     cdef redirect_messages(self, WriteBuffer buf, char mtype, int stop_at=?)             # <<<<<<<<<<<<<<
 *     cdef bytearray consume_messages(self, char mtype)
 *     cdef finish_message(self)
 */
struct __pyx_opt_args_7asyncpg_7pgproto_7pgproto_10ReadBuffer_redirect_messages {
  int __pyx_n;
  int stop_at;
};

/* "asyncpg/pgproto/codecs/__init__.pxd":14
 * 
 * 
 * ctypedef object (*encode_func)(CodecContext settings,             # <<<<<<<<<<<<<<
 *                                WriteBuffer buf,
 *                                object obj)
 */
typedef PyObject *(*__pyx_t_7asyncpg_7pgproto_7pgproto_encode_func)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);

/* "asyncpg/pgproto/codecs/__init__.pxd":18
 *                                object obj)
 * 
 * ctypedef object (*decode_func)(CodecContext settings,             # <<<<<<<<<<<<<<
 *                                FRBuffer *buf)
 * 
 */
typedef PyObject *(*__pyx_t_7asyncpg_7pgproto_7pgproto_decode_func)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_any_core_codec;
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_register_core_codec;

/* "asyncpg/protocol/codecs/base.pxd":25
 * 
 * 
 * cdef enum CodecType:             # <<<<<<<<<<<<<<
 *     CODEC_UNDEFINED = 0
 *     CODEC_C         = 1
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType {
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_UNDEFINED = 0,
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_C = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_PY = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_ARRAY = 3,
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_COMPOSITE = 4,
  __pyx_e_7asyncpg_8protocol_8protocol_CODEC_RANGE = 5
};

/* "asyncpg/protocol/codecs/base.pxd":34
 * 
 * 
 * cdef enum ServerDataFormat:             # <<<<<<<<<<<<<<
 *     PG_FORMAT_ANY = -1
 *     PG_FORMAT_TEXT = 0
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat {
  __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY = -1L,
  __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT = 0,
  __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY = 1
};

/* "asyncpg/protocol/codecs/base.pxd":40
 * 
 * 
 * cdef enum ClientExchangeFormat:             # <<<<<<<<<<<<<<
 *     PG_XFORMAT_OBJECT = 1
 *     PG_XFORMAT_TUPLE = 2
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat {
  __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE = 2
};

/* "asyncpg/protocol/coreproto.pxd":11
 * 
 * 
 * cdef enum ConnectionStatus:             # <<<<<<<<<<<<<<
 *     CONNECTION_OK = 1
 *     CONNECTION_BAD = 2
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus {
  __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_OK = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_STARTED = 3
};

/* "asyncpg/protocol/coreproto.pxd":17
 * 
 * 
 * cdef enum ProtocolState:             # <<<<<<<<<<<<<<
 *     PROTOCOL_IDLE = 0
 * 
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState {
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE = 0,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_ERROR_CONSUME = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CANCELLED = 3,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING = 4,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_AUTH = 10,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_PREPARE = 11,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE = 12,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE_MANY = 13,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CLOSE_STMT_PORTAL = 14,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_SIMPLE_QUERY = 15,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_EXECUTE = 16,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND = 17,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT = 18,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA = 19,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE = 20,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN = 21,
  __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN_DATA = 22
};

/* "asyncpg/protocol/coreproto.pxd":40
 * 
 * 
 * cdef enum AuthenticationMessage:             # <<<<<<<<<<<<<<
 *     AUTH_SUCCESSFUL = 0
 *     AUTH_REQUIRED_KERBEROS = 2
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage {
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SUCCESSFUL = 0,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_KERBEROS = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_PASSWORD = 3,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_PASSWORDMD5 = 5,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SCMCRED = 6,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_GSS = 7,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_GSS_CONTINUE = 8,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SSPI = 9,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SASL = 10,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_CONTINUE = 11,
  __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_FINAL = 12
};

/* "asyncpg/protocol/coreproto.pxd":64
 * 
 * 
 * cdef enum ResultType:             # <<<<<<<<<<<<<<
 *     RESULT_OK = 1
 *     RESULT_FAILED = 2
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType {
  __pyx_e_7asyncpg_8protocol_8protocol_RESULT_OK = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED = 2
};

/* "asyncpg/protocol/coreproto.pxd":69
 * 
 * 
 * cdef enum TransactionStatus:             # <<<<<<<<<<<<<<
 *     PQTRANS_IDLE = 0                 # connection idle
 *     PQTRANS_ACTIVE = 1               # command in progress
 */
enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus {
  __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_IDLE = 0,
  __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_ACTIVE = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INTRANS = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INERROR = 3,
  __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_UNKNOWN = 4
};

/* "asyncpg/protocol/codecs/base.pxd":8
 * 
 * 
 * ctypedef object (*encode_func)(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                                WriteBuffer buf,
 *                                object obj)
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_encode_func)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);

/* "asyncpg/protocol/codecs/base.pxd":12
 *                                object obj)
 * 
 * ctypedef object (*decode_func)(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                                FRBuffer *buf)
 * 
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_decode_func)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);

/* "asyncpg/protocol/codecs/base.pxd":15
 *                                FRBuffer *buf)
 * 
 * ctypedef object (*codec_encode_func)(Codec codec,             # <<<<<<<<<<<<<<
 *                                      ConnectionSettings settings,
 *                                      WriteBuffer buf,
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);

/* "asyncpg/protocol/codecs/base.pxd":20
 *                                      object obj)
 * 
 * ctypedef object (*codec_decode_func)(Codec codec,             # <<<<<<<<<<<<<<
 *                                      ConnectionSettings settings,
 *                                      FRBuffer *buf)
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);

/* "asyncpg/protocol/codecs/base.pxd":169
 *         dict _custom_type_codecs
 * 
 *     cdef inline Codec get_codec(self, uint32_t oid, ServerDataFormat format,             # <<<<<<<<<<<<<<
 *                                 bint ignore_custom_codec=*)
 *     cdef inline Codec get_custom_codec(self, uint32_t oid,
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec {
  int __pyx_n;
  int ignore_custom_codec;
};

/* "asyncpg/protocol/settings.pxd":28
 *     cpdef inline set_builtin_type_codec(
 *         self, typeoid, typename, typeschema, typekind, alias_to, format)
 *     cpdef inline Codec get_data_codec(             # <<<<<<<<<<<<<<
 *         self, uint32_t oid, ServerDataFormat format=*,
 *         bint ignore_custom_codec=*)
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec {
  int __pyx_n;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat format;
  int ignore_custom_codec;
};

/* "asyncpg/protocol/coreproto.pxd":77
 * 
 * 
 * ctypedef object (*decode_row_method)(object, const char*, ssize_t)             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_decode_row_method)(PyObject *, char const *, Py_ssize_t);

/* "asyncpg/protocol/coreproto.pxd":177
 *     cdef bint _bind_execute_many(self, str portal_name, str stmt_name,
 *                                  object bind_data)
 *     cdef bint _bind_execute_many_more(self, bint first=*)             # <<<<<<<<<<<<<<
 *     cdef _bind_execute_many_fail(self, object error, bint first=*)
 *     cdef _bind(self, str portal_name, str stmt_name,
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more {
  int __pyx_n;
  int first;
};

/* "asyncpg/protocol/coreproto.pxd":178
 *                                  object bind_data)
 *     cdef bint _bind_execute_many_more(self, bint first=*)
 *     cdef _bind_execute_many_fail(self, object error, bint first=*)             # <<<<<<<<<<<<<<
 *     cdef _bind(self, str portal_name, str stmt_name,
 *                WriteBuffer bind_data)
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail {
  int __pyx_n;
  int first;
};

/* "asyncpg/protocol/codecs/array.pyx":669
 * 
 * 
 * cdef enum _ArrayParseState:             # <<<<<<<<<<<<<<
 *     APS_START = 1
 *     APS_STRIDE_STARTED = 2
 */
enum __pyx_t_7asyncpg_8protocol_8protocol__ArrayParseState {
  __pyx_e_7asyncpg_8protocol_8protocol_APS_START = 1,
  __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED = 2,
  __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DONE = 3,
  __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DELIMITED = 4,
  __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED = 5,
  __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_DELIMITED = 6
};

/* "asyncpg/protocol/codecs/range.pyx":18
 * 
 * 
 * cdef enum _RangeArgumentType:             # <<<<<<<<<<<<<<
 *     _RANGE_ARGUMENT_INVALID = 0
 *     _RANGE_ARGUMENT_TUPLE = 1
 */
enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType {
  __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_INVALID = 0,
  __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_TUPLE = 1,
  __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_RANGE = 2
};

/* "asyncpg/protocol/codecs/base.pyx":719
 * 
 * 
 * cdef inline Codec get_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec {
  int __pyx_n;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat xformat;
};

/* "asyncpg/protocol/codecs/base.pyx":738
 * 
 * 
 * cdef inline Codec get_any_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_any_core_codec {
  int __pyx_n;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat xformat;
};

/* "asyncpg/protocol/codecs/base.pyx":759
 * 
 * 
 * cdef register_core_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                          encode_func encode,
 *                          decode_func decode,
 */
struct __pyx_opt_args_7asyncpg_8protocol_8protocol_register_core_codec {
  int __pyx_n;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat xformat;
};

/* "asyncpg/protocol/codecs/array.pyx":21
 * 
 * 
 * ctypedef object (*encode_func_ex)(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                                   WriteBuffer buf,
 *                                   object obj,
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, void const *);

/* "asyncpg/protocol/codecs/array.pyx":27
 * 
 * 
 * ctypedef object (*decode_func_ex)(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                                   FRBuffer *buf,
 *                                   const void *arg)
 */
typedef PyObject *(*__pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, void const *);

/* "asyncpg/pgproto/buffer.pxd":8
 * 
 * 
 * cdef class WriteBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # Preallocated small buffer
 */
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_vtab;
  int _smallbuf_inuse;
  char _smallbuf[0x400];
  char *_buf;
  Py_ssize_t _size;
  Py_ssize_t _length;
  int _view_count;
  int _message_mode;
};


/* "asyncpg/pgproto/buffer.pxd":68
 * 
 * 
 * cdef class ReadBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # A deque of buffers (bytes objects)
 */
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_vtab;
  PyObject *_bufs;
  PyObject *_bufs_append;
  PyObject *_bufs_popleft;
  PyObject *_buf0;
  PyObject *_buf0_prev;
  int32_t _bufs_len;
  Py_ssize_t _pos0;
  Py_ssize_t _len0;
  Py_ssize_t _length;
  char _current_message_type;
  int32_t _current_message_len;
  Py_ssize_t _current_message_len_unread;
  int _current_message_ready;
};


/* "asyncpg/pgproto/codecs/__init__.pxd":8
 * 
 * 
 * cdef class CodecContext:             # <<<<<<<<<<<<<<
 * 
 *     cpdef get_text_codec(self)
 */
struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext *__pyx_vtab;
};


/* "asyncpg/protocol/codecs/base.pxd":45
 * 
 * 
 * cdef class Codec:             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t        oid
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_Codec *__pyx_vtab;
  uint32_t oid;
  PyObject *name;
  PyObject *schema;
  PyObject *kind;
  enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType type;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat format;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat xformat;
  __pyx_t_7asyncpg_8protocol_8protocol_encode_func c_encoder;
  __pyx_t_7asyncpg_8protocol_8protocol_decode_func c_decoder;
  PyObject *py_encoder;
  PyObject *py_decoder;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *element_codec;
  Py_UCS4 element_delimiter;
  PyObject *element_type_oids;
  PyObject *element_names;
  PyObject *record_desc;
  PyObject *element_codecs;
  __pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func encoder;
  __pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func decoder;
};


/* "asyncpg/protocol/codecs/base.pxd":164
 * 
 * 
 * cdef class DataCodecConfig:             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict _derived_type_codecs
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_vtab;
  PyObject *_derived_type_codecs;
  PyObject *_custom_type_codecs;
};


/* "asyncpg/protocol/settings.pxd":8
 * 
 * 
 * cdef class ConnectionSettings(pgproto.CodecContext):             # <<<<<<<<<<<<<<
 *     cdef:
 *         str _encoding
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext __pyx_base;
  PyObject *_encoding;
  PyObject *_codec;
  PyObject *_settings;
  int _is_utf8;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *_data_codecs;
};


/* "asyncpg/protocol/scram.pxd":8
 * 
 * 
 * cdef class SCRAMAuthentication:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly bytes authentication_method
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_vtab;
  PyObject *authentication_method;
  PyObject *authorization_message;
  PyObject *client_channel_binding;
  PyObject *client_first_message_bare;
  PyObject *client_nonce;
  PyObject *client_proof;
  PyObject *password_salt;
  int password_iterations;
  PyObject *server_first_message;
  PyObject *server_key;
  PyObject *server_nonce;
};


/* "asyncpg/protocol/coreproto.pxd":80
 * 
 * 
 * cdef class CoreProtocol:             # <<<<<<<<<<<<<<
 *     cdef:
 *         ReadBuffer buffer
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_vtab;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *buffer;
  int _skip_discard;
  int _discard_data;
  PyObject *_execute_iter;
  PyObject *_execute_portal_name;
  PyObject *_execute_stmt_name;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus con_status;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState state;
  enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus xact_status;
  PyObject *encoding;
  PyObject *transport;
  PyObject *con_params;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *scram;
  int32_t backend_pid;
  int32_t backend_secret;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType result_type;
  PyObject *result;
  PyObject *result_param_desc;
  PyObject *result_row_desc;
  PyObject *result_status_msg;
  int result_execute_completed;
};


/* "asyncpg/protocol/prepared_stmt.pxd":8
 * 
 * 
 * cdef class PreparedStatementState:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly str name
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState {
  PyObject_HEAD
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_vtab;
  PyObject *name;
  PyObject *query;
  int closed;
  int refs;
  PyTypeObject *record_class;
  int ignore_custom_codec;
  PyObject *row_desc;
  PyObject *parameters_desc;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *settings;
  int16_t args_num;
  int have_text_args;
  PyObject *args_codecs;
  int16_t cols_num;
  PyObject *cols_desc;
  int have_text_cols;
  PyObject *rows_codecs;
};


/* "asyncpg/protocol/protocol.pxd":30
 * 
 * 
 * cdef class BaseProtocol(CoreProtocol):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol __pyx_base;
  PyObject *loop;
  PyObject *address;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *settings;
  PyObject *cancel_sent_waiter;
  PyObject *cancel_waiter;
  PyObject *waiter;
  int return_extra;
  PyObject *create_future;
  PyObject *timeout_handle;
  PyObject *timeout_callback;
  PyObject *completed_callback;
  PyObject *conref;
  PyTypeObject *record_class;
  int is_reading;
  PyObject *last_query;
  int writing_paused;
  int closing;
  uint64_t queries_count;
  int _is_ssl;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *statement;
};


/* "asyncpg/protocol/scram.pyx":193
 *             verify_server_signature.digest())
 * 
 *     cdef _bytes_xor(self, bytes a, bytes b):             # <<<<<<<<<<<<<<
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor {
  PyObject_HEAD
  PyObject *__pyx_v_a;
  PyObject *__pyx_v_b;
};


/* "asyncpg/protocol/scram.pyx":195
 *     cdef _bytes_xor(self, bytes a, bytes b):
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))             # <<<<<<<<<<<<<<
 * 
 *     cdef _generate_client_nonce(self, int num_bytes):
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *__pyx_outer_scope;
  PyObject *__pyx_v_a_i;
  PyObject *__pyx_v_b_i;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "asyncpg/protocol/scram.pyx":263
 *         return u
 * 
 *     cdef _normalize_password(self, str original_password):             # <<<<<<<<<<<<<<
 *         """Normalize the password using the SASLprep from RFC4013"""
 *         cdef:
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password {
  PyObject_HEAD
  PyObject *__pyx_v_c;
  PyObject *__pyx_v_normalized_password;
  PyObject *__pyx_v_normalized_password_tuple;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self;
};


/* "asyncpg/protocol/scram.pyx":294
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c             # <<<<<<<<<<<<<<
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 *         )
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_outer_scope;
  PyObject *__pyx_v_c;
};


/* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_outer_scope;
  PyObject *__pyx_v_in_prohibited_table;
};


/* "asyncpg/protocol/scram.pyx":334
 *         #    character must be the first and last character of the string
 *         # RandALCat characters are found in table D.1, whereas LCat are in D.2
 *         if any(stringprep.in_table_d1(c) for c in normalized_password_tuple):             # <<<<<<<<<<<<<<
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_outer_scope;
  PyObject *__pyx_v_c;
};


/* "asyncpg/protocol/scram.pyx":343
 *             # if any characters are in D.2, use the original password
 *             if any(
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_outer_scope;
  PyObject *__pyx_v_c;
};


/* "asyncpg/protocol/protocol.pyx":142
 * 
 *     @cython.iterable_coroutine
 *     async def prepare(self, stmt_name, query, timeout,             # <<<<<<<<<<<<<<
 *                       *,
 *                       PreparedStatementState state=None,
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare {
  PyObject_HEAD
  PyObject *__pyx_v_ex;
  PyObject *__pyx_v_ignore_custom_codec;
  PyObject *__pyx_v_query;
  PyObject *__pyx_v_record_class;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_stmt_name;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":171
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                            str portal_name, int limit, return_extra,
 *                            timeout):
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_args_buf;
  PyObject *__pyx_v_ex;
  int __pyx_v_limit;
  PyObject *__pyx_v_portal_name;
  PyObject *__pyx_v_return_extra;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":204
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute_many(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                                 str portal_name, timeout):
 * 
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many {
  PyObject_HEAD
  PyObject *__pyx_v_arg_bufs;
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_data_gen;
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_ex;
  PyObject *__pyx_v_genexpr;
  int __pyx_v_more;
  PyObject *__pyx_v_portal_name;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_timer;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
  PyObject *__pyx_t_6;
};


/* "asyncpg/protocol/protocol.pyx":220
 *         # this generator expression to keep the memory pressure under
 *         # control.
 *         data_gen = (state._encode_bind_msg(b) for b in args)             # <<<<<<<<<<<<<<
 *         arg_bufs = iter(data_gen)
 * 
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *__pyx_outer_scope;
  PyObject *__pyx_v_b;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "asyncpg/protocol/protocol.pyx":257
 * 
 *     @cython.iterable_coroutine
 *     async def bind(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                    str portal_name, timeout):
 * 
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind {
  PyObject_HEAD
  PyObject *__pyx_v_args;
  PyObject *__pyx_v_args_buf;
  PyObject *__pyx_v_ex;
  PyObject *__pyx_v_portal_name;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":286
 * 
 *     @cython.iterable_coroutine
 *     async def execute(self, PreparedStatementState state,             # <<<<<<<<<<<<<<
 *                       str portal_name, int limit, return_extra,
 *                       timeout):
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute {
  PyObject_HEAD
  PyObject *__pyx_v_ex;
  int __pyx_v_limit;
  PyObject *__pyx_v_portal_name;
  PyObject *__pyx_v_return_extra;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":316
 * 
 *     @cython.iterable_coroutine
 *     async def query(self, query, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query {
  PyObject_HEAD
  PyObject *__pyx_v_ex;
  PyObject *__pyx_v_query;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":341
 * 
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out {
  PyObject_HEAD
  PyObject *__pyx_v_buffer;
  PyObject *__pyx_v_copy_stmt;
  PyObject *__pyx_v_done;
  PyObject *__pyx_v_ex;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  PyObject *__pyx_v_sink;
  PyObject *__pyx_v_status_msg;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_timer;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
  PyObject *__pyx_t_6;
};


/* "asyncpg/protocol/protocol.pyx":395
 * 
 *     @cython.iterable_coroutine
 *     async def copy_in(self, copy_stmt, reader, data,             # <<<<<<<<<<<<<<
 *                       records, PreparedStatementState record_stmt, timeout):
 *         cdef:
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in {
  PyObject_HEAD
  PyObject *__pyx_v_aiter;
  PyObject *__pyx_v_chunk;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec;
  PyObject *__pyx_v_codecs;
  PyObject *__pyx_v_copy_stmt;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_e;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_iterator;
  Py_ssize_t __pyx_v_num_cols;
  PyObject *__pyx_v_reader;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_record_stmt;
  PyObject *__pyx_v_records;
  PyObject *__pyx_v_row;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings;
  PyObject *__pyx_v_status_msg;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_timer;
  PyObject *__pyx_v_waiter;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_wbuf;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
  PyObject *__pyx_t_6;
  PyObject *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10;
  PyObject *__pyx_t_11;
};


/* "asyncpg/protocol/protocol.pyx":534
 * 
 *     @cython.iterable_coroutine
 *     async def close_statement(self, PreparedStatementState state, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement {
  PyObject_HEAD
  PyObject *__pyx_v_ex;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_v_waiter;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asyncpg/protocol/protocol.pyx":574
 * 
 *     @cython.iterable_coroutine
 *     async def close(self, timeout):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             return
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
  PyObject *__pyx_v_timeout;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
};


/* "asyncpg/protocol/protocol.pyx":717
 * 
 *     @cython.iterable_coroutine
 *     async def _wait_for_cancellation(self):             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation {
  PyObject_HEAD
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self;
};



/* "asyncpg/pgproto/buffer.pxd":8
 * 
 * 
 * cdef class WriteBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # Preallocated small buffer
 */

struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer {
  PyObject *(*len)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*write_len_prefixed_utf8)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*_check_readonly)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*_ensure_alloced)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, Py_ssize_t);
  PyObject *(*_reallocate)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, Py_ssize_t);
  PyObject *(*reset)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*start_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, char);
  PyObject *(*end_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*write_buffer)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*write_byte)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, char);
  PyObject *(*write_bytes)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*write_len_prefixed_buffer)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*write_len_prefixed_bytes)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*write_bytestring)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*write_str)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, PyObject *);
  PyObject *(*write_frbuf)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*write_cstr)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, char const *, Py_ssize_t);
  PyObject *(*write_int16)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int16_t);
  PyObject *(*write_int32)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t);
  PyObject *(*write_int64)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int64_t);
  PyObject *(*write_float)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, float);
  PyObject *(*write_double)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, double);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*new_message)(char);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*new)(void);
};
static struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer;
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_write_len_prefixed_utf8(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);


/* "asyncpg/pgproto/buffer.pxd":68
 * 
 * 
 * cdef class ReadBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # A deque of buffers (bytes objects)
 */

struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer {
  PyObject *(*len)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  char (*get_message_type)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int32_t (*get_message_length)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*feed_data)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, PyObject *);
  PyObject *(*_ensure_first_buf)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*_switch_to_next_buf)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  char (*read_byte)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  char const *(*_try_read_bytes)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, Py_ssize_t);
  PyObject *(*_read_into)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, char *, Py_ssize_t);
  PyObject *(*_read_and_discard)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, Py_ssize_t);
  PyObject *(*read_bytes)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, Py_ssize_t);
  PyObject *(*read_len_prefixed_bytes)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*read_len_prefixed_utf8)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*read_uuid)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int64_t (*read_int64)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int32_t (*read_int32)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int16_t (*read_int16)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*read_null_str)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int32_t (*take_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  int32_t (*take_message_type)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, char);
  int32_t (*put_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  char const *(*try_consume_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, Py_ssize_t *);
  PyObject *(*consume_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*discard_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*redirect_messages)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, char, struct __pyx_opt_args_7asyncpg_7pgproto_7pgproto_10ReadBuffer_redirect_messages *__pyx_optional_args);
  PyObject *(*consume_messages)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *, char);
  PyObject *(*finish_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  PyObject *(*_finish_message)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *(*new_message_parser)(PyObject *);
};
static struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_ReadBuffer;
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
static CYTHON_INLINE char __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_type(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);
static CYTHON_INLINE int32_t __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_length(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *);


/* "asyncpg/pgproto/codecs/__init__.pxd":8
 * 
 * 
 * cdef class CodecContext:             # <<<<<<<<<<<<<<
 * 
 *     cpdef get_text_codec(self)
 */

struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext {
  PyObject *(*get_text_codec)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, int __pyx_skip_dispatch);
  PyObject *(*is_encoding_utf8)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *);
};
static struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext *__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_CodecContext;


/* "asyncpg/protocol/codecs/base.pyx":20
 * 
 * @cython.final
 * cdef class Codec:             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, uint32_t oid):
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_Codec {
  PyObject *(*init)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, Py_UCS4);
  PyObject *(*encode_scalar)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*encode_array)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*encode_array_text)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*encode_range)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*encode_composite)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*encode_in_python)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*decode_scalar)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*decode_array)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*decode_array_text)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*decode_range)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*decode_composite)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*decode_in_python)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*encode)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
  PyObject *(*decode)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
  PyObject *(*has_encoder)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
  PyObject *(*has_decoder)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
  PyObject *(*is_binary)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*copy)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*new_array_codec)(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, Py_UCS4);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*new_range_codec)(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*new_composite_codec)(uint32_t, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, PyObject *, PyObject *, PyObject *);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*new_python_codec)(uint32_t, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_Codec *__pyx_vtabptr_7asyncpg_8protocol_8protocol_Codec;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, Py_UCS4);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_is_binary(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_copy(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_array_codec(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, Py_UCS4);
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_range_codec(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *);
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_composite_codec(uint32_t, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, PyObject *, PyObject *, PyObject *);
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_python_codec(uint32_t, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat);


/* "asyncpg/protocol/codecs/base.pyx":423
 * 
 * 
 * cdef class DataCodecConfig:             # <<<<<<<<<<<<<<
 *     def __init__(self, cache_key):
 *         # Codec instance cache for derived types:
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_DataCodecConfig {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*get_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec *__pyx_optional_args);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*get_custom_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_vtabptr_7asyncpg_8protocol_8protocol_DataCodecConfig;
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec *__pyx_optional_args);
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat);


/* "asyncpg/protocol/settings.pyx":12
 * 
 * @cython.final
 * cdef class ConnectionSettings(pgproto.CodecContext):             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, conn_key):
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_ConnectionSettings {
  struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext __pyx_base;
  PyObject *(*add_setting)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *);
  PyObject *(*register_data_types)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*add_python_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*remove_python_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*clear_type_cache)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, int __pyx_skip_dispatch);
  PyObject *(*set_builtin_type_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*get_data_codec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, uint32_t, int __pyx_skip_dispatch, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec *__pyx_optional_args);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_vtabptr_7asyncpg_8protocol_8protocol_ConnectionSettings;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_setting(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_register_data_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, int __pyx_skip_dispatch);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, int __pyx_skip_dispatch);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, uint32_t, int __pyx_skip_dispatch, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec *__pyx_optional_args);


/* "asyncpg/protocol/scram.pyx":25
 * 
 * @cython.final
 * cdef class SCRAMAuthentication:             # <<<<<<<<<<<<<<
 *     """Contains the protocol for generating and a SCRAM hashed password.
 * 
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_SCRAMAuthentication {
  PyObject *(*create_client_first_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
  PyObject *(*create_client_final_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
  PyObject *(*parse_server_first_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
  PyObject *(*verify_server_final_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
  PyObject *(*_bytes_xor)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *);
  PyObject *(*_generate_client_nonce)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, int);
  PyObject *(*_generate_client_proof)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
  PyObject *(*_generate_salted_password)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *, int);
  PyObject *(*_normalize_password)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_vtabptr_7asyncpg_8protocol_8protocol_SCRAMAuthentication;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_parse_server_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_verify_server_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_nonce(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, int);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_proof(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_salted_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *, int);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__normalize_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *);


/* "asyncpg/protocol/coreproto.pyx":14
 * 
 * 
 * cdef class CoreProtocol:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, con_params):
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol {
  PyObject *(*is_in_transaction)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, int __pyx_skip_dispatch);
  PyObject *(*_process__auth)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__prepare)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__bind_execute)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__bind_execute_many)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__close_stmt_portal)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__simple_query)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__bind)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__copy_out)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__copy_out_data)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__copy_in)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_process__copy_in_data)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char);
  PyObject *(*_parse_msg_authentication)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_msg_parameter_status)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_msg_notification)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_msg_backend_key_data)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_msg_ready_for_query)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_data_msgs)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_copy_data_msgs)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_parse_msg_error_response)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_parse_msg_command_complete)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_write_copy_data_msg)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_write_copy_done_msg)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_write_copy_fail_msg)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_auth_password_message_cleartext)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_auth_password_message_md5)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_auth_password_message_sasl_initial)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_auth_password_message_sasl_continue)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_write)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_writelines)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_read_server_messages)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_push_result)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_reset_result)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_set_state)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState);
  PyObject *(*_ensure_connected)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*_build_parse_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*_build_bind_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*_build_empty_bind_data)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*_build_execute_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int32_t);
  PyObject *(*_connect)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_prepare)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *);
  PyObject *(*_send_bind_message)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t);
  PyObject *(*_bind_execute)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t);
  int (*_bind_execute_many)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, PyObject *);
  int (*_bind_execute_many_more)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more *__pyx_optional_args);
  PyObject *(*_bind_execute_many_fail)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail *__pyx_optional_args);
  PyObject *(*_bind)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *);
  PyObject *(*_execute)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int32_t);
  PyObject *(*_close)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int);
  PyObject *(*_simple_query)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_copy_out)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_copy_in)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_terminate)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_decode_row)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char const *, Py_ssize_t);
  PyObject *(*_on_result)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *);
  PyObject *(*_on_notification)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_on_notice)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
  PyObject *(*_set_server_parameter)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *);
  PyObject *(*_on_connection_lost)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_vtabptr_7asyncpg_8protocol_8protocol_CoreProtocol;


/* "asyncpg/protocol/prepared_stmt.pyx":12
 * 
 * @cython.final
 * cdef class PreparedStatementState:             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_PreparedStatementState {
  PyObject *(*_encode_bind_msg)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
  PyObject *(*_init_codecs)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, int __pyx_skip_dispatch);
  PyObject *(*_ensure_rows_decoder)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *);
  PyObject *(*_ensure_args_encoder)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *);
  PyObject *(*_set_row_desc)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
  PyObject *(*_set_args_desc)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
  PyObject *(*_decode_row)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, char const *, Py_ssize_t);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_vtabptr_7asyncpg_8protocol_8protocol_PreparedStatementState;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__init_codecs(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, int __pyx_skip_dispatch);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_args_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_row_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_args_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *);
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__decode_row(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, char const *, Py_ssize_t);


/* "asyncpg/protocol/protocol.pyx":75
 * 
 * 
 * cdef class BaseProtocol(CoreProtocol):             # <<<<<<<<<<<<<<
 *     def __init__(self, addr, connected_fut, con_params, record_class: type, loop):
 *         # type of `con_params` is `_ConnectionParameters`
 */

struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol {
  struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol __pyx_base;
  PyObject *(*get_connection)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
  PyObject *(*_get_timeout_impl)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_check_state)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
  PyObject *(*_new_waiter)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_coreproto_error)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
  PyObject *(*_on_result__connect)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__prepare)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__bind_and_exec)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__close_stmt_or_portal)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__simple_query)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__bind)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__copy_out)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_on_result__copy_in)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_handle_waiter_on_connection_lost)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
  PyObject *(*_dispatch_result)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
  PyObject *(*resume_reading)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
  PyObject *(*pause_reading)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_vtabptr_7asyncpg_8protocol_8protocol_BaseProtocol;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_pause_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *);

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

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

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

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#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

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#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

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

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

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

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

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

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

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

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

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

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

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#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

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

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

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

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

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

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

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#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

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

/* py_dict_pop.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value);

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

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

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

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

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

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

/* bytes_tailmatch.proto */
static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
                                         Py_ssize_t start, Py_ssize_t end, int direction);
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
                                   Py_ssize_t start, Py_ssize_t end, int direction);

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

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

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

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

/* BuildPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState value, Py_ssize_t width, char padding_char, char format_char);

/* 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_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, 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));

/* decode_bytes.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
         PyObject* string, 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)) {
    return __Pyx_decode_c_bytes(
        PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string),
        start, stop, encoding, errors, decode_func);
}

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

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, 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)

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char);

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* RaiseKeywordRequired.proto */
static void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name);

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

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

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

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

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

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

/* Coroutine.proto */
#define __Pyx_Coroutine_USED
static PyTypeObject *__pyx_CoroutineType = 0;
static PyTypeObject *__pyx_CoroutineAwaitType = 0;
#define __Pyx_Coroutine_CheckExact(obj) (Py_TYPE(obj) == __pyx_CoroutineType)
#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj)
#define __Pyx_CoroutineAwait_CheckExact(obj) (Py_TYPE(obj) == __pyx_CoroutineAwaitType)
#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_CoroutineType, body, code, closure, name, qualname, module_name)
static int __pyx_Coroutine_init(void);
static PyObject *__Pyx__Coroutine_await(PyObject *coroutine);
typedef struct {
    PyObject_HEAD
    PyObject *coroutine;
} __pyx_CoroutineAwaitObject;
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg);
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args);

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

/* CoroutineYieldFrom.proto */
static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source);

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

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

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

/* AsyncIter.proto */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *o);
static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *o);

/* StopAsyncIteration.proto */
#define __Pyx_StopAsyncIteration_USED
static PyObject *__Pyx_PyExc_StopAsyncIteration;
static int __pyx_StopAsyncIteration_init(void);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

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

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

/* CallNextTpDealloc.proto */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);

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

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

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

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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

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

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

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

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

/* UnicodeAsUCS4.proto */
static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage value);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(PyObject *);

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat value);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_CodecType(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType value);

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(PyObject *);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int16_t(int16_t value);

/* ObjectAsUCS4.proto */
#define __Pyx_PyObject_AsPy_UCS4(x)\
    (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x))
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* IterableCoroutine.proto */
#define __Pyx_IterableCoroutine_USED
static PyTypeObject *__pyx_IterableCoroutineType = 0;
#undef __Pyx_Coroutine_Check
#define __Pyx_Coroutine_Check(obj) (__Pyx_Coroutine_CheckExact(obj) || (Py_TYPE(obj) == __pyx_IterableCoroutineType))
#define __Pyx_IterableCoroutine_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_IterableCoroutineType, body, code, closure, name, qualname, module_name)
static int __pyx_IterableCoroutine_init(void);

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

/* VoidPtrExport.proto */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_setting(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_is_encoding_utf8(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_text_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_register_data_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_types, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, uint32_t __pyx_v_oid, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, PyObject *__pyx_v_kind, enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType __pyx_v_type, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_c_encoder, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_c_decoder, PyObject *__pyx_v_py_encoder, PyObject *__pyx_v_py_decoder, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec, PyObject *__pyx_v_element_type_oids, PyObject *__pyx_v_element_names, PyObject *__pyx_v_element_codecs, Py_UCS4 __pyx_v_element_delimiter); /* proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_copy(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_is_binary(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto*/
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_array_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec, Py_UCS4 __pyx_v_element_delimiter); /* proto*/
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_range_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec); /* proto*/
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_composite_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, PyObject *__pyx_v_element_codecs, PyObject *__pyx_v_element_type_oids, PyObject *__pyx_v_element_names); /* proto*/
static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_python_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, PyObject *__pyx_v_kind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_c_encoder, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_c_decoder, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat); /* proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec *__pyx_optional_args); /* proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_username); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_parse_server_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_server_response); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_verify_server_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_server_final_message); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_nonce(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, int __pyx_v_num_bytes); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_proof(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_salted_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password, PyObject *__pyx_v_salt, int __pyx_v_iterations); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__normalize_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_original_password); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol_is_in_transaction(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__read_server_messages(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__auth(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__close_stmt_portal(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_command_complete(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_copy_data_msgs(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_data_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_done_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_fail_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_cause); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_data_msgs(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_backend_key_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_parameter_status(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_notification(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_authentication(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_cleartext(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_md5(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_salt); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_initial(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_sasl_auth_methods); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_continue(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_server_response); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_ready_for_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_error_response(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_is_error); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__push_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__reset_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_v_new_state); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__ensure_connected(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_parse_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query); /* proto*/
static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_bind_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data); /* proto*/
static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_empty_bind_data(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_execute_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, int32_t __pyx_v_limit); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__connect(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__send_bind_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data, int32_t __pyx_v_limit); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data, int32_t __pyx_v_limit); /* proto*/
static int __pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_bind_data); /* proto*/
static int __pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_error, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, int32_t __pyx_v_limit); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__close(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_is_portal); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_query); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__terminate(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__writelines(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_buffers); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__decode_row(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED char const *__pyx_v_buf, CYTHON_UNUSED Py_ssize_t __pyx_v_buf_len); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_server_parameter(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_val); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_result(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notice(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_parsed); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notification(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_pid, CYTHON_UNUSED PyObject *__pyx_v_channel, CYTHON_UNUSED PyObject *__pyx_v_payload); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_connection_lost(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__init_codecs(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_args); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_args_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_row_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_desc); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_args_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_desc); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__decode_row(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, char const *__pyx_v_cbuf, Py_ssize_t __pyx_v_buf_len); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_get_connection(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_pause_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__handle_waiter_on_connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_cause); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__set_server_parameter(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__check_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__coreproto_error(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__new_waiter(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__connect(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind_and_exec(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__close_stmt_or_portal(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__decode_row(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, char const *__pyx_v_buf, Py_ssize_t __pyx_v_buf_len); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__dispatch_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notice(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_parsed); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notification(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_pid, PyObject *__pyx_v_channel, PyObject *__pyx_v_payload); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__write(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_buf); /* proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__writelines(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_buffers); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_write_len_prefixed_utf8(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_s); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_self); /* proto*/
static CYTHON_INLINE char __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_type(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_self); /* proto*/
static CYTHON_INLINE int32_t __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_length(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_self); /* proto*/

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

/* Module declarations from 'asyncpg.pgproto.debug' */

/* Module declarations from 'cython' */

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'asyncpg.pgproto.pgproto' */
static PyTypeObject *__pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext = 0;
static CYTHON_INLINE Py_ssize_t __pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static CYTHON_INLINE void __pyx_f_7asyncpg_7pgproto_7pgproto_frb_set_len(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, Py_ssize_t); /*proto*/
static CYTHON_INLINE void __pyx_f_7asyncpg_7pgproto_7pgproto_frb_init(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, char const *, Py_ssize_t); /*proto*/
static CYTHON_INLINE char const *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, Py_ssize_t); /*proto*/
static CYTHON_INLINE char const *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_read_all(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static CYTHON_INLINE struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, Py_ssize_t); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_frb_check)(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, Py_ssize_t); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode_tuple)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bits_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bits_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bool_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bool_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_box_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_box_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_line_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_line_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_point_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_point_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_path_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_path_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_poly_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_poly_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_circle_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_circle_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int2_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int2_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int4_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int4_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int8_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_int8_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_float4_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_float4_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_float8_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_float8_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_as_pg_string_and_size)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, PyObject *, char **, Py_ssize_t *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_text)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_text)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_binary)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_binary)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_void_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_void_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_tid_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_tid_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_inet_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_inet_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_encode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_decode)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/

/* Module declarations from 'asyncpg.pgproto' */

/* Module declarations from 'asyncpg.protocol' */

/* Module declarations from 'asyncpg.protocol.cpythonx' */

/* Module declarations from 'asyncpg.protocol.record' */

/* Module declarations from 'asyncpg.pgproto.hton' */

/* Module declarations from 'asyncpg.protocol.protocol' */
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_Codec = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_DataCodecConfig = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_ConnectionSettings = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_CoreProtocol = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close = 0;
static PyTypeObject *__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation = 0;
static PyObject *__pyx_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES = 0;
static PyObject *__pyx_7genexpr__pyx_v_7asyncpg_8protocol_8protocol_k;
static PyObject *__pyx_7genexpr__pyx_v_7asyncpg_8protocol_8protocol_v;
static PyObject *__pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP = 0;
static void *__pyx_v_7asyncpg_8protocol_8protocol_binary_codec_map[((0x13D8 + 1) * 2)];
static void *__pyx_v_7asyncpg_8protocol_8protocol_text_codec_map[((0x13D8 + 1) * 2)];
static PyObject *__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS = 0;
static Py_UCS4 *__pyx_v_7asyncpg_8protocol_8protocol_APG_NULL;
static PyObject *__pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE = 0;
static PyObject *__pyx_v_7asyncpg_8protocol_8protocol_FLUSH_MESSAGE = 0;
static PyObject *__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k;
static PyObject *__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v;
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_get_python_encoding(PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_codec_encode_func_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_codec_decode_func_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, void const *); /*proto*/
static uint32_t __pyx_f_7asyncpg_8protocol_8protocol_pylong_as_oid(PyObject *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec *__pyx_optional_args); /*proto*/
static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol_has_core_codec(uint32_t); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(uint32_t, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_register_core_codec *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_register_extra_codec(PyObject *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat); /*proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_get_extra_codec(PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat); /*proto*/
static CYTHON_INLINE uint32_t __pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(uint32_t); /*proto*/
static int __pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp(Py_UCS4 const *, Py_UCS4 const *); /*proto*/
static int __pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp_char(char const *, char const *); /*proto*/
static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace(Py_UCS4); /*proto*/
static Py_UCS4 *__pyx_f_7asyncpg_8protocol_8protocol_apg_parse_int32(Py_UCS4 *, int32_t *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_bits_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_bytea_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_datetime_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_float_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_geometry_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_hstore_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_json_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_int_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_pseudo_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_text_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_tid_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_txid_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_tsearch_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_uuid_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_numeric_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_network_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_monetary_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_all_pgproto_codecs(void); /*proto*/
static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__is_trivial_container(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol__is_array_iterable(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol__is_sub_array_iterable(PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__get_array_shape(PyObject *, int32_t *, int32_t *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__write_array_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, int32_t, int32_t, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex, void const *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_array_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, uint32_t, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__write_textarray_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, int32_t, int32_t, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex, void const *, Py_UCS4); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_textarray_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex, void const *, Py_UCS4); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_array_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__nested_array_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex, void const *, int32_t, int32_t *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_textarray_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex, void const *, Py_UCS4); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__textarray_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, Py_UCS4 *, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex, void const *, Py_UCS4); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(Py_UCS4 const *, Py_UCS4 const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__infer_array_dims(Py_UCS4 const *, Py_UCS4, int32_t *, int32_t *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_uint4_encode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_uint4_decode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_text_encode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_text_decode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arraytext_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arraytext_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anyarray_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_array_codecs(void); /*proto*/
static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__range_has_lbound(uint8_t); /*proto*/
static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__range_has_ubound(uint8_t); /*proto*/
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType __pyx_f_7asyncpg_8protocol_8protocol__range_type(PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_range_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *, uint32_t, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_range_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex, void const *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_range_codecs(void); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_record_encode_frame(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_record_codecs(void); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__decode_parameters_desc(PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__decode_row_desc(PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_DataCodecConfig__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_CoreProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_BaseProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "asyncpg.protocol.protocol"
extern int __pyx_module_is_main_asyncpg__protocol__protocol;
int __pyx_module_is_main_asyncpg__protocol__protocol = 0;

/* Implementation of 'asyncpg.protocol.protocol' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_OverflowError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_reversed;
static PyObject *__pyx_builtin_any;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_UnicodeEncodeError;
static PyObject *__pyx_builtin_chr;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_BufferError;
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_n[] = "n,,";
static const char __pyx_k_p[] = ",p=";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "s=([^,]+),";
static const char __pyx_k_v[] = "v=([^,]+)";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_NA[] = "NA";
static const char __pyx_k__2[] = "_";
static const char __pyx_k__9[] = "{}[]";
static const char __pyx_k_et[] = "et";
static const char __pyx_k_ns[] = "ns";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_tb[] = "tb";
static const char __pyx_k_to[] = " to ";
static const char __pyx_k_OID[] = " (OID ";
static const char __pyx_k__12[] = ")";
static const char __pyx_k__19[] = "\"\"";
static const char __pyx_k__26[] = "\000";
static const char __pyx_k__34[] = ",";
static const char __pyx_k__35[] = "\000\000\000\001";
static const char __pyx_k__36[] = " ";
static const char __pyx_k__37[] = "";
static const char __pyx_k__40[] = ".";
static const char __pyx_k__41[] = ", ";
static const char __pyx_k__42[] = "'{}'";
static const char __pyx_k__43[] = ": ";
static const char __pyx_k__45[] = "...";
static const char __pyx_k_abc[] = "abc";
static const char __pyx_k_alt[] = "alt";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_big[] = "big";
static const char __pyx_k_bit[] = "bit";
static const char __pyx_k_box[] = "box";
static const char __pyx_k_c_2[] = "c=";
static const char __pyx_k_c_3[] = ",c=";
static const char __pyx_k_chr[] = "chr";
static const char __pyx_k_cid[] = "cid";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_i_d[] = "i=(\\d+),?";
static const char __pyx_k_int[] = "int";
static const char __pyx_k_md5[] = "md5";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_n_2[] = "n=";
static const char __pyx_k_n_3[] = "n";
static const char __pyx_k_new[] = "new";
static const char __pyx_k_oid[] = "oid";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_r_2[] = ",r=";
static const char __pyx_k_r_3[] = "r=([^,]+),";
static const char __pyx_k_rec[] = "rec";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_s_2[] = "s";
static const char __pyx_k_set[] = "set";
static const char __pyx_k_tid[] = "tid";
static const char __pyx_k_v_2[] = "v";
static const char __pyx_k_was[] = "was";
static const char __pyx_k_win[] = "win";
static const char __pyx_k_xid[] = "xid";
static const char __pyx_k_xml[] = "xml";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_NFKC[] = "NFKC";
static const char __pyx_k_NULL[] = "NULL";
static const char __pyx_k_Type[] = "Type";
static const char __pyx_k_addr[] = "addr";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_base[] = "_base";
static const char __pyx_k_bind[] = "bind";
static const char __pyx_k_bool[] = "bool";
static const char __pyx_k_char[] = "char";
static const char __pyx_k_cidr[] = "cidr";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_date[] = "date";
static const char __pyx_k_desc[] = "desc";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_done[] = "done";
static const char __pyx_k_elem[] = "elem";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_hint[] = "hint";
static const char __pyx_k_hmac[] = "hmac";
static const char __pyx_k_inet[] = "inet";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_int2[] = "int2";
static const char __pyx_k_int4[] = "int4";
static const char __pyx_k_int8[] = "int8";
static const char __pyx_k_json[] = "json";
static const char __pyx_k_kind[] = "kind";
static const char __pyx_k_line[] = "line";
static const char __pyx_k_loop[] = "loop";
static const char __pyx_k_lseg[] = "lseg";
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_real[] = "real";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sink[] = "sink";
static const char __pyx_k_sjis[] = "sjis";
static const char __pyx_k_smgr[] = "smgr";
static const char __pyx_k_tcvn[] = "tcvn";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_text[] = "text";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_user[] = "user";
static const char __pyx_k_uuid[] = "uuid";
static const char __pyx_k_void[] = "void";
static const char __pyx_k_wait[] = "wait";
static const char __pyx_k_were[] = "were";
static const char __pyx_k_xid8[] = "xid8";
static const char __pyx_k_Codec[] = "Codec";
static const char __pyx_k_Event[] = "Event";
static const char __pyx_k_Range[] = "Range";
static const char __pyx_k_Sized[] = "Sized";
static const char __pyx_k_Timer[] = "Timer";
static const char __pyx_k_abort[] = "abort";
static const char __pyx_k_aiter[] = "__aiter__";
static const char __pyx_k_anext[] = "__anext__";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_await[] = "__await__";
static const char __pyx_k_bytea[] = "bytea";
static const char __pyx_k_cause[] = "__cause__";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_cp866[] = "cp866";
static const char __pyx_k_cp874[] = "cp874";
static const char __pyx_k_cp932[] = "cp932";
static const char __pyx_k_cp936[] = "cp936";
static const char __pyx_k_cp949[] = "cp949";
static const char __pyx_k_cp950[] = "cp950";
static const char __pyx_k_elems[] = "elems";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_euccn[] = "euccn";
static const char __pyx_k_eucjp[] = "eucjp";
static const char __pyx_k_euckr[] = "euckr";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_jsonb[] = "jsonb";
static const char __pyx_k_koi8r[] = "koi8r";
static const char __pyx_k_koi8u[] = "koi8u";
static const char __pyx_k_limit[] = "limit";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_money[] = "money";
static const char __pyx_k_new_2[] = "__new__";
static const char __pyx_k_oid_2[] = "oid[]";
static const char __pyx_k_point[] = "point";
static const char __pyx_k_query[] = "query";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_state[] = "state";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_tuple[] = "tuple";
static const char __pyx_k_types[] = "types";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_vscii[] = "vscii";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_DIGEST[] = "DIGEST";
static const char __pyx_k_Future[] = "Future";
static const char __pyx_k_PGCOPY[] = "PGCOPY\n\377\r\n\000";
static const char __pyx_k_Record[] = "Record";
static const char __pyx_k_amount[] = "amount";
static const char __pyx_k_base64[] = "base64";
static const char __pyx_k_bigint[] = "bigint";
static const char __pyx_k_binary[] = "binary";
static const char __pyx_k_bpchar[] = "bpchar";
static const char __pyx_k_budget[] = "budget";
static const char __pyx_k_cancel[] = "cancel";
static const char __pyx_k_circle[] = "circle";
static const char __pyx_k_codecs[] = "codecs";
static const char __pyx_k_compat[] = "compat";
static const char __pyx_k_config[] = "_config";
static const char __pyx_k_cp1250[] = "cp1250";
static const char __pyx_k_cp1251[] = "cp1251";
static const char __pyx_k_cp1252[] = "cp1252";
static const char __pyx_k_cp1253[] = "cp1253";
static const char __pyx_k_cp1254[] = "cp1254";
static const char __pyx_k_cp1255[] = "cp1255";
static const char __pyx_k_cp1256[] = "cp1256";
static const char __pyx_k_cp1257[] = "cp1257";
static const char __pyx_k_cp1258[] = "cp1258";
static const char __pyx_k_cp1521[] = "cp1521";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_detail[] = "detail";
static const char __pyx_k_digest[] = "digest";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_euc_cn[] = "euc_cn";
static const char __pyx_k_euc_jp[] = "euc_jp";
static const char __pyx_k_euc_kr[] = "euc_kr";
static const char __pyx_k_family[] = "family";
static const char __pyx_k_float4[] = "float4";
static const char __pyx_k_float8[] = "float8";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_koi8_r[] = "koi8_r";
static const char __pyx_k_koi8_u[] = "koi8_u";
static const char __pyx_k_lookup[] = "lookup";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_opaque[] = "opaque";
static const char __pyx_k_pg_lsn[] = "pg_lsn";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_reader[] = "reader";
static const char __pyx_k_record[] = "record";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_scalar[] = "scalar";
static const char __pyx_k_schema[] = "schema";
static const char __pyx_k_search[] = "search";
static const char __pyx_k_sha256[] = "sha256";
static const char __pyx_k_socket[] = "socket";
static const char __pyx_k_text_2[] = "text[]";
static const char __pyx_k_timetz[] = "timetz";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_varbit[] = "varbit";
static const char __pyx_k_win866[] = "win866";
static const char __pyx_k_win874[] = "win874";
static const char __pyx_k_win932[] = "win932";
static const char __pyx_k_win936[] = "win936";
static const char __pyx_k_win949[] = "win949";
static const char __pyx_k_win950[] = "win950";
static const char __pyx_k_AF_UNIX[] = "AF_UNIX";
static const char __pyx_k_Mapping[] = "Mapping";
static const char __pyx_k_abstime[] = "abstime";
static const char __pyx_k_aclitem[] = "aclitem";
static const char __pyx_k_anyenum[] = "anyenum";
static const char __pyx_k_apg_exc[] = "apg_exc";
static const char __pyx_k_asyncio[] = "asyncio";
static const char __pyx_k_asyncpg[] = "asyncpg";
static const char __pyx_k_cleanup[] = "_cleanup";
static const char __pyx_k_copy_in[] = "copy_in";
static const char __pyx_k_cstring[] = "cstring";
static const char __pyx_k_decimal[] = "decimal";
static const char __pyx_k_decoder[] = "decoder";
static const char __pyx_k_encoder[] = "encoder";
static const char __pyx_k_execute[] = "execute";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_hashlib[] = "hashlib";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_integer[] = "integer";
static const char __pyx_k_isempty[] = "isempty";
static const char __pyx_k_macaddr[] = "macaddr";
static const char __pyx_k_mapping[] = "mapping";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_numeric[] = "numeric";
static const char __pyx_k_polygon[] = "polygon";
static const char __pyx_k_prepare[] = "prepare";
static const char __pyx_k_records[] = "records";
static const char __pyx_k_regoper[] = "regoper";
static const char __pyx_k_regproc[] = "regproc";
static const char __pyx_k_regrole[] = "regrole";
static const char __pyx_k_regtype[] = "regtype";
static const char __pyx_k_release[] = "release";
static const char __pyx_k_reltime[] = "reltime";
static const char __pyx_k_secrets[] = "secrets";
static const char __pyx_k_started[] = "_started";
static const char __pyx_k_timeout[] = "timeout";
static const char __pyx_k_trigger[] = "trigger";
static const char __pyx_k_tsquery[] = "tsquery";
static const char __pyx_k_typeoid[] = "typeoid";
static const char __pyx_k_unicode[] = "unicode";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_urandom[] = "urandom";
static const char __pyx_k_utf_8_2[] = "utf_8";
static const char __pyx_k_varchar[] = "varchar";
static const char __pyx_k_weakref[] = "weakref";
static const char __pyx_k_win1250[] = "win1250";
static const char __pyx_k_win1251[] = "win1251";
static const char __pyx_k_win1252[] = "win1252";
static const char __pyx_k_win1253[] = "win1253";
static const char __pyx_k_win1254[] = "win1254";
static const char __pyx_k_win1255[] = "win1255";
static const char __pyx_k_win1256[] = "win1256";
static const char __pyx_k_win1257[] = "win1257";
static const char __pyx_k_win1258[] = "win1258";
static const char __pyx_k_xformat[] = "xformat";
static const char __pyx_k_Iterable[] = "Iterable";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_Protocol[] = "Protocol";
static const char __pyx_k_ROLLBACK[] = "ROLLBACK";
static const char __pyx_k_SizedABC[] = "SizedABC";
static const char __pyx_k_alias_to[] = "alias_to";
static const char __pyx_k_anyarray[] = "anyarray";
static const char __pyx_k_anyrange[] = "anyrange";
static const char __pyx_k_auth_msg[] = "auth_msg";
static const char __pyx_k_basetype[] = "basetype";
static const char __pyx_k_budget_2[] = "_budget";
static const char __pyx_k_builtins[] = "builtins";
static const char __pyx_k_conn_key[] = "conn_key";
static const char __pyx_k_copy_out[] = "copy_out";
static const char __pyx_k_database[] = "database";
static const char __pyx_k_elemtype[] = "elemtype";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_internal[] = "internal";
static const char __pyx_k_interval[] = "interval";
static const char __pyx_k_jsonpath[] = "jsonpath";
static const char __pyx_k_macaddr8[] = "macaddr8";
static const char __pyx_k_on_error[] = "_on_error";
static const char __pyx_k_password[] = "password";
static const char __pyx_k_position[] = "position";
static const char __pyx_k_protocol[] = "protocol";
static const char __pyx_k_pyx_capi[] = "__pyx_capi__";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_regclass[] = "regclass";
static const char __pyx_k_reversed[] = "reversed";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_smallint[] = "smallint";
static const char __pyx_k_tcvn5712[] = "tcvn5712";
static const char __pyx_k_to_bytes[] = "to_bytes";
static const char __pyx_k_tsvector[] = "tsvector";
static const char __pyx_k_typekind[] = "typekind";
static const char __pyx_k_typename[] = "typename";
static const char __pyx_k_wait_for[] = "wait_for";
static const char __pyx_k_with_msg[] = "with_msg";
static const char __pyx_k_Attribute[] = "Attribute";
static const char __pyx_k_DataError[] = "DataError";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_add_types[] = "add_types";
static const char __pyx_k_apg_types[] = "apg_types";
static const char __pyx_k_attrnames[] = "attrnames";
static const char __pyx_k_b64decode[] = "b64decode";
static const char __pyx_k_b64encode[] = "b64encode";
static const char __pyx_k_byteorder[] = "byteorder";
static const char __pyx_k_cache_key[] = "cache_key";
static const char __pyx_k_cancelled[] = "cancelled";
static const char __pyx_k_character[] = "character";
static const char __pyx_k_codec_for[] = " codec for ";
static const char __pyx_k_composite[] = "composite";
static const char __pyx_k_copy_stmt[] = "copy_stmt";
static const char __pyx_k_data_type[] = "data_type";
static const char __pyx_k_elemdelim[] = "elemdelim";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_gtsvector[] = "gtsvector";
static const char __pyx_k_hexdigest[] = "hexdigest";
static const char __pyx_k_lower_inc[] = "lower_inc";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_monotonic[] = "monotonic";
static const char __pyx_k_normalize[] = "normalize";
static const char __pyx_k_prepare_2[] = "__prepare__";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_refcursor[] = "refcursor";
static const char __pyx_k_regconfig[] = "regconfig";
static const char __pyx_k_shift_jis[] = "shift_jis";
static const char __pyx_k_sql_ascii[] = "sql_ascii";
static const char __pyx_k_stmt_name[] = "stmt_name";
static const char __pyx_k_timestamp[] = "timestamp";
static const char __pyx_k_tinterval[] = "tinterval";
static const char __pyx_k_upper_inc[] = "upper_inc";
static const char __pyx_k_Client_Key[] = "Client Key";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_MappingABC[] = "MappingABC";
static const char __pyx_k_NO_TIMEOUT[] = "NO_TIMEOUT";
static const char __pyx_k_Server_Key[] = "Server Key";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_anyelement[] = "anyelement";
static const char __pyx_k_call_later[] = "call_later";
static const char __pyx_k_con_params[] = "con_params";
static const char __pyx_k_exceptions[] = "exceptions";
static const char __pyx_k_memoryview[] = "memoryview";
static const char __pyx_k_on_timeout[] = "_on_timeout";
static const char __pyx_k_pg_catalog[] = "pg_catalog";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_set_result[] = "set_result";
static const char __pyx_k_setsockopt[] = "setsockopt";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_stringprep[] = "stringprep";
static const char __pyx_k_typeschema[] = "typeschema";
static const char __pyx_k_windows866[] = "windows866";
static const char __pyx_k_windows874[] = "windows874";
static const char __pyx_k_windows932[] = "windows932";
static const char __pyx_k_windows936[] = "windows936";
static const char __pyx_k_windows949[] = "windows949";
static const char __pyx_k_windows950[] = "windows950";
static const char __pyx_k_writelines[] = "writelines";
static const char __pyx_k_ARRAY_TYPES[] = "ARRAY_TYPES";
static const char __pyx_k_BufferError[] = "BufferError";
static const char __pyx_k_IPPROTO_TCP[] = "IPPROTO_TCP";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_IterableABC[] = "IterableABC";
static const char __pyx_k_OrderedDict[] = "OrderedDict";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_TCP_NODELAY[] = "TCP_NODELAY";
static const char __pyx_k_anynonarray[] = "anynonarray";
static const char __pyx_k_attrtypoids[] = "attrtypoids";
static const char __pyx_k_bit_varying[] = "bit varying";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_fdw_handler[] = "fdw_handler";
static const char __pyx_k_get_timeout[] = "_get_timeout";
static const char __pyx_k_hashlib_md5[] = "hashlib_md5";
static const char __pyx_k_in_table_a1[] = "in_table_a1";
static const char __pyx_k_in_table_b1[] = "in_table_b1";
static const char __pyx_k_in_table_c3[] = "in_table_c3";
static const char __pyx_k_in_table_c4[] = "in_table_c4";
static const char __pyx_k_in_table_c5[] = "in_table_c5";
static const char __pyx_k_in_table_c6[] = "in_table_c6";
static const char __pyx_k_in_table_c7[] = "in_table_c7";
static const char __pyx_k_in_table_c8[] = "in_table_c8";
static const char __pyx_k_in_table_c9[] = "in_table_c9";
static const char __pyx_k_in_table_d1[] = "in_table_d1";
static const char __pyx_k_in_table_d2[] = "in_table_d2";
static const char __pyx_k_pg_mcv_list[] = "pg_mcv_list";
static const char __pyx_k_pg_snapshot[] = "pg_snapshot";
static const char __pyx_k_portal_name[] = "portal_name";
static const char __pyx_k_record_stmt[] = "record_stmt";
static const char __pyx_k_regoperator[] = "regoperator";
static const char __pyx_k_there_is_no[] = ": there is no ";
static const char __pyx_k_timestamptz[] = "timestamptz";
static const char __pyx_k_token_bytes[] = "token_bytes";
static const char __pyx_k_tsm_handler[] = "tsm_handler";
static const char __pyx_k_unicodedata[] = "unicodedata";
static const char __pyx_k_windows1250[] = "windows1250";
static const char __pyx_k_windows1251[] = "windows1251";
static const char __pyx_k_windows1252[] = "windows1252";
static const char __pyx_k_windows1253[] = "windows1253";
static const char __pyx_k_windows1254[] = "windows1254";
static const char __pyx_k_windows1255[] = "windows1255";
static const char __pyx_k_windows1256[] = "windows1256";
static const char __pyx_k_windows1257[] = "windows1257";
static const char __pyx_k_windows1258[] = "windows1258";
static const char __pyx_k_BaseProtocol[] = "BaseProtocol";
static const char __pyx_k_CoreProtocol[] = "CoreProtocol";
static const char __pyx_k_TimeoutError[] = "TimeoutError";
static const char __pyx_k_Timer___exit[] = "Timer.__exit__";
static const char __pyx_k_Timer___init[] = "Timer.__init__";
static const char __pyx_k_apg_exc_base[] = "apg_exc_base";
static const char __pyx_k_bind_execute[] = "bind_execute";
static const char __pyx_k_cannot_alias[] = "cannot alias ";
static const char __pyx_k_euc_jis_2004[] = "euc_jis_2004";
static const char __pyx_k_getattribute[] = "__getattribute__";
static const char __pyx_k_in_table_c12[] = "in_table_c12";
static const char __pyx_k_pg_ndistinct[] = "pg_ndistinct";
static const char __pyx_k_pg_node_tree[] = "pg_node_tree";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_record_class[] = "record_class";
static const char __pyx_k_regcollation[] = "regcollation";
static const char __pyx_k_regnamespace[] = "regnamespace";
static const char __pyx_k_regprocedure[] = "regprocedure";
static const char __pyx_k_return_extra[] = "return_extra";
static const char __pyx_k_server_nonce[] = "server_nonce";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_AsyncIterable[] = "AsyncIterable";
static const char __pyx_k_OverflowError[] = "OverflowError";
static const char __pyx_k_PostgresError[] = "PostgresError";
static const char __pyx_k_ProtocolError[] = "ProtocolError";
static const char __pyx_k_SCRAM_SHA_256[] = "SCRAM-SHA-256";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_Timer___enter[] = "Timer.__enter__";
static const char __pyx_k_anycompatible[] = "anycompatible";
static const char __pyx_k_asyncio_tasks[] = "asyncio.tasks";
static const char __pyx_k_basetype_name[] = "basetype_name";
static const char __pyx_k_connected_fut[] = "connected_fut";
static const char __pyx_k_create_future[] = "create_future";
static const char __pyx_k_create_record[] = "_create_record";
static const char __pyx_k_elemtype_name[] = "elemtype_name";
static const char __pyx_k_event_trigger[] = "event_trigger";
static const char __pyx_k_invalid_nonce[] = "invalid nonce";
static const char __pyx_k_not_connected[] = "not connected";
static const char __pyx_k_password_salt[] = "password_salt";
static const char __pyx_k_pause_reading[] = "pause_reading";
static const char __pyx_k_range_subtype[] = "range_subtype";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_regdictionary[] = "regdictionary";
static const char __pyx_k_set_exception[] = "set_exception";
static const char __pyx_k_txid_snapshot[] = "txid_snapshot";
static const char __pyx_k_AssertionError[] = "AssertionError";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_CancelledError[] = "CancelledError";
static const char __pyx_k_InterfaceError[] = "InterfaceError";
static const char __pyx_k_get_data_codec[] = "get_data_codec";
static const char __pyx_k_get_extra_info[] = "get_extra_info";
static const char __pyx_k_pg_ddl_command[] = "pg_ddl_command";
static const char __pyx_k_query_argument[] = "query argument $";
static const char __pyx_k_request_cancel[] = "_request_cancel";
static const char __pyx_k_resume_reading[] = "resume_reading";
static const char __pyx_k_shift_jis_2004[] = "shift_jis_2004";
static const char __pyx_k_text_or_binary[] = "'text' or 'binary'";
static const char __pyx_k_DataCodecConfig[] = "DataCodecConfig";
static const char __pyx_k_client_encoding[] = "client_encoding";
static const char __pyx_k_close_statement[] = "close_statement";
static const char __pyx_k_collections_abc[] = "collections.abc";
static const char __pyx_k_command_timeout[] = "command_timeout";
static const char __pyx_k_pg_dependencies[] = "pg_dependencies";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_server_settings[] = "server_settings";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_writing_allowed[] = "writing_allowed";
static const char __pyx_k_AUTH_METHOD_NAME[] = "AUTH_METHOD_NAME";
static const char __pyx_k_add_python_codec[] = "add_python_codec";
static const char __pyx_k_clear_type_cache[] = "clear_type_cache";
static const char __pyx_k_double_precision[] = "double precision";
static const char __pyx_k_in_table_c21_c22[] = "in_table_c21_c22";
static const char __pyx_k_index_am_handler[] = "index_am_handler";
static const char __pyx_k_language_handler[] = "language_handler";
static const char __pyx_k_table_am_handler[] = "table_am_handler";
static const char __pyx_k_text_or_binary_2[] = "text or binary";
static const char __pyx_k_BaseProtocol_bind[] = "BaseProtocol.bind";
static const char __pyx_k_add_done_callback[] = "add_done_callback";
static const char __pyx_k_already_connected[] = "already connected";
static const char __pyx_k_bind_execute_many[] = "bind_execute_many";
static const char __pyx_k_character_varying[] = "character varying";
static const char __pyx_k_is_in_transaction[] = "is_in_transaction";
static const char __pyx_k_pg_contrib_hstore[] = "pg_contrib.hstore";
static const char __pyx_k_BaseProtocol_close[] = "BaseProtocol.close";
static const char __pyx_k_BaseProtocol_query[] = "BaseProtocol.query";
static const char __pyx_k_ConnectionSettings[] = "ConnectionSettings";
static const char __pyx_k_StopAsyncIteration[] = "StopAsyncIteration";
static const char __pyx_k_UnicodeEncodeError[] = "UnicodeEncodeError";
static const char __pyx_k_anycompatiblearray[] = "anycompatiblearray";
static const char __pyx_k_anycompatiblerange[] = "anycompatiblerange";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_asyncpg_exceptions[] = "asyncpg.exceptions";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_could_not_get_salt[] = "could not get salt";
static const char __pyx_k_no_decoder_for_OID[] = "no decoder for OID {}";
static const char __pyx_k_no_encoder_for_OID[] = "no encoder for OID {}";
static const char __pyx_k_range_subtype_name[] = "range_subtype_name";
static const char __pyx_k_time_with_timezone[] = "time with timezone";
static const char __pyx_k_InternalClientError[] = "InternalClientError";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_SASLPREP_PROHIBITED[] = "SASLPREP_PROHIBITED";
static const char __pyx_k_SCRAMAuthentication[] = "SCRAMAuthentication";
static const char __pyx_k_could_not_get_nonce[] = "could not get nonce";
static const char __pyx_k_ignore_custom_codec[] = "ignore_custom_codec";
static const char __pyx_k_invalid_data_format[] = "invalid data format: {}";
static const char __pyx_k_on_waiter_completed[] = "_on_waiter_completed";
static const char __pyx_k_password_iterations[] = "password_iterations";
static const char __pyx_k_process_log_message[] = "_process_log_message";
static const char __pyx_k_remove_python_codec[] = "remove_python_codec";
static const char __pyx_k_BUILTIN_TYPE_OID_MAP[] = "BUILTIN_TYPE_OID_MAP";
static const char __pyx_k_BaseProtocol_copy_in[] = "BaseProtocol.copy_in";
static const char __pyx_k_BaseProtocol_execute[] = "BaseProtocol.execute";
static const char __pyx_k_BaseProtocol_prepare[] = "BaseProtocol.prepare";
static const char __pyx_k_ConnectionResetError[] = "ConnectionResetError";
static const char __pyx_k_ConnectionSettings_r[] = "<ConnectionSettings {!r}>";
static const char __pyx_k_generate_token_bytes[] = "generate_token_bytes";
static const char __pyx_k_get_remaining_budget[] = "get_remaining_budget";
static const char __pyx_k_process_notification[] = "_process_notification";
static const char __pyx_k_server_first_message[] = "server_first_message";
static const char __pyx_k_text_binary_or_tuple[] = "'text', 'binary' or 'tuple'";
static const char __pyx_k_BUILTIN_TYPE_NAME_MAP[] = "BUILTIN_TYPE_NAME_MAP";
static const char __pyx_k_BaseProtocol_copy_out[] = "BaseProtocol.copy_out";
static const char __pyx_k_OID_value_too_large_r[] = "OID value too large: {!r}";
static const char __pyx_k_anycompatiblenonarray[] = "anycompatiblenonarray";
static const char __pyx_k_array_length_overflow[] = "array length overflow";
static const char __pyx_k_authentication_method[] = "authentication_method";
static const char __pyx_k_copy_in_locals_lambda[] = "copy_in.<locals>.<lambda>";
static const char __pyx_k_invalid_array_element[] = "invalid array element: {}";
static const char __pyx_k_non_homogeneous_array[] = "non-homogeneous array";
static const char __pyx_k_time_without_timezone[] = "time without timezone";
static const char __pyx_k_unexpected_codec_type[] = "unexpected codec type: {}";
static const char __pyx_k_wait_for_cancellation[] = "_wait_for_cancellation";
static const char __pyx_k_AUTHENTICATION_METHODS[] = "AUTHENTICATION_METHODS";
static const char __pyx_k_PreparedStatementState[] = "PreparedStatementState";
static const char __pyx_k_call_exception_handler[] = "call_exception_handler";
static const char __pyx_k_cancel_current_command[] = "_cancel_current_command";
static const char __pyx_k_cannot_process_message[] = "cannot process message ";
static const char __pyx_k_client_channel_binding[] = "client_channel_binding";
static const char __pyx_k_copy_out_locals_lambda[] = "copy_out.<locals>.<lambda>";
static const char __pyx_k_create_future_fallback[] = "_create_future_fallback";
static const char __pyx_k_declare_fallback_codec[] = "declare_fallback_codec";
static const char __pyx_k_set_builtin_type_codec[] = "set_builtin_type_codec";
static const char __pyx_k_unexpected_data_format[] = "unexpected data format: {}";
static const char __pyx_k_Codec_oid_elem_oid_core[] = "<Codec oid={} elem_oid={} core={}>";
static const char __pyx_k_has_budget_greater_than[] = "has_budget_greater_than";
static const char __pyx_k_timestamp_with_timezone[] = "timestamp with timezone";
static const char __pyx_k_OutdatedSchemaCacheError[] = "OutdatedSchemaCacheError";
static const char __pyx_k_could_not_get_iterations[] = "could not get iterations";
static const char __pyx_k_on_result_waiter_is_None[] = "_on_result: waiter is None";
static const char __pyx_k_on_result_waiter_is_done[] = "_on_result: waiter is done";
static const char __pyx_k_set_builtin_type_codec_2[] = "_set_builtin_type_codec";
static const char __pyx_k_unexpected_end_of_string[] = "unexpected end of string";
static const char __pyx_k_BaseProtocol_bind_execute[] = "BaseProtocol.bind_execute";
static const char __pyx_k_REQUIREMENTS_CLIENT_PROOF[] = "REQUIREMENTS_CLIENT_PROOF";
static const char __pyx_k_asyncpg_protocol_protocol[] = "asyncpg.protocol.protocol";
static const char __pyx_k_malformed_array_literal_r[] = "malformed array literal {!r}: {}";
static const char __pyx_k_pyx_unpickle_BaseProtocol[] = "__pyx_unpickle_BaseProtocol";
static const char __pyx_k_pyx_unpickle_CoreProtocol[] = "__pyx_unpickle_CoreProtocol";
static const char __pyx_k_DEFAULT_CLIENT_NONCE_BYTES[] = "DEFAULT_CLIENT_NONCE_BYTES";
static const char __pyx_k_Timer_get_remaining_budget[] = "Timer.get_remaining_budget";
static const char __pyx_k_TimoutError_was_not_raised[] = "TimoutError was not raised";
static const char __pyx_k_timestamp_without_timezone[] = "timestamp without timezone";
static const char __pyx_k_unexpected_exchange_format[] = "unexpected exchange format: {}";
static const char __pyx_k_ConnectionDoesNotExistError[] = "ConnectionDoesNotExistError";
static const char __pyx_k_BaseProtocol_close_statement[] = "BaseProtocol.close_statement";
static const char __pyx_k_decode_row_statement_is_None[] = "_decode_row: statement is None";
static const char __pyx_k_pyx_unpickle_DataCodecConfig[] = "__pyx_unpickle_DataCodecConfig";
static const char __pyx_k_unhandled_standard_data_type[] = "unhandled standard data type ";
static const char __pyx_k_Timer_has_budget_greater_than[] = "Timer.has_budget_greater_than";
static const char __pyx_k_UnsupportedClientFeatureError[] = "UnsupportedClientFeatureError";
static const char __pyx_k_asyncpg_protocol_protocol_pyx[] = "asyncpg/protocol/protocol.pyx";
static const char __pyx_k_missing_array_dimension_value[] = "missing array dimension value";
static const char __pyx_k_BaseProtocol_bind_execute_many[] = "BaseProtocol.bind_execute_many";
static const char __pyx_k_could_not_get_server_signature[] = "could not get server signature";
static const char __pyx_k_invalid_array_element_at_index[] = "invalid array element at index {}: {}";
static const char __pyx_k_missing_after_array_dimensions[] = "missing ']' after array dimensions";
static const char __pyx_k_Note_that_parameters_are_suppor[] = "  Note that parameters are supported only in SELECT, INSERT, UPDATE, DELETE, and VALUES statements, and will *not* work in statements  like CREATE VIEW or DECLARE CURSOR.";
static const char __pyx_k_cannot_close_prepared_statement[] = "cannot close prepared statement; refs == {} != 0";
static const char __pyx_k_cannot_switch_to_state_protocol[] = "cannot switch to state {}; protocol is in the \"failed\" state";
static const char __pyx_k_got_result_for_unknown_protocol[] = "got result for unknown protocol state {}";
static const char __pyx_k_on_result__prepare_statement_is[] = "_on_result__prepare: statement is None";
static const char __pyx_k_parse_data_msgs_first_message_i[] = "_parse_data_msgs: first message is not \"D\"";
static const char __pyx_k_parse_data_msgs_result_is_not_a[] = "_parse_data_msgs: result is not a list, but {!r}";
static const char __pyx_k_protocol_is_in_an_unexpected_st[] = ": protocol is in an unexpected state ";
static const char __pyx_k_r_is_not_a_valid_element_of_com[] = "{!r} is not a valid element of composite type {}";
static const char __pyx_k_the_server_expects_x_argument_s[] = "the server expects {x} argument{s} for this query, {y} {w} passed";
static const char __pyx_k_type_does_not_support_the_tuple[] = "{} type does not support the 'tuple' exchange format";
static const char __pyx_k_type_record_missing_field_types[] = "type record missing field types for composite ";
static const char __pyx_k_unexpected_array_dimension_size[] = "unexpected array dimension size: {}";
static const char __pyx_k_unexpected_instance_of_anyarray[] = "unexpected instance of 'anyarray' type";
static const char __pyx_k_unexpected_number_of_attributes[] = "unexpected number of attributes of composite type: {}, expected {}";
static const char __pyx_k_unsupported_SASL_Authentication[] = "unsupported SASL Authentication methods requested by the server: {!r}";
static const char __pyx_k_BaseProtocol__wait_for_cancellat[] = "BaseProtocol._wait_for_cancellation";
static const char __pyx_k_Check_the_query_against_the_pass[] = "Check the query against the passed list of arguments.";
static const char __pyx_k_Consider_declaring_an_explicit_c[] = "Consider declaring an explicit composite type and using it to cast the argument.";
static const char __pyx_k_Incompatible_checksums_s_vs_0x3a[] = "Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x73[] = "Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xfb[] = "Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))";
static const char __pyx_k_PostgreSQL_does_not_implement_an[] = "PostgreSQL does not implement anonymous composite type input.";
static const char __pyx_k_REQUIREMENTS_CLIENT_FINAL_MESSAG[] = "REQUIREMENTS_CLIENT_FINAL_MESSAGE";
static const char __pyx_k_SCRAMAuthentication__bytes_xor_l[] = "SCRAMAuthentication._bytes_xor.<locals>.genexpr";
static const char __pyx_k_SCRAMAuthentication__normalize_p[] = "SCRAMAuthentication._normalize_password.<locals>.genexpr";
static const char __pyx_k_a_sized_iterable_container_expec[] = "a sized iterable container expected (got type {!r})";
static const char __pyx_k_asyncpg_Protocol_has_no_referenc[] = "asyncpg.Protocol has no reference to its Connection object and yet a cancellation was requested. Please report this at github.com/magicstack/asyncpg.";
static const char __pyx_k_bind_execute_many_locals_genexpr[] = "bind_execute_many.<locals>.genexpr";
static const char __pyx_k_cannot_decode_type_text_encoding[] = "cannot decode type \"{}\".\"{}\": text encoding of range types is not supported";
static const char __pyx_k_cannot_perform_operation_another[] = "cannot perform operation: another operation is cancelling";
static const char __pyx_k_cannot_perform_operation_connect[] = "cannot perform operation: connection is closed";
static const char __pyx_k_cannot_register_core_codec_for_O[] = "cannot register core codec for OID {}: it is greater than MAXSUPPORTEDOID ({})";
static const char __pyx_k_cannot_switch_to_idle_state_prot[] = "cannot switch to \"idle\" state; protocol is in the \"failed\" state";
static const char __pyx_k_cannot_switch_to_state_another_o[] = "cannot switch to state {}; another operation ({}) is in progress";
static const char __pyx_k_connection_was_closed_in_the_mid[] = "connection was closed in the middle of operation";
static const char __pyx_k_could_not_verify_server_signatur[] = "could not verify server signature for SCRAM authentciation: scram-sha-256";
static const char __pyx_k_expected_0_1_or_2_elements_in_ra[] = "expected 0, 1 or 2 elements in range (got {})";
static const char __pyx_k_inconsistent_sub_array_dimension[] = "inconsistent sub-array dimensions at position {}";
static const char __pyx_k_input_of_anonymous_composite_typ[] = "input of anonymous composite types is not supported";
static const char __pyx_k_invalid_format_argument_expected[] = "invalid `format` argument, expected {}, got {!r}";
static const char __pyx_k_invalid_input_for_query_argument[] = "invalid input for query argument ${n}: {v} ({msg})";
static const char __pyx_k_invalid_timeout_value_expected_n[] = "invalid timeout value: expected non-negative float (got {!r})";
static const char __pyx_k_list_tuple_or_Range_object_expec[] = "list, tuple or Range object expected (got type {})";
static const char __pyx_k_missing_after_array_dimensions_2[] = "missing '=' after array dimensions";
static const char __pyx_k_missing_codec_information_for_OI[] = "missing codec information for OID {}";
static const char __pyx_k_no_binary_format_encoder_for_typ[] = "no binary format encoder for type {} (OID {})";
static const char __pyx_k_no_codec_for_composite_attribute[] = "no codec for composite attribute type ";
static const char __pyx_k_no_decoder_for_composite_type_el[] = "no decoder for composite type element in position {} of type OID {}";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_number_of_array_dimensions_excee[] = "number of array dimensions ({}) exceed the maximum expected ({})";
static const char __pyx_k_reader_is_not_an_asynchronous_it[] = "reader is not an asynchronous iterable";
static const char __pyx_k_specified_array_dimensions_do_no[] = "specified array dimensions do not match array content";
static const char __pyx_k_the_number_of_columns_in_the_res[] = "the number of columns in the result row ({}) is different from what was described ({})";
static const char __pyx_k_the_number_of_query_arguments_ca[] = "the number of query arguments cannot exceed 32767";
static const char __pyx_k_too_many_elements_in_array_value[] = "too many elements in array value";
static const char __pyx_k_too_many_elements_in_composite_t[] = "too many elements in composite type record";
static const char __pyx_k_type_record_missing_base_type_fo[] = "type record missing base type for domain ";
static const char __pyx_k_unexpected_array_dimensions_valu[] = "unexpected array dimensions value: {}";
static const char __pyx_k_unexpected_character_r_at_positi[] = "unexpected character {!r} at position {}";
static const char __pyx_k_unexpected_data_type_of_composit[] = "unexpected data type of composite type attribute {}: {!r}, expected {!r}";
static const char __pyx_k_unexpected_trailing_bytes_in_buf[] = "unexpected trailing {} bytes in buffer";
static const char __pyx_k_unknown_error_in_protocol_implem[] = "unknown error in protocol implementation";
static const char __pyx_k_unsupported_authentication_metho[] = "unsupported authentication method requested by the server: {!r}";
static const char __pyx_k_waiter_is_not_done_while_handlin[] = "waiter is not done while handling critical protocol error";
static const char __pyx_k_you_need_values_from_server_to_g[] = "you need values from server to generate a client proof";
static const char __pyx_k_cannot_decode_type_text_encoding_2[] = "cannot decode type \"{}\".\"{}\": text encoding of composite types is not supported";
static const char __pyx_k_cannot_perform_operation_another_2[] = "cannot perform operation: another operation is in progress";
static const char __pyx_k_type_record_missing_base_type_fo_2[] = "type record missing base type for range ";
static const char __pyx_k_unsupported_authentication_metho_2[] = "unsupported authentication method requested by the server: {}";
static PyObject *__pyx_n_s_AF_UNIX;
static PyObject *__pyx_n_u_AF_UNIX;
static PyObject *__pyx_n_s_ARRAY_TYPES;
static PyObject *__pyx_n_s_AUTHENTICATION_METHODS;
static PyObject *__pyx_n_s_AUTH_METHOD_NAME;
static PyObject *__pyx_n_s_AssertionError;
static PyObject *__pyx_n_s_AsyncIterable;
static PyObject *__pyx_n_s_Attribute;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BUILTIN_TYPE_NAME_MAP;
static PyObject *__pyx_n_s_BUILTIN_TYPE_OID_MAP;
static PyObject *__pyx_n_s_BaseProtocol;
static PyObject *__pyx_n_s_BaseProtocol__wait_for_cancellat;
static PyObject *__pyx_n_s_BaseProtocol_bind;
static PyObject *__pyx_n_s_BaseProtocol_bind_execute;
static PyObject *__pyx_n_s_BaseProtocol_bind_execute_many;
static PyObject *__pyx_n_s_BaseProtocol_close;
static PyObject *__pyx_n_s_BaseProtocol_close_statement;
static PyObject *__pyx_n_s_BaseProtocol_copy_in;
static PyObject *__pyx_n_s_BaseProtocol_copy_out;
static PyObject *__pyx_n_s_BaseProtocol_execute;
static PyObject *__pyx_n_s_BaseProtocol_prepare;
static PyObject *__pyx_n_s_BaseProtocol_query;
static PyObject *__pyx_n_s_BufferError;
static PyObject *__pyx_n_s_CancelledError;
static PyObject *__pyx_kp_u_Check_the_query_against_the_pass;
static PyObject *__pyx_kp_b_Client_Key;
static PyObject *__pyx_n_s_Codec;
static PyObject *__pyx_kp_u_Codec_oid_elem_oid_core;
static PyObject *__pyx_n_s_ConnectionDoesNotExistError;
static PyObject *__pyx_n_s_ConnectionResetError;
static PyObject *__pyx_n_s_ConnectionSettings;
static PyObject *__pyx_kp_u_ConnectionSettings_r;
static PyObject *__pyx_kp_u_Consider_declaring_an_explicit_c;
static PyObject *__pyx_n_s_CoreProtocol;
static PyObject *__pyx_n_s_DEFAULT_CLIENT_NONCE_BYTES;
static PyObject *__pyx_n_s_DIGEST;
static PyObject *__pyx_n_s_DataCodecConfig;
static PyObject *__pyx_n_s_DataError;
static PyObject *__pyx_n_s_Event;
static PyObject *__pyx_n_s_Future;
static PyObject *__pyx_n_s_IPPROTO_TCP;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x3a;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x73;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xfb;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_s_InterfaceError;
static PyObject *__pyx_n_s_InternalClientError;
static PyObject *__pyx_n_s_Iterable;
static PyObject *__pyx_n_s_IterableABC;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_Mapping;
static PyObject *__pyx_n_s_MappingABC;
static PyObject *__pyx_n_u_NA;
static PyObject *__pyx_n_u_NFKC;
static PyObject *__pyx_n_s_NO_TIMEOUT;
static PyObject *__pyx_n_b_NULL;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_u_Note_that_parameters_are_suppor;
static PyObject *__pyx_kp_u_OID;
static PyObject *__pyx_kp_u_OID_value_too_large_r;
static PyObject *__pyx_n_s_OrderedDict;
static PyObject *__pyx_n_s_OutdatedSchemaCacheError;
static PyObject *__pyx_n_s_OverflowError;
static PyObject *__pyx_kp_b_PGCOPY;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_u_PostgreSQL_does_not_implement_an;
static PyObject *__pyx_n_s_PostgresError;
static PyObject *__pyx_n_s_PreparedStatementState;
static PyObject *__pyx_n_s_Protocol;
static PyObject *__pyx_n_s_ProtocolError;
static PyObject *__pyx_n_s_REQUIREMENTS_CLIENT_FINAL_MESSAG;
static PyObject *__pyx_n_s_REQUIREMENTS_CLIENT_PROOF;
static PyObject *__pyx_n_u_ROLLBACK;
static PyObject *__pyx_n_s_Range;
static PyObject *__pyx_n_s_Record;
static PyObject *__pyx_n_s_SASLPREP_PROHIBITED;
static PyObject *__pyx_n_s_SCRAMAuthentication;
static PyObject *__pyx_n_s_SCRAMAuthentication__bytes_xor_l;
static PyObject *__pyx_n_s_SCRAMAuthentication__normalize_p;
static PyObject *__pyx_kp_b_SCRAM_SHA_256;
static PyObject *__pyx_kp_b_Server_Key;
static PyObject *__pyx_n_s_Sized;
static PyObject *__pyx_n_s_SizedABC;
static PyObject *__pyx_n_s_StopAsyncIteration;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_TCP_NODELAY;
static PyObject *__pyx_n_s_TimeoutError;
static PyObject *__pyx_n_u_TimeoutError;
static PyObject *__pyx_n_s_Timer;
static PyObject *__pyx_n_s_Timer___enter;
static PyObject *__pyx_n_s_Timer___exit;
static PyObject *__pyx_n_s_Timer___init;
static PyObject *__pyx_n_s_Timer_get_remaining_budget;
static PyObject *__pyx_n_s_Timer_has_budget_greater_than;
static PyObject *__pyx_kp_u_TimoutError_was_not_raised;
static PyObject *__pyx_n_s_Type;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UnicodeEncodeError;
static PyObject *__pyx_n_s_UnsupportedClientFeatureError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_u__12;
static PyObject *__pyx_kp_b__19;
static PyObject *__pyx_n_u__2;
static PyObject *__pyx_kp_b__26;
static PyObject *__pyx_kp_b__34;
static PyObject *__pyx_kp_b__35;
static PyObject *__pyx_kp_u__36;
static PyObject *__pyx_kp_b__37;
static PyObject *__pyx_kp_u__37;
static PyObject *__pyx_kp_u__40;
static PyObject *__pyx_kp_u__41;
static PyObject *__pyx_kp_u__42;
static PyObject *__pyx_kp_u__43;
static PyObject *__pyx_kp_u__45;
static PyObject *__pyx_kp_u__9;
static PyObject *__pyx_kp_u_a_sized_iterable_container_expec;
static PyObject *__pyx_n_s_abc;
static PyObject *__pyx_n_u_abc;
static PyObject *__pyx_n_s_abort;
static PyObject *__pyx_n_u_abstime;
static PyObject *__pyx_n_u_aclitem;
static PyObject *__pyx_n_s_add_done_callback;
static PyObject *__pyx_n_s_add_python_codec;
static PyObject *__pyx_n_s_add_types;
static PyObject *__pyx_n_s_addr;
static PyObject *__pyx_n_s_aiter;
static PyObject *__pyx_n_s_alias_to;
static PyObject *__pyx_kp_u_already_connected;
static PyObject *__pyx_n_u_alt;
static PyObject *__pyx_n_s_amount;
static PyObject *__pyx_n_s_anext;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_u_any;
static PyObject *__pyx_n_u_anyarray;
static PyObject *__pyx_n_u_anycompatible;
static PyObject *__pyx_n_u_anycompatiblearray;
static PyObject *__pyx_n_u_anycompatiblenonarray;
static PyObject *__pyx_n_u_anycompatiblerange;
static PyObject *__pyx_n_u_anyelement;
static PyObject *__pyx_n_u_anyenum;
static PyObject *__pyx_n_u_anynonarray;
static PyObject *__pyx_n_u_anyrange;
static PyObject *__pyx_n_s_apg_exc;
static PyObject *__pyx_n_s_apg_exc_base;
static PyObject *__pyx_n_s_apg_types;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_u_array;
static PyObject *__pyx_kp_u_array_length_overflow;
static PyObject *__pyx_n_u_ascii;
static PyObject *__pyx_n_s_asyncio;
static PyObject *__pyx_n_s_asyncio_coroutines;
static PyObject *__pyx_n_s_asyncio_tasks;
static PyObject *__pyx_n_s_asyncpg;
static PyObject *__pyx_kp_u_asyncpg_Protocol_has_no_referenc;
static PyObject *__pyx_n_s_asyncpg_exceptions;
static PyObject *__pyx_n_s_asyncpg_protocol_protocol;
static PyObject *__pyx_kp_s_asyncpg_protocol_protocol_pyx;
static PyObject *__pyx_n_u_attrnames;
static PyObject *__pyx_n_u_attrtypoids;
static PyObject *__pyx_n_s_auth_msg;
static PyObject *__pyx_n_s_authentication_method;
static PyObject *__pyx_n_s_await;
static PyObject *__pyx_n_s_b64decode;
static PyObject *__pyx_n_s_b64encode;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_base64;
static PyObject *__pyx_n_u_basetype;
static PyObject *__pyx_n_u_basetype_name;
static PyObject *__pyx_n_u_big;
static PyObject *__pyx_n_u_bigint;
static PyObject *__pyx_n_u_binary;
static PyObject *__pyx_n_s_bind;
static PyObject *__pyx_n_s_bind_execute;
static PyObject *__pyx_n_s_bind_execute_many;
static PyObject *__pyx_n_s_bind_execute_many_locals_genexpr;
static PyObject *__pyx_n_u_bit;
static PyObject *__pyx_kp_u_bit_varying;
static PyObject *__pyx_n_u_bool;
static PyObject *__pyx_n_u_box;
static PyObject *__pyx_n_u_bpchar;
static PyObject *__pyx_n_s_budget;
static PyObject *__pyx_n_s_budget_2;
static PyObject *__pyx_n_s_builtins;
static PyObject *__pyx_n_u_bytea;
static PyObject *__pyx_n_s_byteorder;
static PyObject *__pyx_n_b_c;
static PyObject *__pyx_kp_b_c_2;
static PyObject *__pyx_kp_b_c_3;
static PyObject *__pyx_n_s_cache_key;
static PyObject *__pyx_n_s_call_exception_handler;
static PyObject *__pyx_n_s_call_later;
static PyObject *__pyx_n_s_cancel;
static PyObject *__pyx_n_s_cancel_current_command;
static PyObject *__pyx_n_s_cancelled;
static PyObject *__pyx_kp_u_cannot_alias;
static PyObject *__pyx_kp_u_cannot_close_prepared_statement;
static PyObject *__pyx_kp_u_cannot_decode_type_text_encoding;
static PyObject *__pyx_kp_u_cannot_decode_type_text_encoding_2;
static PyObject *__pyx_kp_u_cannot_perform_operation_another;
static PyObject *__pyx_kp_u_cannot_perform_operation_another_2;
static PyObject *__pyx_kp_u_cannot_perform_operation_connect;
static PyObject *__pyx_kp_u_cannot_process_message;
static PyObject *__pyx_kp_u_cannot_register_core_codec_for_O;
static PyObject *__pyx_kp_u_cannot_switch_to_idle_state_prot;
static PyObject *__pyx_kp_u_cannot_switch_to_state_another_o;
static PyObject *__pyx_kp_u_cannot_switch_to_state_protocol;
static PyObject *__pyx_n_s_cause;
static PyObject *__pyx_n_u_char;
static PyObject *__pyx_n_u_character;
static PyObject *__pyx_kp_u_character_varying;
static PyObject *__pyx_n_s_chr;
static PyObject *__pyx_n_u_cid;
static PyObject *__pyx_n_u_cidr;
static PyObject *__pyx_n_u_circle;
static PyObject *__pyx_n_s_cleanup;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_clear_type_cache;
static PyObject *__pyx_n_u_client_channel_binding;
static PyObject *__pyx_n_b_client_encoding;
static PyObject *__pyx_n_u_client_encoding;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_close_statement;
static PyObject *__pyx_kp_u_codec_for;
static PyObject *__pyx_n_s_codecs;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_collections_abc;
static PyObject *__pyx_n_s_command_timeout;
static PyObject *__pyx_n_s_compat;
static PyObject *__pyx_n_u_composite;
static PyObject *__pyx_n_s_con_params;
static PyObject *__pyx_n_s_config;
static PyObject *__pyx_n_s_conn_key;
static PyObject *__pyx_n_s_connected_fut;
static PyObject *__pyx_kp_u_connection_was_closed_in_the_mid;
static PyObject *__pyx_n_s_copy_in;
static PyObject *__pyx_n_s_copy_in_locals_lambda;
static PyObject *__pyx_n_s_copy_out;
static PyObject *__pyx_n_s_copy_out_locals_lambda;
static PyObject *__pyx_n_s_copy_stmt;
static PyObject *__pyx_kp_u_could_not_get_iterations;
static PyObject *__pyx_kp_u_could_not_get_nonce;
static PyObject *__pyx_kp_u_could_not_get_salt;
static PyObject *__pyx_kp_u_could_not_get_server_signature;
static PyObject *__pyx_kp_u_could_not_verify_server_signatur;
static PyObject *__pyx_n_u_cp1250;
static PyObject *__pyx_n_u_cp1251;
static PyObject *__pyx_n_u_cp1252;
static PyObject *__pyx_n_u_cp1253;
static PyObject *__pyx_n_u_cp1254;
static PyObject *__pyx_n_u_cp1255;
static PyObject *__pyx_n_u_cp1256;
static PyObject *__pyx_n_u_cp1257;
static PyObject *__pyx_n_u_cp1258;
static PyObject *__pyx_n_u_cp1521;
static PyObject *__pyx_n_u_cp866;
static PyObject *__pyx_n_u_cp874;
static PyObject *__pyx_n_u_cp932;
static PyObject *__pyx_n_u_cp936;
static PyObject *__pyx_n_u_cp949;
static PyObject *__pyx_n_u_cp950;
static PyObject *__pyx_n_s_create_future;
static PyObject *__pyx_n_s_create_future_fallback;
static PyObject *__pyx_n_s_create_record;
static PyObject *__pyx_n_u_cstring;
static PyObject *__pyx_n_b_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_type;
static PyObject *__pyx_n_s_database;
static PyObject *__pyx_n_u_database;
static PyObject *__pyx_n_u_date;
static PyObject *__pyx_n_u_decimal;
static PyObject *__pyx_n_s_declare_fallback_codec;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_kp_u_decode_row_statement_is_None;
static PyObject *__pyx_n_s_decoder;
static PyObject *__pyx_n_s_desc;
static PyObject *__pyx_n_s_detail;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_digest;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_done;
static PyObject *__pyx_kp_u_double_precision;
static PyObject *__pyx_n_b_e;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_elem;
static PyObject *__pyx_n_u_elemdelim;
static PyObject *__pyx_n_s_elems;
static PyObject *__pyx_n_u_elemtype;
static PyObject *__pyx_n_u_elemtype_name;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encoder;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_et;
static PyObject *__pyx_n_u_euc_cn;
static PyObject *__pyx_n_u_euc_jis_2004;
static PyObject *__pyx_n_u_euc_jp;
static PyObject *__pyx_n_u_euc_kr;
static PyObject *__pyx_n_u_euccn;
static PyObject *__pyx_n_u_eucjp;
static PyObject *__pyx_n_u_euckr;
static PyObject *__pyx_n_u_event_trigger;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_n_s_exceptions;
static PyObject *__pyx_n_s_execute;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_kp_u_expected_0_1_or_2_elements_in_ra;
static PyObject *__pyx_n_s_family;
static PyObject *__pyx_n_u_fdw_handler;
static PyObject *__pyx_n_u_float4;
static PyObject *__pyx_n_u_float8;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_generate_token_bytes;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_data_codec;
static PyObject *__pyx_n_s_get_extra_info;
static PyObject *__pyx_n_s_get_remaining_budget;
static PyObject *__pyx_n_s_get_timeout;
static PyObject *__pyx_n_s_getattribute;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_kp_u_got_result_for_unknown_protocol;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_u_gtsvector;
static PyObject *__pyx_n_s_has_budget_greater_than;
static PyObject *__pyx_n_s_hashlib;
static PyObject *__pyx_n_s_hashlib_md5;
static PyObject *__pyx_n_s_hexdigest;
static PyObject *__pyx_n_s_hint;
static PyObject *__pyx_n_s_hmac;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_kp_b_i_d;
static PyObject *__pyx_n_s_ignore_custom_codec;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_in_table_a1;
static PyObject *__pyx_n_s_in_table_b1;
static PyObject *__pyx_n_s_in_table_c12;
static PyObject *__pyx_n_s_in_table_c21_c22;
static PyObject *__pyx_n_s_in_table_c3;
static PyObject *__pyx_n_s_in_table_c4;
static PyObject *__pyx_n_s_in_table_c5;
static PyObject *__pyx_n_s_in_table_c6;
static PyObject *__pyx_n_s_in_table_c7;
static PyObject *__pyx_n_s_in_table_c8;
static PyObject *__pyx_n_s_in_table_c9;
static PyObject *__pyx_n_s_in_table_d1;
static PyObject *__pyx_n_s_in_table_d2;
static PyObject *__pyx_kp_u_inconsistent_sub_array_dimension;
static PyObject *__pyx_n_u_index_am_handler;
static PyObject *__pyx_n_u_inet;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_kp_u_input_of_anonymous_composite_typ;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_n_u_int;
static PyObject *__pyx_n_u_int2;
static PyObject *__pyx_n_u_int4;
static PyObject *__pyx_n_u_int8;
static PyObject *__pyx_n_u_integer;
static PyObject *__pyx_n_u_internal;
static PyObject *__pyx_n_u_interval;
static PyObject *__pyx_kp_u_invalid_array_element;
static PyObject *__pyx_kp_u_invalid_array_element_at_index;
static PyObject *__pyx_kp_u_invalid_data_format;
static PyObject *__pyx_kp_u_invalid_format_argument_expected;
static PyObject *__pyx_kp_u_invalid_input_for_query_argument;
static PyObject *__pyx_kp_u_invalid_nonce;
static PyObject *__pyx_kp_u_invalid_timeout_value_expected_n;
static PyObject *__pyx_n_s_is_in_transaction;
static PyObject *__pyx_n_s_isempty;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_u_json;
static PyObject *__pyx_n_u_jsonb;
static PyObject *__pyx_n_u_jsonpath;
static PyObject *__pyx_n_u_kind;
static PyObject *__pyx_n_u_koi8_r;
static PyObject *__pyx_n_u_koi8_u;
static PyObject *__pyx_n_u_koi8r;
static PyObject *__pyx_n_u_koi8u;
static PyObject *__pyx_n_u_language_handler;
static PyObject *__pyx_n_s_limit;
static PyObject *__pyx_n_u_line;
static PyObject *__pyx_kp_u_list_tuple_or_Range_object_expec;
static PyObject *__pyx_n_s_lookup;
static PyObject *__pyx_n_s_loop;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_lower_inc;
static PyObject *__pyx_n_u_lseg;
static PyObject *__pyx_n_u_macaddr;
static PyObject *__pyx_n_u_macaddr8;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_kp_u_malformed_array_literal_r;
static PyObject *__pyx_n_s_mapping;
static PyObject *__pyx_n_b_md5;
static PyObject *__pyx_n_s_md5;
static PyObject *__pyx_n_s_memoryview;
static PyObject *__pyx_n_u_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_kp_u_missing_after_array_dimensions;
static PyObject *__pyx_kp_u_missing_after_array_dimensions_2;
static PyObject *__pyx_kp_u_missing_array_dimension_value;
static PyObject *__pyx_kp_u_missing_codec_information_for_OI;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_u_money;
static PyObject *__pyx_n_s_monotonic;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_kp_b_n;
static PyObject *__pyx_kp_b_n_2;
static PyObject *__pyx_n_s_n_3;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_u_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_new_2;
static PyObject *__pyx_kp_u_no_binary_format_encoder_for_typ;
static PyObject *__pyx_kp_u_no_codec_for_composite_attribute;
static PyObject *__pyx_kp_u_no_decoder_for_OID;
static PyObject *__pyx_kp_u_no_decoder_for_composite_type_el;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_kp_u_no_encoder_for_OID;
static PyObject *__pyx_kp_u_non_homogeneous_array;
static PyObject *__pyx_n_s_normalize;
static PyObject *__pyx_kp_u_not_connected;
static PyObject *__pyx_n_u_ns;
static PyObject *__pyx_kp_u_number_of_array_dimensions_excee;
static PyObject *__pyx_n_u_numeric;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_oid;
static PyObject *__pyx_n_u_oid;
static PyObject *__pyx_kp_u_oid_2;
static PyObject *__pyx_n_s_on_error;
static PyObject *__pyx_kp_u_on_result__prepare_statement_is;
static PyObject *__pyx_kp_u_on_result_waiter_is_None;
static PyObject *__pyx_kp_u_on_result_waiter_is_done;
static PyObject *__pyx_n_s_on_timeout;
static PyObject *__pyx_n_s_on_waiter_completed;
static PyObject *__pyx_n_u_opaque;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_kp_b_p;
static PyObject *__pyx_kp_u_parse_data_msgs_first_message_i;
static PyObject *__pyx_kp_u_parse_data_msgs_result_is_not_a;
static PyObject *__pyx_n_s_password;
static PyObject *__pyx_n_u_password_iterations;
static PyObject *__pyx_n_u_password_salt;
static PyObject *__pyx_n_u_path;
static PyObject *__pyx_n_s_pause_reading;
static PyObject *__pyx_n_u_pg_catalog;
static PyObject *__pyx_kp_u_pg_contrib_hstore;
static PyObject *__pyx_n_u_pg_ddl_command;
static PyObject *__pyx_n_u_pg_dependencies;
static PyObject *__pyx_n_u_pg_lsn;
static PyObject *__pyx_n_u_pg_mcv_list;
static PyObject *__pyx_n_u_pg_ndistinct;
static PyObject *__pyx_n_u_pg_node_tree;
static PyObject *__pyx_n_u_pg_snapshot;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_u_point;
static PyObject *__pyx_n_u_polygon;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_portal_name;
static PyObject *__pyx_n_s_position;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prepare_2;
static PyObject *__pyx_n_s_process_log_message;
static PyObject *__pyx_n_s_process_notification;
static PyObject *__pyx_n_s_protocol;
static PyObject *__pyx_kp_u_protocol_is_in_an_unexpected_st;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_capi;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_BaseProtocol;
static PyObject *__pyx_n_s_pyx_unpickle_CoreProtocol;
static PyObject *__pyx_n_s_pyx_unpickle_DataCodecConfig;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_kp_u_query_argument;
static PyObject *__pyx_n_b_r;
static PyObject *__pyx_kp_b_r_2;
static PyObject *__pyx_kp_b_r_3;
static PyObject *__pyx_kp_u_r_is_not_a_valid_element_of_com;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_u_range;
static PyObject *__pyx_n_u_range_subtype;
static PyObject *__pyx_n_u_range_subtype_name;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_reader;
static PyObject *__pyx_kp_u_reader_is_not_an_asynchronous_it;
static PyObject *__pyx_n_u_real;
static PyObject *__pyx_n_s_rec;
static PyObject *__pyx_n_u_record;
static PyObject *__pyx_n_s_record_class;
static PyObject *__pyx_n_s_record_stmt;
static PyObject *__pyx_n_s_records;
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_ref;
static PyObject *__pyx_n_u_refcursor;
static PyObject *__pyx_n_u_regclass;
static PyObject *__pyx_n_u_regcollation;
static PyObject *__pyx_n_u_regconfig;
static PyObject *__pyx_n_u_regdictionary;
static PyObject *__pyx_n_u_regnamespace;
static PyObject *__pyx_n_u_regoper;
static PyObject *__pyx_n_u_regoperator;
static PyObject *__pyx_n_u_regproc;
static PyObject *__pyx_n_u_regprocedure;
static PyObject *__pyx_n_u_regrole;
static PyObject *__pyx_n_u_regtype;
static PyObject *__pyx_n_s_release;
static PyObject *__pyx_n_u_reltime;
static PyObject *__pyx_n_s_remove_python_codec;
static PyObject *__pyx_n_s_request_cancel;
static PyObject *__pyx_n_s_resume_reading;
static PyObject *__pyx_n_s_return_extra;
static PyObject *__pyx_n_s_reversed;
static PyObject *__pyx_kp_b_s;
static PyObject *__pyx_n_s_s_2;
static PyObject *__pyx_n_u_s_2;
static PyObject *__pyx_n_u_scalar;
static PyObject *__pyx_n_s_schema;
static PyObject *__pyx_n_s_search;
static PyObject *__pyx_n_s_secrets;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_u_server_first_message;
static PyObject *__pyx_n_u_server_nonce;
static PyObject *__pyx_n_s_server_settings;
static PyObject *__pyx_n_s_set;
static PyObject *__pyx_n_s_set_builtin_type_codec;
static PyObject *__pyx_n_s_set_builtin_type_codec_2;
static PyObject *__pyx_n_s_set_exception;
static PyObject *__pyx_n_s_set_result;
static PyObject *__pyx_n_s_setsockopt;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_sha256;
static PyObject *__pyx_n_u_shift_jis;
static PyObject *__pyx_n_u_shift_jis_2004;
static PyObject *__pyx_n_s_sink;
static PyObject *__pyx_n_u_sjis;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_u_smallint;
static PyObject *__pyx_n_u_smgr;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_u_socket;
static PyObject *__pyx_kp_u_specified_array_dimensions_do_no;
static PyObject *__pyx_n_u_sql_ascii;
static PyObject *__pyx_n_s_started;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_state;
static PyObject *__pyx_n_s_stmt_name;
static PyObject *__pyx_n_s_stringprep;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_u_table_am_handler;
static PyObject *__pyx_n_s_tb;
static PyObject *__pyx_n_u_tcvn;
static PyObject *__pyx_n_u_tcvn5712;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_u_text;
static PyObject *__pyx_kp_u_text_2;
static PyObject *__pyx_kp_u_text_binary_or_tuple;
static PyObject *__pyx_kp_u_text_or_binary;
static PyObject *__pyx_kp_u_text_or_binary_2;
static PyObject *__pyx_kp_u_the_number_of_columns_in_the_res;
static PyObject *__pyx_kp_u_the_number_of_query_arguments_ca;
static PyObject *__pyx_kp_u_the_server_expects_x_argument_s;
static PyObject *__pyx_kp_u_there_is_no;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_u_tid;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_u_time;
static PyObject *__pyx_kp_u_time_with_timezone;
static PyObject *__pyx_kp_u_time_without_timezone;
static PyObject *__pyx_n_s_timeout;
static PyObject *__pyx_n_u_timestamp;
static PyObject *__pyx_kp_u_timestamp_with_timezone;
static PyObject *__pyx_kp_u_timestamp_without_timezone;
static PyObject *__pyx_n_u_timestamptz;
static PyObject *__pyx_n_u_timetz;
static PyObject *__pyx_n_u_tinterval;
static PyObject *__pyx_kp_u_to;
static PyObject *__pyx_n_s_to_bytes;
static PyObject *__pyx_n_s_token_bytes;
static PyObject *__pyx_kp_u_too_many_elements_in_array_value;
static PyObject *__pyx_kp_u_too_many_elements_in_composite_t;
static PyObject *__pyx_n_u_trigger;
static PyObject *__pyx_n_u_tsm_handler;
static PyObject *__pyx_n_u_tsquery;
static PyObject *__pyx_n_u_tsvector;
static PyObject *__pyx_n_u_tuple;
static PyObject *__pyx_n_u_txid_snapshot;
static PyObject *__pyx_kp_u_type_does_not_support_the_tuple;
static PyObject *__pyx_kp_u_type_record_missing_base_type_fo;
static PyObject *__pyx_kp_u_type_record_missing_base_type_fo_2;
static PyObject *__pyx_kp_u_type_record_missing_field_types;
static PyObject *__pyx_n_s_typekind;
static PyObject *__pyx_n_s_typename;
static PyObject *__pyx_n_s_typeoid;
static PyObject *__pyx_n_s_types;
static PyObject *__pyx_n_s_typeschema;
static PyObject *__pyx_kp_u_unexpected_array_dimension_size;
static PyObject *__pyx_kp_u_unexpected_array_dimensions_valu;
static PyObject *__pyx_kp_u_unexpected_character_r_at_positi;
static PyObject *__pyx_kp_u_unexpected_codec_type;
static PyObject *__pyx_kp_u_unexpected_data_format;
static PyObject *__pyx_kp_u_unexpected_data_type_of_composit;
static PyObject *__pyx_kp_u_unexpected_end_of_string;
static PyObject *__pyx_kp_u_unexpected_exchange_format;
static PyObject *__pyx_kp_u_unexpected_instance_of_anyarray;
static PyObject *__pyx_kp_u_unexpected_number_of_attributes;
static PyObject *__pyx_kp_u_unexpected_trailing_bytes_in_buf;
static PyObject *__pyx_kp_u_unhandled_standard_data_type;
static PyObject *__pyx_n_u_unicode;
static PyObject *__pyx_n_s_unicodedata;
static PyObject *__pyx_n_u_unknown;
static PyObject *__pyx_kp_u_unknown_error_in_protocol_implem;
static PyObject *__pyx_kp_u_unsupported_SASL_Authentication;
static PyObject *__pyx_kp_u_unsupported_authentication_metho;
static PyObject *__pyx_kp_u_unsupported_authentication_metho_2;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_upper_inc;
static PyObject *__pyx_n_s_urandom;
static PyObject *__pyx_n_s_user;
static PyObject *__pyx_n_u_user;
static PyObject *__pyx_kp_u_utf_8;
static PyObject *__pyx_n_u_utf_8_2;
static PyObject *__pyx_n_u_uuid;
static PyObject *__pyx_kp_b_v;
static PyObject *__pyx_n_s_v_2;
static PyObject *__pyx_n_u_varbit;
static PyObject *__pyx_n_u_varchar;
static PyObject *__pyx_n_u_void;
static PyObject *__pyx_n_u_vscii;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_wait;
static PyObject *__pyx_n_s_wait_for;
static PyObject *__pyx_n_s_wait_for_cancellation;
static PyObject *__pyx_kp_u_waiter_is_not_done_while_handlin;
static PyObject *__pyx_n_u_was;
static PyObject *__pyx_n_s_weakref;
static PyObject *__pyx_n_u_were;
static PyObject *__pyx_n_u_win;
static PyObject *__pyx_n_u_win1250;
static PyObject *__pyx_n_u_win1251;
static PyObject *__pyx_n_u_win1252;
static PyObject *__pyx_n_u_win1253;
static PyObject *__pyx_n_u_win1254;
static PyObject *__pyx_n_u_win1255;
static PyObject *__pyx_n_u_win1256;
static PyObject *__pyx_n_u_win1257;
static PyObject *__pyx_n_u_win1258;
static PyObject *__pyx_n_u_win866;
static PyObject *__pyx_n_u_win874;
static PyObject *__pyx_n_u_win932;
static PyObject *__pyx_n_u_win936;
static PyObject *__pyx_n_u_win949;
static PyObject *__pyx_n_u_win950;
static PyObject *__pyx_n_u_windows1250;
static PyObject *__pyx_n_u_windows1251;
static PyObject *__pyx_n_u_windows1252;
static PyObject *__pyx_n_u_windows1253;
static PyObject *__pyx_n_u_windows1254;
static PyObject *__pyx_n_u_windows1255;
static PyObject *__pyx_n_u_windows1256;
static PyObject *__pyx_n_u_windows1257;
static PyObject *__pyx_n_u_windows1258;
static PyObject *__pyx_n_u_windows866;
static PyObject *__pyx_n_u_windows874;
static PyObject *__pyx_n_u_windows932;
static PyObject *__pyx_n_u_windows936;
static PyObject *__pyx_n_u_windows949;
static PyObject *__pyx_n_u_windows950;
static PyObject *__pyx_n_s_with_msg;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_writelines;
static PyObject *__pyx_n_s_writing_allowed;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xformat;
static PyObject *__pyx_n_u_xid;
static PyObject *__pyx_n_u_xid8;
static PyObject *__pyx_n_u_xml;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_kp_u_you_need_values_from_server_to_g;
static PyObject *__pyx_n_s_zip;
static int __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_conn_key); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_2get_text_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_4register_data_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_types); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_6add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_8remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_10clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_12set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_14get_data_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, int __pyx_v_ignore_custom_codec); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_16__getattr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_18__repr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_5Codec___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, uint32_t __pyx_v_oid); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_2__repr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_cache_key); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_2add_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_types); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_4add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format, PyObject *__pyx_v_xformat); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_6remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, CYTHON_UNUSED PyObject *__pyx_v_typename, CYTHON_UNUSED PyObject *__pyx_v_typeschema); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_8_set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_10set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_12clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_14declare_fallback_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_16__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_18__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_authentication_method); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_6genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_9genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_con_params); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_2is_in_transaction(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_4__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_6__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_query, struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_protocol, PyTypeObject *__pyx_v_record_class, int __pyx_v_ignore_custom_codec); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_2_get_parameters(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4_get_attributes(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6_init_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_8_init_codecs(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_10attach(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12detach(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_14mark_closed(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_addr, PyObject *__pyx_v_connected_fut, PyObject *__pyx_v_con_params, PyTypeObject *__pyx_v_record_class, PyObject *__pyx_v_loop); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_2set_connection(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_connection); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_4get_server_pid(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6get_settings(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_8get_record_class(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_10prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_ignore_custom_codec, PyObject *__pyx_v_record_class); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, int __pyx_v_limit, PyObject *__pyx_v_return_extra, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_16bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_19bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_22execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_portal_name, int __pyx_v_limit, PyObject *__pyx_v_return_extra, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_25query(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_28copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt, PyObject *__pyx_v_sink, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_31copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt, PyObject *__pyx_v_reader, PyObject *__pyx_v_data, PyObject *__pyx_v_records, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_record_stmt, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_34close_statement(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_37is_closed(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_39is_connected(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_41abort(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_43close(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_46_request_cancel(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_48_on_timeout(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_50_on_waiter_completed(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_52_create_future_fallback(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_54_get_timeout(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_56_is_cancelling(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_58_wait_for_cancellation(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_61data_received(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_63connection_made(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_65connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_67pause_writing(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_69resume_writing(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static int __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_2__set__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_71__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_73__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_budget); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_et, CYTHON_UNUSED PyObject *__pyx_v_e, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_6get_remaining_budget(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_8has_budget_greater_than(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_amount); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol__create_record(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_elems); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_2__pyx_unpickle_DataCodecConfig(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_4__pyx_unpickle_CoreProtocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_6__pyx_unpickle_BaseProtocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_Codec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_DataCodecConfig(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_ConnectionSettings(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_SCRAMAuthentication(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_CoreProtocol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_PreparedStatementState(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_BaseProtocol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_17;
static PyObject *__pyx_int_18;
static PyObject *__pyx_int_19;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_21;
static PyObject *__pyx_int_23;
static PyObject *__pyx_int_24;
static PyObject *__pyx_int_25;
static PyObject *__pyx_int_26;
static PyObject *__pyx_int_27;
static PyObject *__pyx_int_28;
static PyObject *__pyx_int_29;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_40;
static PyObject *__pyx_int_114;
static PyObject *__pyx_int_142;
static PyObject *__pyx_int_194;
static PyObject *__pyx_int_210;
static PyObject *__pyx_int_269;
static PyObject *__pyx_int_325;
static PyObject *__pyx_int_600;
static PyObject *__pyx_int_601;
static PyObject *__pyx_int_602;
static PyObject *__pyx_int_603;
static PyObject *__pyx_int_604;
static PyObject *__pyx_int_628;
static PyObject *__pyx_int_650;
static PyObject *__pyx_int_700;
static PyObject *__pyx_int_701;
static PyObject *__pyx_int_702;
static PyObject *__pyx_int_703;
static PyObject *__pyx_int_704;
static PyObject *__pyx_int_705;
static PyObject *__pyx_int_718;
static PyObject *__pyx_int_774;
static PyObject *__pyx_int_790;
static PyObject *__pyx_int_829;
static PyObject *__pyx_int_869;
static PyObject *__pyx_int_1009;
static PyObject *__pyx_int_1028;
static PyObject *__pyx_int_1033;
static PyObject *__pyx_int_1042;
static PyObject *__pyx_int_1043;
static PyObject *__pyx_int_1082;
static PyObject *__pyx_int_1083;
static PyObject *__pyx_int_1114;
static PyObject *__pyx_int_1184;
static PyObject *__pyx_int_1186;
static PyObject *__pyx_int_1266;
static PyObject *__pyx_int_1560;
static PyObject *__pyx_int_1562;
static PyObject *__pyx_int_1700;
static PyObject *__pyx_int_1790;
static PyObject *__pyx_int_2202;
static PyObject *__pyx_int_2203;
static PyObject *__pyx_int_2204;
static PyObject *__pyx_int_2205;
static PyObject *__pyx_int_2206;
static PyObject *__pyx_int_2249;
static PyObject *__pyx_int_2275;
static PyObject *__pyx_int_2276;
static PyObject *__pyx_int_2277;
static PyObject *__pyx_int_2278;
static PyObject *__pyx_int_2279;
static PyObject *__pyx_int_2280;
static PyObject *__pyx_int_2281;
static PyObject *__pyx_int_2282;
static PyObject *__pyx_int_2283;
static PyObject *__pyx_int_2776;
static PyObject *__pyx_int_2950;
static PyObject *__pyx_int_2970;
static PyObject *__pyx_int_3115;
static PyObject *__pyx_int_3220;
static PyObject *__pyx_int_3310;
static PyObject *__pyx_int_3361;
static PyObject *__pyx_int_3402;
static PyObject *__pyx_int_3500;
static PyObject *__pyx_int_3614;
static PyObject *__pyx_int_3615;
static PyObject *__pyx_int_3642;
static PyObject *__pyx_int_3734;
static PyObject *__pyx_int_3769;
static PyObject *__pyx_int_3802;
static PyObject *__pyx_int_3831;
static PyObject *__pyx_int_3838;
static PyObject *__pyx_int_4072;
static PyObject *__pyx_int_4089;
static PyObject *__pyx_int_4096;
static PyObject *__pyx_int_4191;
static PyObject *__pyx_int_5017;
static PyObject *__pyx_int_5038;
static PyObject *__pyx_int_5069;
static PyObject *__pyx_int_5077;
static PyObject *__pyx_int_5078;
static PyObject *__pyx_int_5079;
static PyObject *__pyx_int_5080;
static PyObject *__pyx_int_32768;
static PyObject *__pyx_int_524288;
static PyObject *__pyx_int_61349641;
static PyObject *__pyx_int_120810133;
static PyObject *__pyx_int_263996099;
static enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_k_;
static PyObject *__pyx_k__10;
static PyObject *__pyx_k__11;
static enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_k__13;
static enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_k__14;
static enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_k__15;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_slice__44;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
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__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
/* Late includes */

/* "asyncpg/protocol/encodings.pyx":62
 * 
 * 
 * cdef get_python_encoding(pg_encoding):             # <<<<<<<<<<<<<<
 *     return ENCODINGS_MAP.get(pg_encoding.lower(), pg_encoding.lower())
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_get_python_encoding(PyObject *__pyx_v_pg_encoding) {
  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("get_python_encoding", 0);

  /* "asyncpg/protocol/encodings.pyx":63
 * 
 * cdef get_python_encoding(pg_encoding):
 *     return ENCODINGS_MAP.get(pg_encoding.lower(), pg_encoding.lower())             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(8, 63, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pg_encoding, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 63, __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(8, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pg_encoding, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 63, __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(8, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 63, __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_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/encodings.pyx":62
 * 
 * 
 * cdef get_python_encoding(pg_encoding):             # <<<<<<<<<<<<<<
 *     return ENCODINGS_MAP.get(pg_encoding.lower(), pg_encoding.lower())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.get_python_encoding", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":14
 * cdef class ConnectionSettings(pgproto.CodecContext):
 * 
 *     def __cinit__(self, conn_key):             # <<<<<<<<<<<<<<
 *         self._encoding = 'utf-8'
 *         self._is_utf8 = True
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_conn_key = 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_conn_key,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_conn_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 14, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_conn_key = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 14, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings___cinit__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), __pyx_v_conn_key);

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

static int __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_conn_key) {
  int __pyx_r;
  __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("__cinit__", 0);

  /* "asyncpg/protocol/settings.pyx":15
 * 
 *     def __cinit__(self, conn_key):
 *         self._encoding = 'utf-8'             # <<<<<<<<<<<<<<
 *         self._is_utf8 = True
 *         self._settings = {}
 */
  __Pyx_INCREF(__pyx_kp_u_utf_8);
  __Pyx_GIVEREF(__pyx_kp_u_utf_8);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = __pyx_kp_u_utf_8;

  /* "asyncpg/protocol/settings.pyx":16
 *     def __cinit__(self, conn_key):
 *         self._encoding = 'utf-8'
 *         self._is_utf8 = True             # <<<<<<<<<<<<<<
 *         self._settings = {}
 *         self._codec = codecs.lookup('utf-8')
 */
  __pyx_v_self->_is_utf8 = 1;

  /* "asyncpg/protocol/settings.pyx":17
 *         self._encoding = 'utf-8'
 *         self._is_utf8 = True
 *         self._settings = {}             # <<<<<<<<<<<<<<
 *         self._codec = codecs.lookup('utf-8')
 *         self._data_codecs = DataCodecConfig(conn_key)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_settings);
  __Pyx_DECREF(__pyx_v_self->_settings);
  __pyx_v_self->_settings = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/settings.pyx":18
 *         self._is_utf8 = True
 *         self._settings = {}
 *         self._codec = codecs.lookup('utf-8')             # <<<<<<<<<<<<<<
 *         self._data_codecs = DataCodecConfig(conn_key)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_codecs); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lookup); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 18, __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_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_utf_8);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_codec);
  __Pyx_DECREF(__pyx_v_self->_codec);
  __pyx_v_self->_codec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/settings.pyx":19
 *         self._settings = {}
 *         self._codec = codecs.lookup('utf-8')
 *         self._data_codecs = DataCodecConfig(conn_key)             # <<<<<<<<<<<<<<
 * 
 *     cdef add_setting(self, str name, str val):
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_DataCodecConfig), __pyx_v_conn_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_data_codecs);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_data_codecs));
  __pyx_v_self->_data_codecs = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/settings.pyx":14
 * cdef class ConnectionSettings(pgproto.CodecContext):
 * 
 *     def __cinit__(self, conn_key):             # <<<<<<<<<<<<<<
 *         self._encoding = 'utf-8'
 *         self._is_utf8 = True
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":21
 *         self._data_codecs = DataCodecConfig(conn_key)
 * 
 *     cdef add_setting(self, str name, str val):             # <<<<<<<<<<<<<<
 *         self._settings[name] = val
 *         if name == 'client_encoding':
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_setting(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  PyObject *__pyx_v_py_enc = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_setting", 0);

  /* "asyncpg/protocol/settings.pyx":22
 * 
 *     cdef add_setting(self, str name, str val):
 *         self._settings[name] = val             # <<<<<<<<<<<<<<
 *         if name == 'client_encoding':
 *             py_enc = get_python_encoding(val)
 */
  if (unlikely(__pyx_v_self->_settings == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 22, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->_settings, __pyx_v_name, __pyx_v_val) < 0)) __PYX_ERR(2, 22, __pyx_L1_error)

  /* "asyncpg/protocol/settings.pyx":23
 *     cdef add_setting(self, str name, str val):
 *         self._settings[name] = val
 *         if name == 'client_encoding':             # <<<<<<<<<<<<<<
 *             py_enc = get_python_encoding(val)
 *             self._codec = codecs.lookup(py_enc)
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_client_encoding, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 23, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/settings.pyx":24
 *         self._settings[name] = val
 *         if name == 'client_encoding':
 *             py_enc = get_python_encoding(val)             # <<<<<<<<<<<<<<
 *             self._codec = codecs.lookup(py_enc)
 *             self._encoding = self._codec.name
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_get_python_encoding(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 24, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_py_enc = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/settings.pyx":25
 *         if name == 'client_encoding':
 *             py_enc = get_python_encoding(val)
 *             self._codec = codecs.lookup(py_enc)             # <<<<<<<<<<<<<<
 *             self._encoding = self._codec.name
 *             self._is_utf8 = self._encoding == 'utf-8'
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_codecs); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_lookup); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 25, __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 && unlikely(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_v_py_enc) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_py_enc);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_codec);
    __Pyx_DECREF(__pyx_v_self->_codec);
    __pyx_v_self->_codec = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/settings.pyx":26
 *             py_enc = get_python_encoding(val)
 *             self._codec = codecs.lookup(py_enc)
 *             self._encoding = self._codec.name             # <<<<<<<<<<<<<<
 *             self._is_utf8 = self._encoding == 'utf-8'
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_codec, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 26, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_encoding);
    __Pyx_DECREF(__pyx_v_self->_encoding);
    __pyx_v_self->_encoding = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/settings.pyx":27
 *             self._codec = codecs.lookup(py_enc)
 *             self._encoding = self._codec.name
 *             self._is_utf8 = self._encoding == 'utf-8'             # <<<<<<<<<<<<<<
 * 
 *     cdef is_encoding_utf8(self):
 */
    __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->_encoding, __pyx_kp_u_utf_8, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 27, __pyx_L1_error)
    __pyx_v_self->_is_utf8 = __pyx_t_2;

    /* "asyncpg/protocol/settings.pyx":23
 *     cdef add_setting(self, str name, str val):
 *         self._settings[name] = val
 *         if name == 'client_encoding':             # <<<<<<<<<<<<<<
 *             py_enc = get_python_encoding(val)
 *             self._codec = codecs.lookup(py_enc)
 */
  }

  /* "asyncpg/protocol/settings.pyx":21
 *         self._data_codecs = DataCodecConfig(conn_key)
 * 
 *     cdef add_setting(self, str name, str val):             # <<<<<<<<<<<<<<
 *         self._settings[name] = val
 *         if name == 'client_encoding':
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.add_setting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_enc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":29
 *             self._is_utf8 = self._encoding == 'utf-8'
 * 
 *     cdef is_encoding_utf8(self):             # <<<<<<<<<<<<<<
 *         return self._is_utf8
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_is_encoding_utf8(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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("is_encoding_utf8", 0);

  /* "asyncpg/protocol/settings.pyx":30
 * 
 *     cdef is_encoding_utf8(self):
 *         return self._is_utf8             # <<<<<<<<<<<<<<
 * 
 *     cpdef get_text_codec(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_is_utf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/settings.pyx":29
 *             self._is_utf8 = self._encoding == 'utf-8'
 * 
 *     cdef is_encoding_utf8(self):             # <<<<<<<<<<<<<<
 *         return self._is_utf8
 * 
 */

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

/* "asyncpg/protocol/settings.pyx":32
 *         return self._is_utf8
 * 
 *     cpdef get_text_codec(self):             # <<<<<<<<<<<<<<
 *         return self._codec
 * 
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_3get_text_codec(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_text_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_text_codec", 0);

  /* "asyncpg/protocol/settings.pyx":33
 * 
 *     cpdef get_text_codec(self):
 *         return self._codec             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline register_data_types(self, types):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_codec);
  __pyx_r = __pyx_v_self->_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/settings.pyx":32
 *         return self._is_utf8
 * 
 *     cpdef get_text_codec(self):             # <<<<<<<<<<<<<<
 *         return self._codec
 * 
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_3get_text_codec(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_3get_text_codec(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_text_codec (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_2get_text_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_2get_text_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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("get_text_codec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_text_codec(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.get_text_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":35
 *         return self._codec
 * 
 *     cpdef inline register_data_types(self, types):             # <<<<<<<<<<<<<<
 *         self._data_codecs.add_types(types)
 * 
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_5register_data_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_register_data_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_types, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_data_types", 0);

  /* "asyncpg/protocol/settings.pyx":36
 * 
 *     cpdef inline register_data_types(self, types):
 *         self._data_codecs.add_types(types)             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline add_python_codec(self, typeoid, typename, typeschema,
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data_codecs), __pyx_n_s_add_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 36, __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_types) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_types);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 36, __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;

  /* "asyncpg/protocol/settings.pyx":35
 *         return self._codec
 * 
 *     cpdef inline register_data_types(self, types):             # <<<<<<<<<<<<<<
 *         self._data_codecs.add_types(types)
 * 
 */

  /* 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("asyncpg.protocol.protocol.ConnectionSettings.register_data_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_5register_data_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_5register_data_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_data_types (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_4register_data_types(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), ((PyObject *)__pyx_v_types));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_4register_data_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_types) {
  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("register_data_types", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_register_data_types(__pyx_v_self, __pyx_v_types, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.register_data_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":38
 *         self._data_codecs.add_types(types)
 * 
 *     cpdef inline add_python_codec(self, typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                   typekind, encoder, decoder, format):
 *         cdef:
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_7add_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format, CYTHON_UNUSED int __pyx_skip_dispatch) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v__format;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat;
  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;
  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("add_python_codec", 0);

  /* "asyncpg/protocol/settings.pyx":44
 *             ClientExchangeFormat xformat
 * 
 *         if format == 'binary':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_BINARY
 *             xformat = PG_XFORMAT_OBJECT
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_format, __pyx_n_u_binary, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 44, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "asyncpg/protocol/settings.pyx":45
 * 
 *         if format == 'binary':
 *             _format = PG_FORMAT_BINARY             # <<<<<<<<<<<<<<
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'text':
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY;

    /* "asyncpg/protocol/settings.pyx":46
 *         if format == 'binary':
 *             _format = PG_FORMAT_BINARY
 *             xformat = PG_XFORMAT_OBJECT             # <<<<<<<<<<<<<<
 *         elif format == 'text':
 *             _format = PG_FORMAT_TEXT
 */
    __pyx_v_xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT;

    /* "asyncpg/protocol/settings.pyx":44
 *             ClientExchangeFormat xformat
 * 
 *         if format == 'binary':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_BINARY
 *             xformat = PG_XFORMAT_OBJECT
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":47
 *             _format = PG_FORMAT_BINARY
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'text':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_TEXT
 *             xformat = PG_XFORMAT_OBJECT
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_format, __pyx_n_u_text, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 47, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "asyncpg/protocol/settings.pyx":48
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'text':
 *             _format = PG_FORMAT_TEXT             # <<<<<<<<<<<<<<
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'tuple':
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT;

    /* "asyncpg/protocol/settings.pyx":49
 *         elif format == 'text':
 *             _format = PG_FORMAT_TEXT
 *             xformat = PG_XFORMAT_OBJECT             # <<<<<<<<<<<<<<
 *         elif format == 'tuple':
 *             _format = PG_FORMAT_ANY
 */
    __pyx_v_xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT;

    /* "asyncpg/protocol/settings.pyx":47
 *             _format = PG_FORMAT_BINARY
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'text':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_TEXT
 *             xformat = PG_XFORMAT_OBJECT
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":50
 *             _format = PG_FORMAT_TEXT
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'tuple':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_ANY
 *             xformat = PG_XFORMAT_TUPLE
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_format, __pyx_n_u_tuple, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 50, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "asyncpg/protocol/settings.pyx":51
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'tuple':
 *             _format = PG_FORMAT_ANY             # <<<<<<<<<<<<<<
 *             xformat = PG_XFORMAT_TUPLE
 *         else:
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY;

    /* "asyncpg/protocol/settings.pyx":52
 *         elif format == 'tuple':
 *             _format = PG_FORMAT_ANY
 *             xformat = PG_XFORMAT_TUPLE             # <<<<<<<<<<<<<<
 *         else:
 *             raise exceptions.InterfaceError(
 */
    __pyx_v_xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;

    /* "asyncpg/protocol/settings.pyx":50
 *             _format = PG_FORMAT_TEXT
 *             xformat = PG_XFORMAT_OBJECT
 *         elif format == 'tuple':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_ANY
 *             xformat = PG_XFORMAT_TUPLE
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":54
 *             xformat = PG_XFORMAT_TUPLE
 *         else:
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'invalid `format` argument, expected {}, got {!r}'.format(
 *                     "'text', 'binary' or 'tuple'", format
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/settings.pyx":55
 *         else:
 *             raise exceptions.InterfaceError(
 *                 'invalid `format` argument, expected {}, got {!r}'.format(             # <<<<<<<<<<<<<<
 *                     "'text', 'binary' or 'tuple'", format
 *                 ))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_format_argument_expected, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "asyncpg/protocol/settings.pyx":56
 *             raise exceptions.InterfaceError(
 *                 'invalid `format` argument, expected {}, got {!r}'.format(
 *                     "'text', 'binary' or 'tuple'", format             # <<<<<<<<<<<<<<
 *                 ))
 * 
 */
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_text_binary_or_tuple, __pyx_v_format};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 55, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_u_text_binary_or_tuple, __pyx_v_format};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 55, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 55, __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_u_text_binary_or_tuple);
      __Pyx_GIVEREF(__pyx_kp_u_text_binary_or_tuple);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_text_binary_or_tuple);
      __Pyx_INCREF(__pyx_v_format);
      __Pyx_GIVEREF(__pyx_v_format);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_format);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 54, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "asyncpg/protocol/settings.pyx":59
 *                 ))
 * 
 *         self._data_codecs.add_python_codec(typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                            typekind, encoder, decoder,
 *                                            _format, xformat)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data_codecs), __pyx_n_s_add_python_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "asyncpg/protocol/settings.pyx":61
 *         self._data_codecs.add_python_codec(typeoid, typename, typeschema,
 *                                            typekind, encoder, decoder,
 *                                            _format, xformat)             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline remove_python_codec(self, typeoid, typename, typeschema):
 */
  __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v__format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_v_xformat); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  __pyx_t_7 = 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_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_encoder, __pyx_v_decoder, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_encoder, __pyx_v_decoder, __pyx_t_3, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(8+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_typename);
    __Pyx_GIVEREF(__pyx_v_typename);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_typename);
    __Pyx_INCREF(__pyx_v_typeschema);
    __Pyx_GIVEREF(__pyx_v_typeschema);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_typeschema);
    __Pyx_INCREF(__pyx_v_typekind);
    __Pyx_GIVEREF(__pyx_v_typekind);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_typekind);
    __Pyx_INCREF(__pyx_v_encoder);
    __Pyx_GIVEREF(__pyx_v_encoder);
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_encoder);
    __Pyx_INCREF(__pyx_v_decoder);
    __Pyx_GIVEREF(__pyx_v_decoder);
    PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_decoder);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/settings.pyx":38
 *         self._data_codecs.add_types(types)
 * 
 *     cpdef inline add_python_codec(self, typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                   typekind, encoder, decoder, format):
 *         cdef:
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.add_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_7add_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_7add_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  PyObject *__pyx_v_typekind = 0;
  PyObject *__pyx_v_encoder = 0;
  PyObject *__pyx_v_decoder = 0;
  PyObject *__pyx_v_format = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_python_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,&__pyx_n_s_typekind,&__pyx_n_s_encoder,&__pyx_n_s_decoder,&__pyx_n_s_format,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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 1); __PYX_ERR(2, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 2); __PYX_ERR(2, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typekind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 3); __PYX_ERR(2, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 4); __PYX_ERR(2, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_decoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 5); __PYX_ERR(2, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, 6); __PYX_ERR(2, 38, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_python_codec") < 0)) __PYX_ERR(2, 38, __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_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
    __pyx_v_typekind = values[3];
    __pyx_v_encoder = values[4];
    __pyx_v_decoder = values[5];
    __pyx_v_format = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 38, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.add_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_6add_python_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_encoder, __pyx_v_decoder, __pyx_v_format);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_6add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format) {
  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("add_python_codec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_python_codec(__pyx_v_self, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_encoder, __pyx_v_decoder, __pyx_v_format, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.add_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":63
 *                                            _format, xformat)
 * 
 *     cpdef inline remove_python_codec(self, typeoid, typename, typeschema):             # <<<<<<<<<<<<<<
 *         self._data_codecs.remove_python_codec(typeoid, typename, typeschema)
 * 
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_9remove_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_python_codec", 0);

  /* "asyncpg/protocol/settings.pyx":64
 * 
 *     cpdef inline remove_python_codec(self, typeoid, typename, typeschema):
 *         self._data_codecs.remove_python_codec(typeoid, typename, typeschema)             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline clear_type_cache(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data_codecs), __pyx_n_s_remove_python_codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 64, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 64, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_typename);
    __Pyx_GIVEREF(__pyx_v_typename);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_typename);
    __Pyx_INCREF(__pyx_v_typeschema);
    __Pyx_GIVEREF(__pyx_v_typeschema);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_typeschema);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/settings.pyx":63
 *                                            _format, xformat)
 * 
 *     cpdef inline remove_python_codec(self, typeoid, typename, typeschema):             # <<<<<<<<<<<<<<
 *         self._data_codecs.remove_python_codec(typeoid, typename, typeschema)
 * 
 */

  /* 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("asyncpg.protocol.protocol.ConnectionSettings.remove_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_9remove_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_9remove_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_python_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, 1); __PYX_ERR(2, 63, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, 2); __PYX_ERR(2, 63, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_python_codec") < 0)) __PYX_ERR(2, 63, __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_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 63, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.remove_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_8remove_python_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_8remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema) {
  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("remove_python_codec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_remove_python_codec(__pyx_v_self, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.remove_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":66
 *         self._data_codecs.remove_python_codec(typeoid, typename, typeschema)
 * 
 *     cpdef inline clear_type_cache(self):             # <<<<<<<<<<<<<<
 *         self._data_codecs.clear_type_cache()
 * 
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_11clear_type_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_type_cache", 0);

  /* "asyncpg/protocol/settings.pyx":67
 * 
 *     cpdef inline clear_type_cache(self):
 *         self._data_codecs.clear_type_cache()             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline set_builtin_type_codec(self, typeoid, typename, typeschema,
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data_codecs), __pyx_n_s_clear_type_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 67, __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(2, 67, __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;

  /* "asyncpg/protocol/settings.pyx":66
 *         self._data_codecs.remove_python_codec(typeoid, typename, typeschema)
 * 
 *     cpdef inline clear_type_cache(self):             # <<<<<<<<<<<<<<
 *         self._data_codecs.clear_type_cache()
 * 
 */

  /* 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("asyncpg.protocol.protocol.ConnectionSettings.clear_type_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_11clear_type_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_11clear_type_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_type_cache (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_10clear_type_cache(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_10clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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("clear_type_cache", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_clear_type_cache(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.clear_type_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":69
 *         self._data_codecs.clear_type_cache()
 * 
 *     cpdef inline set_builtin_type_codec(self, typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                         typekind, alias_to, format):
 *         cdef:
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_13set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format, CYTHON_UNUSED int __pyx_skip_dispatch) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v__format;
  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_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_builtin_type_codec", 0);

  /* "asyncpg/protocol/settings.pyx":74
 *             ServerDataFormat _format
 * 
 *         if format is None:             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_ANY
 *         elif format == 'binary':
 */
  __pyx_t_1 = (__pyx_v_format == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/settings.pyx":75
 * 
 *         if format is None:
 *             _format = PG_FORMAT_ANY             # <<<<<<<<<<<<<<
 *         elif format == 'binary':
 *             _format = PG_FORMAT_BINARY
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY;

    /* "asyncpg/protocol/settings.pyx":74
 *             ServerDataFormat _format
 * 
 *         if format is None:             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_ANY
 *         elif format == 'binary':
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":76
 *         if format is None:
 *             _format = PG_FORMAT_ANY
 *         elif format == 'binary':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_BINARY
 *         elif format == 'text':
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_format, __pyx_n_u_binary, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 76, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "asyncpg/protocol/settings.pyx":77
 *             _format = PG_FORMAT_ANY
 *         elif format == 'binary':
 *             _format = PG_FORMAT_BINARY             # <<<<<<<<<<<<<<
 *         elif format == 'text':
 *             _format = PG_FORMAT_TEXT
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY;

    /* "asyncpg/protocol/settings.pyx":76
 *         if format is None:
 *             _format = PG_FORMAT_ANY
 *         elif format == 'binary':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_BINARY
 *         elif format == 'text':
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":78
 *         elif format == 'binary':
 *             _format = PG_FORMAT_BINARY
 *         elif format == 'text':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_TEXT
 *         else:
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_format, __pyx_n_u_text, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 78, __pyx_L1_error)
  if (likely(__pyx_t_2)) {

    /* "asyncpg/protocol/settings.pyx":79
 *             _format = PG_FORMAT_BINARY
 *         elif format == 'text':
 *             _format = PG_FORMAT_TEXT             # <<<<<<<<<<<<<<
 *         else:
 *             raise exceptions.InterfaceError(
 */
    __pyx_v__format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT;

    /* "asyncpg/protocol/settings.pyx":78
 *         elif format == 'binary':
 *             _format = PG_FORMAT_BINARY
 *         elif format == 'text':             # <<<<<<<<<<<<<<
 *             _format = PG_FORMAT_TEXT
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/settings.pyx":81
 *             _format = PG_FORMAT_TEXT
 *         else:
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'invalid `format` argument, expected {}, got {!r}'.format(
 *                     "'text' or 'binary'", format
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/settings.pyx":82
 *         else:
 *             raise exceptions.InterfaceError(
 *                 'invalid `format` argument, expected {}, got {!r}'.format(             # <<<<<<<<<<<<<<
 *                     "'text' or 'binary'", format
 *                 ))
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_format_argument_expected, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/settings.pyx":83
 *             raise exceptions.InterfaceError(
 *                 'invalid `format` argument, expected {}, got {!r}'.format(
 *                     "'text' or 'binary'", format             # <<<<<<<<<<<<<<
 *                 ))
 * 
 */
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_text_or_binary, __pyx_v_format};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 82, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_u_text_or_binary, __pyx_v_format};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 82, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_u_text_or_binary);
      __Pyx_GIVEREF(__pyx_kp_u_text_or_binary);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_text_or_binary);
      __Pyx_INCREF(__pyx_v_format);
      __Pyx_GIVEREF(__pyx_v_format);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_format);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 81, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "asyncpg/protocol/settings.pyx":86
 *                 ))
 * 
 *         self._data_codecs.set_builtin_type_codec(typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                                  typekind, alias_to, _format)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_data_codecs), __pyx_n_s_set_builtin_type_codec); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "asyncpg/protocol/settings.pyx":87
 * 
 *         self._data_codecs.set_builtin_type_codec(typeoid, typename, typeschema,
 *                                                  typekind, alias_to, _format)             # <<<<<<<<<<<<<<
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,
 */
  __pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v__format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  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_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_t_4};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 86, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_t_4};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 86, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_typename);
    __Pyx_GIVEREF(__pyx_v_typename);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_typename);
    __Pyx_INCREF(__pyx_v_typeschema);
    __Pyx_GIVEREF(__pyx_v_typeschema);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_typeschema);
    __Pyx_INCREF(__pyx_v_typekind);
    __Pyx_GIVEREF(__pyx_v_typekind);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_v_typekind);
    __Pyx_INCREF(__pyx_v_alias_to);
    __Pyx_GIVEREF(__pyx_v_alias_to);
    PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_alias_to);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 5+__pyx_t_8, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/settings.pyx":69
 *         self._data_codecs.clear_type_cache()
 * 
 *     cpdef inline set_builtin_type_codec(self, typeoid, typename, typeschema,             # <<<<<<<<<<<<<<
 *                                         typekind, alias_to, format):
 *         cdef:
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_13set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_13set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  PyObject *__pyx_v_typekind = 0;
  PyObject *__pyx_v_alias_to = 0;
  PyObject *__pyx_v_format = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_builtin_type_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,&__pyx_n_s_typekind,&__pyx_n_s_alias_to,&__pyx_n_s_format,0};
    PyObject* values[6] = {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  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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, 1); __PYX_ERR(2, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, 2); __PYX_ERR(2, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typekind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, 3); __PYX_ERR(2, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alias_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, 4); __PYX_ERR(2, 69, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, 5); __PYX_ERR(2, 69, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_builtin_type_codec") < 0)) __PYX_ERR(2, 69, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      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);
    }
    __pyx_v_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
    __pyx_v_typekind = values[3];
    __pyx_v_alias_to = values[4];
    __pyx_v_format = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 69, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_12set_builtin_type_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_12set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format) {
  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("set_builtin_type_codec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_set_builtin_type_codec(__pyx_v_self, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":89
 *                                                  typekind, alias_to, _format)
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,             # <<<<<<<<<<<<<<
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_15get_data_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, uint32_t __pyx_v_oid, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec *__pyx_optional_args) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format = __pyx_k_;

  /* "asyncpg/protocol/settings.pyx":91
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):             # <<<<<<<<<<<<<<
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)
 * 
 */
  int __pyx_v_ignore_custom_codec = ((int)0);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_data_codec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_format = __pyx_optional_args->format;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_ignore_custom_codec = __pyx_optional_args->ignore_custom_codec;
      }
    }
  }

  /* "asyncpg/protocol/settings.pyx":92
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, name):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.ignore_custom_codec = __pyx_v_ignore_custom_codec;
  __pyx_t_1 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self->_data_codecs, __pyx_v_oid, __pyx_v_format, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/settings.pyx":89
 *                                                  typekind, alias_to, _format)
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,             # <<<<<<<<<<<<<<
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.get_data_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_15get_data_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_15get_data_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint32_t __pyx_v_oid;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format;
  int __pyx_v_ignore_custom_codec;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_oid,&__pyx_n_s_format,&__pyx_n_s_ignore_custom_codec,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_oid)) != 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_format);
          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_ignore_custom_codec);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_data_codec") < 0)) __PYX_ERR(2, 89, __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_oid = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_oid == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(2, 89, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_format = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(values[1])); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 90, __pyx_L3_error)
    } else {
      __pyx_v_format = __pyx_k_;
    }
    if (values[2]) {
      __pyx_v_ignore_custom_codec = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_ignore_custom_codec == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 91, __pyx_L3_error)
    } else {

      /* "asyncpg/protocol/settings.pyx":91
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):             # <<<<<<<<<<<<<<
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)
 * 
 */
      __pyx_v_ignore_custom_codec = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_data_codec", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 89, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.get_data_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_14get_data_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), __pyx_v_oid, __pyx_v_format, __pyx_v_ignore_custom_codec);

  /* "asyncpg/protocol/settings.pyx":89
 *                                                  typekind, alias_to, _format)
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,             # <<<<<<<<<<<<<<
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):
 */

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_14get_data_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, int __pyx_v_ignore_custom_codec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_data_codec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.format = __pyx_v_format;
  __pyx_t_2.ignore_custom_codec = __pyx_v_ignore_custom_codec;
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_8protocol_8protocol_ConnectionSettings->get_data_codec(__pyx_v_self, __pyx_v_oid, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.get_data_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":94
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if not name.startswith('_'):
 *             try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_17__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_17__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_16__getattr__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_16__getattr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_self, PyObject *__pyx_v_name) {
  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 = NULL;
  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("__getattr__", 0);

  /* "asyncpg/protocol/settings.pyx":95
 * 
 *     def __getattr__(self, name):
 *         if not name.startswith('_'):             # <<<<<<<<<<<<<<
 *             try:
 *                 return self._settings[name]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 95, __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_u__2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u__2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 95, __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(2, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "asyncpg/protocol/settings.pyx":96
 *     def __getattr__(self, name):
 *         if not name.startswith('_'):
 *             try:             # <<<<<<<<<<<<<<
 *                 return self._settings[name]
 *             except KeyError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "asyncpg/protocol/settings.pyx":97
 *         if not name.startswith('_'):
 *             try:
 *                 return self._settings[name]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 raise AttributeError(name) from None
 */
        __Pyx_XDECREF(__pyx_r);
        if (unlikely(__pyx_v_self->_settings == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(2, 97, __pyx_L4_error)
        }
        __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->_settings, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 97, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L8_try_return;

        /* "asyncpg/protocol/settings.pyx":96
 *     def __getattr__(self, name):
 *         if not name.startswith('_'):
 *             try:             # <<<<<<<<<<<<<<
 *                 return self._settings[name]
 *             except KeyError:
 */
      }
      __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;

      /* "asyncpg/protocol/settings.pyx":98
 *             try:
 *                 return self._settings[name]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 raise AttributeError(name) from None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(2, 98, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);

        /* "asyncpg/protocol/settings.pyx":99
 *                 return self._settings[name]
 *             except KeyError:
 *                 raise AttributeError(name) from None             # <<<<<<<<<<<<<<
 * 
 *         return object.__getattribute__(self, name)
 */
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 99, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_Raise(__pyx_t_10, 0, 0, Py_None);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __PYX_ERR(2, 99, __pyx_L6_except_error)
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "asyncpg/protocol/settings.pyx":96
 *     def __getattr__(self, name):
 *         if not name.startswith('_'):
 *             try:             # <<<<<<<<<<<<<<
 *                 return self._settings[name]
 *             except KeyError:
 */
      __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_L8_try_return:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L0;
    }

    /* "asyncpg/protocol/settings.pyx":95
 * 
 *     def __getattr__(self, name):
 *         if not name.startswith('_'):             # <<<<<<<<<<<<<<
 *             try:
 *                 return self._settings[name]
 */
  }

  /* "asyncpg/protocol/settings.pyx":101
 *                 raise AttributeError(name) from None
 * 
 *         return object.__getattribute__(self, name)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattribute); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = NULL;
  __pyx_t_9 = 0;
  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_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_v_name};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 101, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_self), __pyx_v_name};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 101, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_name);
    __Pyx_GIVEREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_name);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 101, __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_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/settings.pyx":94
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if not name.startswith('_'):
 *             try:
 */

  /* 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_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/settings.pyx":103
 *         return object.__getattribute__(self, name)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ConnectionSettings {!r}>'.format(self._settings)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_19__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_19__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_18__repr__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_18__repr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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("__repr__", 0);

  /* "asyncpg/protocol/settings.pyx":104
 * 
 *     def __repr__(self):
 *         return '<ConnectionSettings {!r}>'.format(self._settings)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_ConnectionSettings_r, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 104, __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_self->_settings) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->_settings);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 104, __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;

  /* "asyncpg/protocol/settings.pyx":103
 *         return object.__getattribute__(self, name)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ConnectionSettings {!r}>'.format(self._settings)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.ConnectionSettings.__repr__", __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_7asyncpg_8protocol_8protocol_18ConnectionSettings_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_21__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_7asyncpg_8protocol_8protocol_18ConnectionSettings_20__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.ConnectionSettings.__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_7asyncpg_8protocol_8protocol_18ConnectionSettings_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_23__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_7asyncpg_8protocol_8protocol_18ConnectionSettings_22__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_18ConnectionSettings_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__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__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.ConnectionSettings.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":22
 * cdef class Codec:
 * 
 *     def __cinit__(self, uint32_t oid):             # <<<<<<<<<<<<<<
 *         self.oid = oid
 *         self.type = CODEC_UNDEFINED
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_5Codec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_5Codec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint32_t __pyx_v_oid;
  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_oid,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_oid)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 22, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_oid = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_oid == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 22, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Codec___cinit__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_self), __pyx_v_oid);

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

static int __pyx_pf_7asyncpg_8protocol_8protocol_5Codec___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, uint32_t __pyx_v_oid) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asyncpg/protocol/codecs/base.pyx":23
 * 
 *     def __cinit__(self, uint32_t oid):
 *         self.oid = oid             # <<<<<<<<<<<<<<
 *         self.type = CODEC_UNDEFINED
 * 
 */
  __pyx_v_self->oid = __pyx_v_oid;

  /* "asyncpg/protocol/codecs/base.pyx":24
 *     def __cinit__(self, uint32_t oid):
 *         self.oid = oid
 *         self.type = CODEC_UNDEFINED             # <<<<<<<<<<<<<<
 * 
 *     cdef init(self, str name, str schema, str kind,
 */
  __pyx_v_self->type = __pyx_e_7asyncpg_8protocol_8protocol_CODEC_UNDEFINED;

  /* "asyncpg/protocol/codecs/base.pyx":22
 * cdef class Codec:
 * 
 *     def __cinit__(self, uint32_t oid):             # <<<<<<<<<<<<<<
 *         self.oid = oid
 *         self.type = CODEC_UNDEFINED
 */

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

/* "asyncpg/protocol/codecs/base.pyx":26
 *         self.type = CODEC_UNDEFINED
 * 
 *     cdef init(self, str name, str schema, str kind,             # <<<<<<<<<<<<<<
 *               CodecType type, ServerDataFormat format,
 *               ClientExchangeFormat xformat,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, PyObject *__pyx_v_kind, enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType __pyx_v_type, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_c_encoder, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_c_decoder, PyObject *__pyx_v_py_encoder, PyObject *__pyx_v_py_decoder, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec, PyObject *__pyx_v_element_type_oids, PyObject *__pyx_v_element_names, PyObject *__pyx_v_element_codecs, Py_UCS4 __pyx_v_element_delimiter) {
  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_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init", 0);

  /* "asyncpg/protocol/codecs/base.pyx":35
 *               Py_UCS4 element_delimiter):
 * 
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.schema = schema
 *         self.kind = kind
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "asyncpg/protocol/codecs/base.pyx":36
 * 
 *         self.name = name
 *         self.schema = schema             # <<<<<<<<<<<<<<
 *         self.kind = kind
 *         self.type = type
 */
  __Pyx_INCREF(__pyx_v_schema);
  __Pyx_GIVEREF(__pyx_v_schema);
  __Pyx_GOTREF(__pyx_v_self->schema);
  __Pyx_DECREF(__pyx_v_self->schema);
  __pyx_v_self->schema = __pyx_v_schema;

  /* "asyncpg/protocol/codecs/base.pyx":37
 *         self.name = name
 *         self.schema = schema
 *         self.kind = kind             # <<<<<<<<<<<<<<
 *         self.type = type
 *         self.format = format
 */
  __Pyx_INCREF(__pyx_v_kind);
  __Pyx_GIVEREF(__pyx_v_kind);
  __Pyx_GOTREF(__pyx_v_self->kind);
  __Pyx_DECREF(__pyx_v_self->kind);
  __pyx_v_self->kind = __pyx_v_kind;

  /* "asyncpg/protocol/codecs/base.pyx":38
 *         self.schema = schema
 *         self.kind = kind
 *         self.type = type             # <<<<<<<<<<<<<<
 *         self.format = format
 *         self.xformat = xformat
 */
  __pyx_v_self->type = __pyx_v_type;

  /* "asyncpg/protocol/codecs/base.pyx":39
 *         self.kind = kind
 *         self.type = type
 *         self.format = format             # <<<<<<<<<<<<<<
 *         self.xformat = xformat
 *         self.c_encoder = c_encoder
 */
  __pyx_v_self->format = __pyx_v_format;

  /* "asyncpg/protocol/codecs/base.pyx":40
 *         self.type = type
 *         self.format = format
 *         self.xformat = xformat             # <<<<<<<<<<<<<<
 *         self.c_encoder = c_encoder
 *         self.c_decoder = c_decoder
 */
  __pyx_v_self->xformat = __pyx_v_xformat;

  /* "asyncpg/protocol/codecs/base.pyx":41
 *         self.format = format
 *         self.xformat = xformat
 *         self.c_encoder = c_encoder             # <<<<<<<<<<<<<<
 *         self.c_decoder = c_decoder
 *         self.py_encoder = py_encoder
 */
  __pyx_v_self->c_encoder = __pyx_v_c_encoder;

  /* "asyncpg/protocol/codecs/base.pyx":42
 *         self.xformat = xformat
 *         self.c_encoder = c_encoder
 *         self.c_decoder = c_decoder             # <<<<<<<<<<<<<<
 *         self.py_encoder = py_encoder
 *         self.py_decoder = py_decoder
 */
  __pyx_v_self->c_decoder = __pyx_v_c_decoder;

  /* "asyncpg/protocol/codecs/base.pyx":43
 *         self.c_encoder = c_encoder
 *         self.c_decoder = c_decoder
 *         self.py_encoder = py_encoder             # <<<<<<<<<<<<<<
 *         self.py_decoder = py_decoder
 *         self.element_codec = element_codec
 */
  __Pyx_INCREF(__pyx_v_py_encoder);
  __Pyx_GIVEREF(__pyx_v_py_encoder);
  __Pyx_GOTREF(__pyx_v_self->py_encoder);
  __Pyx_DECREF(__pyx_v_self->py_encoder);
  __pyx_v_self->py_encoder = __pyx_v_py_encoder;

  /* "asyncpg/protocol/codecs/base.pyx":44
 *         self.c_decoder = c_decoder
 *         self.py_encoder = py_encoder
 *         self.py_decoder = py_decoder             # <<<<<<<<<<<<<<
 *         self.element_codec = element_codec
 *         self.element_type_oids = element_type_oids
 */
  __Pyx_INCREF(__pyx_v_py_decoder);
  __Pyx_GIVEREF(__pyx_v_py_decoder);
  __Pyx_GOTREF(__pyx_v_self->py_decoder);
  __Pyx_DECREF(__pyx_v_self->py_decoder);
  __pyx_v_self->py_decoder = __pyx_v_py_decoder;

  /* "asyncpg/protocol/codecs/base.pyx":45
 *         self.py_encoder = py_encoder
 *         self.py_decoder = py_decoder
 *         self.element_codec = element_codec             # <<<<<<<<<<<<<<
 *         self.element_type_oids = element_type_oids
 *         self.element_codecs = element_codecs
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_element_codec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_element_codec));
  __Pyx_GOTREF(__pyx_v_self->element_codec);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->element_codec));
  __pyx_v_self->element_codec = __pyx_v_element_codec;

  /* "asyncpg/protocol/codecs/base.pyx":46
 *         self.py_decoder = py_decoder
 *         self.element_codec = element_codec
 *         self.element_type_oids = element_type_oids             # <<<<<<<<<<<<<<
 *         self.element_codecs = element_codecs
 *         self.element_delimiter = element_delimiter
 */
  __Pyx_INCREF(__pyx_v_element_type_oids);
  __Pyx_GIVEREF(__pyx_v_element_type_oids);
  __Pyx_GOTREF(__pyx_v_self->element_type_oids);
  __Pyx_DECREF(__pyx_v_self->element_type_oids);
  __pyx_v_self->element_type_oids = __pyx_v_element_type_oids;

  /* "asyncpg/protocol/codecs/base.pyx":47
 *         self.element_codec = element_codec
 *         self.element_type_oids = element_type_oids
 *         self.element_codecs = element_codecs             # <<<<<<<<<<<<<<
 *         self.element_delimiter = element_delimiter
 *         self.element_names = element_names
 */
  __Pyx_INCREF(__pyx_v_element_codecs);
  __Pyx_GIVEREF(__pyx_v_element_codecs);
  __Pyx_GOTREF(__pyx_v_self->element_codecs);
  __Pyx_DECREF(__pyx_v_self->element_codecs);
  __pyx_v_self->element_codecs = __pyx_v_element_codecs;

  /* "asyncpg/protocol/codecs/base.pyx":48
 *         self.element_type_oids = element_type_oids
 *         self.element_codecs = element_codecs
 *         self.element_delimiter = element_delimiter             # <<<<<<<<<<<<<<
 *         self.element_names = element_names
 * 
 */
  __pyx_v_self->element_delimiter = __pyx_v_element_delimiter;

  /* "asyncpg/protocol/codecs/base.pyx":49
 *         self.element_codecs = element_codecs
 *         self.element_delimiter = element_delimiter
 *         self.element_names = element_names             # <<<<<<<<<<<<<<
 * 
 *         if element_names is not None:
 */
  __Pyx_INCREF(__pyx_v_element_names);
  __Pyx_GIVEREF(__pyx_v_element_names);
  __Pyx_GOTREF(__pyx_v_self->element_names);
  __Pyx_DECREF(__pyx_v_self->element_names);
  __pyx_v_self->element_names = __pyx_v_element_names;

  /* "asyncpg/protocol/codecs/base.pyx":51
 *         self.element_names = element_names
 * 
 *         if element_names is not None:             # <<<<<<<<<<<<<<
 *             self.record_desc = record.ApgRecordDesc_New(
 *                 element_names, tuple(element_names))
 */
  __pyx_t_1 = (__pyx_v_element_names != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/base.pyx":53
 *         if element_names is not None:
 *             self.record_desc = record.ApgRecordDesc_New(
 *                 element_names, tuple(element_names))             # <<<<<<<<<<<<<<
 *         else:
 *             self.record_desc = None
 */
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_element_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/codecs/base.pyx":52
 * 
 *         if element_names is not None:
 *             self.record_desc = record.ApgRecordDesc_New(             # <<<<<<<<<<<<<<
 *                 element_names, tuple(element_names))
 *         else:
 */
    __pyx_t_4 = ApgRecordDesc_New(__pyx_v_element_names, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->record_desc);
    __Pyx_DECREF(__pyx_v_self->record_desc);
    __pyx_v_self->record_desc = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":51
 *         self.element_names = element_names
 * 
 *         if element_names is not None:             # <<<<<<<<<<<<<<
 *             self.record_desc = record.ApgRecordDesc_New(
 *                 element_names, tuple(element_names))
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/base.pyx":55
 *                 element_names, tuple(element_names))
 *         else:
 *             self.record_desc = None             # <<<<<<<<<<<<<<
 * 
 *         if type == CODEC_C:
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->record_desc);
    __Pyx_DECREF(__pyx_v_self->record_desc);
    __pyx_v_self->record_desc = Py_None;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/base.pyx":57
 *             self.record_desc = None
 * 
 *         if type == CODEC_C:             # <<<<<<<<<<<<<<
 *             self.encoder = <codec_encode_func>&self.encode_scalar
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 */
  switch (__pyx_v_type) {
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_C:

    /* "asyncpg/protocol/codecs/base.pyx":58
 * 
 *         if type == CODEC_C:
 *             self.encoder = <codec_encode_func>&self.encode_scalar             # <<<<<<<<<<<<<<
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 *         elif type == CODEC_ARRAY:
 */
    __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_scalar));

    /* "asyncpg/protocol/codecs/base.pyx":59
 *         if type == CODEC_C:
 *             self.encoder = <codec_encode_func>&self.encode_scalar
 *             self.decoder = <codec_decode_func>&self.decode_scalar             # <<<<<<<<<<<<<<
 *         elif type == CODEC_ARRAY:
 *             if format == PG_FORMAT_BINARY:
 */
    __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_scalar));

    /* "asyncpg/protocol/codecs/base.pyx":57
 *             self.record_desc = None
 * 
 *         if type == CODEC_C:             # <<<<<<<<<<<<<<
 *             self.encoder = <codec_encode_func>&self.encode_scalar
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_ARRAY:

    /* "asyncpg/protocol/codecs/base.pyx":61
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 *         elif type == CODEC_ARRAY:
 *             if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 self.encoder = <codec_encode_func>&self.encode_array
 *                 self.decoder = <codec_decode_func>&self.decode_array
 */
    __pyx_t_2 = ((__pyx_v_format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/base.pyx":62
 *         elif type == CODEC_ARRAY:
 *             if format == PG_FORMAT_BINARY:
 *                 self.encoder = <codec_encode_func>&self.encode_array             # <<<<<<<<<<<<<<
 *                 self.decoder = <codec_decode_func>&self.decode_array
 *             else:
 */
      __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array));

      /* "asyncpg/protocol/codecs/base.pyx":63
 *             if format == PG_FORMAT_BINARY:
 *                 self.encoder = <codec_encode_func>&self.encode_array
 *                 self.decoder = <codec_decode_func>&self.decode_array             # <<<<<<<<<<<<<<
 *             else:
 *                 self.encoder = <codec_encode_func>&self.encode_array_text
 */
      __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array));

      /* "asyncpg/protocol/codecs/base.pyx":61
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 *         elif type == CODEC_ARRAY:
 *             if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 self.encoder = <codec_encode_func>&self.encode_array
 *                 self.decoder = <codec_decode_func>&self.decode_array
 */
      goto __pyx_L4;
    }

    /* "asyncpg/protocol/codecs/base.pyx":65
 *                 self.decoder = <codec_decode_func>&self.decode_array
 *             else:
 *                 self.encoder = <codec_encode_func>&self.encode_array_text             # <<<<<<<<<<<<<<
 *                 self.decoder = <codec_decode_func>&self.decode_array_text
 *         elif type == CODEC_RANGE:
 */
    /*else*/ {
      __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array_text));

      /* "asyncpg/protocol/codecs/base.pyx":66
 *             else:
 *                 self.encoder = <codec_encode_func>&self.encode_array_text
 *                 self.decoder = <codec_decode_func>&self.decode_array_text             # <<<<<<<<<<<<<<
 *         elif type == CODEC_RANGE:
 *             if format != PG_FORMAT_BINARY:
 */
      __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array_text));
    }
    __pyx_L4:;

    /* "asyncpg/protocol/codecs/base.pyx":60
 *             self.encoder = <codec_encode_func>&self.encode_scalar
 *             self.decoder = <codec_decode_func>&self.decode_scalar
 *         elif type == CODEC_ARRAY:             # <<<<<<<<<<<<<<
 *             if format == PG_FORMAT_BINARY:
 *                 self.encoder = <codec_encode_func>&self.encode_array
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_RANGE:

    /* "asyncpg/protocol/codecs/base.pyx":68
 *                 self.decoder = <codec_decode_func>&self.decode_array_text
 *         elif type == CODEC_RANGE:
 *             if format != PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 */
    __pyx_t_2 = ((__pyx_v_format != __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/codecs/base.pyx":69
 *         elif type == CODEC_RANGE:
 *             if format != PG_FORMAT_BINARY:
 *                 raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'range types is not supported'.format(schema, name))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_UnsupportedClientFeatureError); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":71
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'range types is not supported'.format(schema, name))             # <<<<<<<<<<<<<<
 *             self.encoder = <codec_encode_func>&self.encode_range
 *             self.decoder = <codec_decode_func>&self.decode_range
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_decode_type_text_encoding, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 71, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_schema, __pyx_v_name};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 71, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_schema, __pyx_v_name};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 71, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_schema);
        __Pyx_GIVEREF(__pyx_v_schema);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_schema);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_name);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_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_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __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_4)) __PYX_ERR(4, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(4, 69, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":68
 *                 self.decoder = <codec_decode_func>&self.decode_array_text
 *         elif type == CODEC_RANGE:
 *             if format != PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":72
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'range types is not supported'.format(schema, name))
 *             self.encoder = <codec_encode_func>&self.encode_range             # <<<<<<<<<<<<<<
 *             self.decoder = <codec_decode_func>&self.decode_range
 *         elif type == CODEC_COMPOSITE:
 */
    __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_range));

    /* "asyncpg/protocol/codecs/base.pyx":73
 *                     'range types is not supported'.format(schema, name))
 *             self.encoder = <codec_encode_func>&self.encode_range
 *             self.decoder = <codec_decode_func>&self.decode_range             # <<<<<<<<<<<<<<
 *         elif type == CODEC_COMPOSITE:
 *             if format != PG_FORMAT_BINARY:
 */
    __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_range));

    /* "asyncpg/protocol/codecs/base.pyx":67
 *                 self.encoder = <codec_encode_func>&self.encode_array_text
 *                 self.decoder = <codec_decode_func>&self.decode_array_text
 *         elif type == CODEC_RANGE:             # <<<<<<<<<<<<<<
 *             if format != PG_FORMAT_BINARY:
 *                 raise exceptions.UnsupportedClientFeatureError(
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_COMPOSITE:

    /* "asyncpg/protocol/codecs/base.pyx":75
 *             self.decoder = <codec_decode_func>&self.decode_range
 *         elif type == CODEC_COMPOSITE:
 *             if format != PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 */
    __pyx_t_2 = ((__pyx_v_format != __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/codecs/base.pyx":76
 *         elif type == CODEC_COMPOSITE:
 *             if format != PG_FORMAT_BINARY:
 *                 raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'composite types is not supported'.format(schema, name))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_UnsupportedClientFeatureError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":78
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'composite types is not supported'.format(schema, name))             # <<<<<<<<<<<<<<
 *             self.encoder = <codec_encode_func>&self.encode_composite
 *             self.decoder = <codec_decode_func>&self.decode_composite
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_decode_type_text_encoding_2, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_schema, __pyx_v_name};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 78, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_schema, __pyx_v_name};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 78, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_v_schema);
        __Pyx_GIVEREF(__pyx_v_schema);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_schema);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_v_name);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __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(4, 76, __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(4, 76, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":75
 *             self.decoder = <codec_decode_func>&self.decode_range
 *         elif type == CODEC_COMPOSITE:
 *             if format != PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 raise exceptions.UnsupportedClientFeatureError(
 *                     'cannot decode type "{}"."{}": text encoding of '
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":79
 *                     'cannot decode type "{}"."{}": text encoding of '
 *                     'composite types is not supported'.format(schema, name))
 *             self.encoder = <codec_encode_func>&self.encode_composite             # <<<<<<<<<<<<<<
 *             self.decoder = <codec_decode_func>&self.decode_composite
 *         elif type == CODEC_PY:
 */
    __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_composite));

    /* "asyncpg/protocol/codecs/base.pyx":80
 *                     'composite types is not supported'.format(schema, name))
 *             self.encoder = <codec_encode_func>&self.encode_composite
 *             self.decoder = <codec_decode_func>&self.decode_composite             # <<<<<<<<<<<<<<
 *         elif type == CODEC_PY:
 *             self.encoder = <codec_encode_func>&self.encode_in_python
 */
    __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_composite));

    /* "asyncpg/protocol/codecs/base.pyx":74
 *             self.encoder = <codec_encode_func>&self.encode_range
 *             self.decoder = <codec_decode_func>&self.decode_range
 *         elif type == CODEC_COMPOSITE:             # <<<<<<<<<<<<<<
 *             if format != PG_FORMAT_BINARY:
 *                 raise exceptions.UnsupportedClientFeatureError(
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_PY:

    /* "asyncpg/protocol/codecs/base.pyx":82
 *             self.decoder = <codec_decode_func>&self.decode_composite
 *         elif type == CODEC_PY:
 *             self.encoder = <codec_encode_func>&self.encode_in_python             # <<<<<<<<<<<<<<
 *             self.decoder = <codec_decode_func>&self.decode_in_python
 *         else:
 */
    __pyx_v_self->encoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_in_python));

    /* "asyncpg/protocol/codecs/base.pyx":83
 *         elif type == CODEC_PY:
 *             self.encoder = <codec_encode_func>&self.encode_in_python
 *             self.decoder = <codec_decode_func>&self.decode_in_python             # <<<<<<<<<<<<<<
 *         else:
 *             raise exceptions.InternalClientError(
 */
    __pyx_v_self->decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_codec_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_in_python));

    /* "asyncpg/protocol/codecs/base.pyx":81
 *             self.encoder = <codec_encode_func>&self.encode_composite
 *             self.decoder = <codec_decode_func>&self.decode_composite
 *         elif type == CODEC_PY:             # <<<<<<<<<<<<<<
 *             self.encoder = <codec_encode_func>&self.encode_in_python
 *             self.decoder = <codec_decode_func>&self.decode_in_python
 */
    break;
    default:

    /* "asyncpg/protocol/codecs/base.pyx":85
 *             self.decoder = <codec_decode_func>&self.decode_in_python
 *         else:
 *             raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                 'unexpected codec type: {}'.format(type))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":86
 *         else:
 *             raise exceptions.InternalClientError(
 *                 'unexpected codec type: {}'.format(type))             # <<<<<<<<<<<<<<
 * 
 *     cdef Codec copy(self):
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_codec_type, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_CodecType(__pyx_v_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __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_4)) __PYX_ERR(4, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(4, 85, __pyx_L1_error)
    break;
  }

  /* "asyncpg/protocol/codecs/base.pyx":26
 *         self.type = CODEC_UNDEFINED
 * 
 *     cdef init(self, str name, str schema, str kind,             # <<<<<<<<<<<<<<
 *               CodecType type, ServerDataFormat format,
 *               ClientExchangeFormat xformat,
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":88
 *                 'unexpected codec type: {}'.format(type))
 * 
 *     cdef Codec copy(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_copy(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__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;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "asyncpg/protocol/codecs/base.pyx":91
 *         cdef Codec codec
 * 
 *         codec = Codec(self.oid)             # <<<<<<<<<<<<<<
 *         codec.init(self.name, self.schema, self.kind,
 *                    self.type, self.format, self.xformat,
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":92
 * 
 *         codec = Codec(self.oid)
 *         codec.init(self.name, self.schema, self.kind,             # <<<<<<<<<<<<<<
 *                    self.type, self.format, self.xformat,
 *                    self.c_encoder, self.c_decoder,
 */
  __pyx_t_2 = __pyx_v_self->name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_v_self->schema;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_v_self->kind;
  __Pyx_INCREF(__pyx_t_3);

  /* "asyncpg/protocol/codecs/base.pyx":95
 *                    self.type, self.format, self.xformat,
 *                    self.c_encoder, self.c_decoder,
 *                    self.py_encoder, self.py_decoder,             # <<<<<<<<<<<<<<
 *                    self.element_codec,
 *                    self.element_type_oids, self.element_names,
 */
  __pyx_t_4 = __pyx_v_self->py_encoder;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_v_self->py_decoder;
  __Pyx_INCREF(__pyx_t_5);

  /* "asyncpg/protocol/codecs/base.pyx":96
 *                    self.c_encoder, self.c_decoder,
 *                    self.py_encoder, self.py_decoder,
 *                    self.element_codec,             # <<<<<<<<<<<<<<
 *                    self.element_type_oids, self.element_names,
 *                    self.element_codecs, self.element_delimiter)
 */
  __pyx_t_6 = ((PyObject *)__pyx_v_self->element_codec);
  __Pyx_INCREF(__pyx_t_6);

  /* "asyncpg/protocol/codecs/base.pyx":97
 *                    self.py_encoder, self.py_decoder,
 *                    self.element_codec,
 *                    self.element_type_oids, self.element_names,             # <<<<<<<<<<<<<<
 *                    self.element_codecs, self.element_delimiter)
 * 
 */
  __pyx_t_7 = __pyx_v_self->element_type_oids;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = __pyx_v_self->element_names;
  __Pyx_INCREF(__pyx_t_8);

  /* "asyncpg/protocol/codecs/base.pyx":98
 *                    self.element_codec,
 *                    self.element_type_oids, self.element_names,
 *                    self.element_codecs, self.element_delimiter)             # <<<<<<<<<<<<<<
 * 
 *         return codec
 */
  __pyx_t_9 = __pyx_v_self->element_codecs;
  __Pyx_INCREF(__pyx_t_9);

  /* "asyncpg/protocol/codecs/base.pyx":92
 * 
 *         codec = Codec(self.oid)
 *         codec.init(self.name, self.schema, self.kind,             # <<<<<<<<<<<<<<
 *                    self.type, self.format, self.xformat,
 *                    self.c_encoder, self.c_decoder,
 */
  __pyx_t_10 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_3), __pyx_v_self->type, __pyx_v_self->format, __pyx_v_self->xformat, __pyx_v_self->c_encoder, __pyx_v_self->c_decoder, __pyx_t_4, __pyx_t_5, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_6), ((PyObject*)__pyx_t_7), __pyx_t_8, ((PyObject*)__pyx_t_9), __pyx_v_self->element_delimiter); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":100
 *                    self.element_codecs, self.element_delimiter)
 * 
 *         return codec             # <<<<<<<<<<<<<<
 * 
 *     cdef encode_scalar(self, ConnectionSettings settings, WriteBuffer buf,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":88
 *                 'unexpected codec type: {}'.format(type))
 * 
 *     cdef Codec copy(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":102
 *         return codec
 * 
 *     cdef encode_scalar(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                        object obj):
 *         self.c_encoder(settings, buf, obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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("encode_scalar", 0);

  /* "asyncpg/protocol/codecs/base.pyx":104
 *     cdef encode_scalar(self, ConnectionSettings settings, WriteBuffer buf,
 *                        object obj):
 *         self.c_encoder(settings, buf, obj)             # <<<<<<<<<<<<<<
 * 
 *     cdef encode_array(self, ConnectionSettings settings, WriteBuffer buf,
 */
  __pyx_t_1 = __pyx_v_self->c_encoder(__pyx_v_settings, __pyx_v_buf, __pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":102
 *         return codec
 * 
 *     cdef encode_scalar(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                        object obj):
 *         self.c_encoder(settings, buf, obj)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":106
 *         self.c_encoder(settings, buf, obj)
 * 
 *     cdef encode_array(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                       object obj):
 *         array_encode(settings, buf, obj, self.element_codec.oid,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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("encode_array", 0);

  /* "asyncpg/protocol/codecs/base.pyx":108
 *     cdef encode_array(self, ConnectionSettings settings, WriteBuffer buf,
 *                       object obj):
 *         array_encode(settings, buf, obj, self.element_codec.oid,             # <<<<<<<<<<<<<<
 *                      codec_encode_func_ex,
 *                      <void*>(<cpython.PyObject>self.element_codec))
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_encode(__pyx_v_settings, __pyx_v_buf, __pyx_v_obj, __pyx_v_self->element_codec->oid, __pyx_f_7asyncpg_8protocol_8protocol_codec_encode_func_ex, ((void *)__pyx_v_self->element_codec)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":106
 *         self.c_encoder(settings, buf, obj)
 * 
 *     cdef encode_array(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                       object obj):
 *         array_encode(settings, buf, obj, self.element_codec.oid,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":112
 *                      <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef encode_array_text(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                            object obj):
 *         return textarray_encode(settings, buf, obj,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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("encode_array_text", 0);

  /* "asyncpg/protocol/codecs/base.pyx":114
 *     cdef encode_array_text(self, ConnectionSettings settings, WriteBuffer buf,
 *                            object obj):
 *         return textarray_encode(settings, buf, obj,             # <<<<<<<<<<<<<<
 *                                 codec_encode_func_ex,
 *                                 <void*>(<cpython.PyObject>self.element_codec),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/codecs/base.pyx":117
 *                                 codec_encode_func_ex,
 *                                 <void*>(<cpython.PyObject>self.element_codec),
 *                                 self.element_delimiter)             # <<<<<<<<<<<<<<
 * 
 *     cdef encode_range(self, ConnectionSettings settings, WriteBuffer buf,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_textarray_encode(__pyx_v_settings, __pyx_v_buf, __pyx_v_obj, __pyx_f_7asyncpg_8protocol_8protocol_codec_encode_func_ex, ((void *)__pyx_v_self->element_codec), __pyx_v_self->element_delimiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":112
 *                      <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef encode_array_text(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                            object obj):
 *         return textarray_encode(settings, buf, obj,
 */

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

/* "asyncpg/protocol/codecs/base.pyx":119
 *                                 self.element_delimiter)
 * 
 *     cdef encode_range(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                       object obj):
 *         range_encode(settings, buf, obj, self.element_codec.oid,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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("encode_range", 0);

  /* "asyncpg/protocol/codecs/base.pyx":121
 *     cdef encode_range(self, ConnectionSettings settings, WriteBuffer buf,
 *                       object obj):
 *         range_encode(settings, buf, obj, self.element_codec.oid,             # <<<<<<<<<<<<<<
 *                      codec_encode_func_ex,
 *                      <void*>(<cpython.PyObject>self.element_codec))
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_range_encode(__pyx_v_settings, __pyx_v_buf, __pyx_v_obj, __pyx_v_self->element_codec->oid, __pyx_f_7asyncpg_8protocol_8protocol_codec_encode_func_ex, ((void *)__pyx_v_self->element_codec)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":119
 *                                 self.element_delimiter)
 * 
 *     cdef encode_range(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                       object obj):
 *         range_encode(settings, buf, obj, self.element_codec.oid,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":125
 *                      <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef encode_composite(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj):
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_elem_data = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_elem_codecs = 0;
  Py_ssize_t __pyx_v_count;
  Py_ssize_t __pyx_v_composite_size;
  PyObject *__pyx_v_rec = 0;
  PyObject *__pyx_v_field = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int32_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encode_composite", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "asyncpg/protocol/codecs/base.pyx":130
 *             WriteBuffer elem_data
 *             int i
 *             list elem_codecs = self.element_codecs             # <<<<<<<<<<<<<<
 *             ssize_t count
 *             ssize_t composite_size
 */
  __pyx_t_1 = __pyx_v_self->element_codecs;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_elem_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":135
 *             tuple rec
 * 
 *         if isinstance(obj, MappingABC):             # <<<<<<<<<<<<<<
 *             # Input is dict-like, form a tuple
 *             composite_size = len(self.element_type_oids)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MappingABC); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(4, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/codecs/base.pyx":137
 *         if isinstance(obj, MappingABC):
 *             # Input is dict-like, form a tuple
 *             composite_size = len(self.element_type_oids)             # <<<<<<<<<<<<<<
 *             rec = cpython.PyTuple_New(composite_size)
 * 
 */
    __pyx_t_1 = __pyx_v_self->element_type_oids;
    __Pyx_INCREF(__pyx_t_1);
    if (unlikely(__pyx_t_1 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(4, 137, __pyx_L1_error)
    }
    __pyx_t_4 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 137, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_composite_size = __pyx_t_4;

    /* "asyncpg/protocol/codecs/base.pyx":138
 *             # Input is dict-like, form a tuple
 *             composite_size = len(self.element_type_oids)
 *             rec = cpython.PyTuple_New(composite_size)             # <<<<<<<<<<<<<<
 * 
 *             for i in range(composite_size):
 */
    __pyx_t_1 = PyTuple_New(__pyx_v_composite_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rec = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":140
 *             rec = cpython.PyTuple_New(composite_size)
 * 
 *             for i in range(composite_size):             # <<<<<<<<<<<<<<
 *                 cpython.Py_INCREF(None)
 *                 cpython.PyTuple_SET_ITEM(rec, i, None)
 */
    __pyx_t_5 = __pyx_v_composite_size;
    __pyx_t_6 = __pyx_t_5;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "asyncpg/protocol/codecs/base.pyx":141
 * 
 *             for i in range(composite_size):
 *                 cpython.Py_INCREF(None)             # <<<<<<<<<<<<<<
 *                 cpython.PyTuple_SET_ITEM(rec, i, None)
 * 
 */
      Py_INCREF(Py_None);

      /* "asyncpg/protocol/codecs/base.pyx":142
 *             for i in range(composite_size):
 *                 cpython.Py_INCREF(None)
 *                 cpython.PyTuple_SET_ITEM(rec, i, None)             # <<<<<<<<<<<<<<
 * 
 *             for field in obj:
 */
      PyTuple_SET_ITEM(__pyx_v_rec, __pyx_v_i, Py_None);
    }

    /* "asyncpg/protocol/codecs/base.pyx":144
 *                 cpython.PyTuple_SET_ITEM(rec, i, None)
 * 
 *             for field in obj:             # <<<<<<<<<<<<<<
 *                 try:
 *                     i = self.element_names[field]
 */
    if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
      __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 144, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        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_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(4, 144, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 144, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(4, 144, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 144, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
      } else {
        __pyx_t_9 = __pyx_t_8(__pyx_t_1);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(4, 144, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":145
 * 
 *             for field in obj:
 *                 try:             # <<<<<<<<<<<<<<
 *                     i = self.element_names[field]
 *                 except KeyError:
 */
      {
        __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:*/ {

          /* "asyncpg/protocol/codecs/base.pyx":146
 *             for field in obj:
 *                 try:
 *                     i = self.element_names[field]             # <<<<<<<<<<<<<<
 *                 except KeyError:
 *                     raise ValueError(
 */
          __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_self->element_names, __pyx_v_field); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 146, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 146, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_i = __pyx_t_7;

          /* "asyncpg/protocol/codecs/base.pyx":145
 * 
 *             for field in obj:
 *                 try:             # <<<<<<<<<<<<<<
 *                     i = self.element_names[field]
 *                 except KeyError:
 */
        }
        __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_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":147
 *                 try:
 *                     i = self.element_names[field]
 *                 except KeyError:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         '{!r} is not a valid element of composite '
 */
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_7) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_composite", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_13, &__pyx_t_14) < 0) __PYX_ERR(4, 147, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_t_14);

          /* "asyncpg/protocol/codecs/base.pyx":150
 *                     raise ValueError(
 *                         '{!r} is not a valid element of composite '
 *                         'type {}'.format(field, self.name)) from None             # <<<<<<<<<<<<<<
 * 
 *                 item = obj[field]
 */
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_r_is_not_a_valid_element_of_com, __pyx_n_s_format); if (unlikely(!__pyx_t_16)) __PYX_ERR(4, 150, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = NULL;
          __pyx_t_7 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
            if (likely(__pyx_t_17)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_16, function);
              __pyx_t_7 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_16)) {
            PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_v_field, __pyx_v_self->name};
            __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(4, 150, __pyx_L10_except_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_15);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
            PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_v_field, __pyx_v_self->name};
            __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(4, 150, __pyx_L10_except_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_15);
          } else
          #endif
          {
            __pyx_t_18 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 150, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_18);
            if (__pyx_t_17) {
              __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
            }
            __Pyx_INCREF(__pyx_v_field);
            __Pyx_GIVEREF(__pyx_v_field);
            PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_7, __pyx_v_field);
            __Pyx_INCREF(__pyx_v_self->name);
            __Pyx_GIVEREF(__pyx_v_self->name);
            PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_7, __pyx_v_self->name);
            __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_18, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(4, 150, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          }
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

          /* "asyncpg/protocol/codecs/base.pyx":148
 *                     i = self.element_names[field]
 *                 except KeyError:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         '{!r} is not a valid element of composite '
 *                         'type {}'.format(field, self.name)) from None
 */
          __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(4, 148, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "asyncpg/protocol/codecs/base.pyx":150
 *                     raise ValueError(
 *                         '{!r} is not a valid element of composite '
 *                         'type {}'.format(field, self.name)) from None             # <<<<<<<<<<<<<<
 * 
 *                 item = obj[field]
 */
          __Pyx_Raise(__pyx_t_16, 0, 0, Py_None);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __PYX_ERR(4, 148, __pyx_L10_except_error)
        }
        goto __pyx_L10_except_error;
        __pyx_L10_except_error:;

        /* "asyncpg/protocol/codecs/base.pyx":145
 * 
 *             for field in obj:
 *                 try:             # <<<<<<<<<<<<<<
 *                     i = self.element_names[field]
 *                 except KeyError:
 */
        __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_L15_try_end:;
      }

      /* "asyncpg/protocol/codecs/base.pyx":152
 *                         'type {}'.format(field, self.name)) from None
 * 
 *                 item = obj[field]             # <<<<<<<<<<<<<<
 *                 cpython.Py_INCREF(item)
 *                 cpython.PyTuple_SET_ITEM(rec, i, item)
 */
      __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_obj, __pyx_v_field); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":153
 * 
 *                 item = obj[field]
 *                 cpython.Py_INCREF(item)             # <<<<<<<<<<<<<<
 *                 cpython.PyTuple_SET_ITEM(rec, i, item)
 * 
 */
      Py_INCREF(__pyx_v_item);

      /* "asyncpg/protocol/codecs/base.pyx":154
 *                 item = obj[field]
 *                 cpython.Py_INCREF(item)
 *                 cpython.PyTuple_SET_ITEM(rec, i, item)             # <<<<<<<<<<<<<<
 * 
 *             obj = rec
 */
      PyTuple_SET_ITEM(__pyx_v_rec, __pyx_v_i, __pyx_v_item);

      /* "asyncpg/protocol/codecs/base.pyx":144
 *                 cpython.PyTuple_SET_ITEM(rec, i, None)
 * 
 *             for field in obj:             # <<<<<<<<<<<<<<
 *                 try:
 *                     i = self.element_names[field]
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":156
 *                 cpython.PyTuple_SET_ITEM(rec, i, item)
 * 
 *             obj = rec             # <<<<<<<<<<<<<<
 * 
 *         count = len(obj)
 */
    __Pyx_INCREF(__pyx_v_rec);
    __Pyx_DECREF_SET(__pyx_v_obj, __pyx_v_rec);

    /* "asyncpg/protocol/codecs/base.pyx":135
 *             tuple rec
 * 
 *         if isinstance(obj, MappingABC):             # <<<<<<<<<<<<<<
 *             # Input is dict-like, form a tuple
 *             composite_size = len(self.element_type_oids)
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":158
 *             obj = rec
 * 
 *         count = len(obj)             # <<<<<<<<<<<<<<
 *         if count > _MAXINT32:
 *             raise ValueError('too many elements in composite type record')
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 158, __pyx_L1_error)
  __pyx_v_count = __pyx_t_4;

  /* "asyncpg/protocol/codecs/base.pyx":159
 * 
 *         count = len(obj)
 *         if count > _MAXINT32:             # <<<<<<<<<<<<<<
 *             raise ValueError('too many elements in composite type record')
 * 
 */
  __pyx_t_3 = ((__pyx_v_count > 0x7FFFFFFF) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/codecs/base.pyx":160
 *         count = len(obj)
 *         if count > _MAXINT32:
 *             raise ValueError('too many elements in composite type record')             # <<<<<<<<<<<<<<
 * 
 *         elem_data = WriteBuffer.new()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 160, __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(4, 160, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":159
 * 
 *         count = len(obj)
 *         if count > _MAXINT32:             # <<<<<<<<<<<<<<
 *             raise ValueError('too many elements in composite type record')
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":162
 *             raise ValueError('too many elements in composite type record')
 * 
 *         elem_data = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *         i = 0
 *         for item in obj:
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_elem_data = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":163
 * 
 *         elem_data = WriteBuffer.new()
 *         i = 0             # <<<<<<<<<<<<<<
 *         for item in obj:
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 */
  __pyx_v_i = 0;

  /* "asyncpg/protocol/codecs/base.pyx":164
 *         elem_data = WriteBuffer.new()
 *         i = 0
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 *             if item is None:
 */
  if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 164, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      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_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_14); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(4, 164, __pyx_L1_error)
        #else
        __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 164, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_14); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(4, 164, __pyx_L1_error)
        #else
        __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 164, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        #endif
      }
    } else {
      __pyx_t_14 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_14)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(4, 164, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_14);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":165
 *         i = 0
 *         for item in obj:
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])             # <<<<<<<<<<<<<<
 *             if item is None:
 *                 elem_data.write_int32(-1)
 */
    if (unlikely(__pyx_v_self->element_type_oids == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 165, __pyx_L1_error)
    }
    __pyx_t_14 = __Pyx_GetItemInt_Tuple(__pyx_v_self->element_type_oids, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_19 = __Pyx_PyInt_As_int32_t(__pyx_t_14); if (unlikely((__pyx_t_19 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 165, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_elem_data->__pyx_vtab)->write_int32(__pyx_v_elem_data, ((int32_t)__pyx_t_19)); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":166
 *         for item in obj:
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
    __pyx_t_3 = (__pyx_v_item == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/base.pyx":167
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 *             if item is None:
 *                 elem_data.write_int32(-1)             # <<<<<<<<<<<<<<
 *             else:
 *                 (<Codec>elem_codecs[i]).encode(settings, elem_data, item)
 */
      __pyx_t_14 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_elem_data->__pyx_vtab)->write_int32(__pyx_v_elem_data, -1); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":166
 *         for item in obj:
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
      goto __pyx_L21;
    }

    /* "asyncpg/protocol/codecs/base.pyx":169
 *                 elem_data.write_int32(-1)
 *             else:
 *                 (<Codec>elem_codecs[i]).encode(settings, elem_data, item)             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
    /*else*/ {
      if (unlikely(__pyx_v_elem_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 169, __pyx_L1_error)
      }
      __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_elem_codecs, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(4, 169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_13 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_14), __pyx_v_settings, __pyx_v_elem_data, __pyx_v_item); if (unlikely(!__pyx_t_13)) __PYX_ERR(4, 169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __pyx_L21:;

    /* "asyncpg/protocol/codecs/base.pyx":170
 *             else:
 *                 (<Codec>elem_codecs[i]).encode(settings, elem_data, item)
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         record_encode_frame(settings, buf, elem_data, <int32_t>count)
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "asyncpg/protocol/codecs/base.pyx":164
 *         elem_data = WriteBuffer.new()
 *         i = 0
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             elem_data.write_int32(<int32_t>self.element_type_oids[i])
 *             if item is None:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":172
 *             i += 1
 * 
 *         record_encode_frame(settings, buf, elem_data, <int32_t>count)             # <<<<<<<<<<<<<<
 * 
 *     cdef encode_in_python(self, ConnectionSettings settings, WriteBuffer buf,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_record_encode_frame(__pyx_v_settings, __pyx_v_buf, __pyx_v_elem_data, ((int32_t)__pyx_v_count)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":125
 *                      <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef encode_composite(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj):
 *         cdef:
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_composite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_data);
  __Pyx_XDECREF(__pyx_v_elem_codecs);
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XDECREF(__pyx_v_field);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":174
 *         record_encode_frame(settings, buf, elem_data, <int32_t>count)
 * 
 *     cdef encode_in_python(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj):
 *         data = self.py_encoder(obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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;
  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("encode_in_python", 0);

  /* "asyncpg/protocol/codecs/base.pyx":176
 *     cdef encode_in_python(self, ConnectionSettings settings, WriteBuffer buf,
 *                           object obj):
 *         data = self.py_encoder(obj)             # <<<<<<<<<<<<<<
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:
 */
  __Pyx_INCREF(__pyx_v_self->py_encoder);
  __pyx_t_2 = __pyx_v_self->py_encoder; __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_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_obj);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":177
 *                           object obj):
 *         data = self.py_encoder(obj)
 *         if self.xformat == PG_XFORMAT_OBJECT:             # <<<<<<<<<<<<<<
 *             if self.format == PG_FORMAT_BINARY:
 *                 pgproto.bytea_encode(settings, buf, data)
 */
  switch (__pyx_v_self->xformat) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT:

    /* "asyncpg/protocol/codecs/base.pyx":178
 *         data = self.py_encoder(obj)
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 pgproto.bytea_encode(settings, buf, data)
 *             elif self.format == PG_FORMAT_TEXT:
 */
    switch (__pyx_v_self->format) {
      case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY:

      /* "asyncpg/protocol/codecs/base.pyx":179
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:
 *                 pgproto.bytea_encode(settings, buf, data)             # <<<<<<<<<<<<<<
 *             elif self.format == PG_FORMAT_TEXT:
 *                 pgproto.text_encode(settings, buf, data)
 */
      __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":178
 *         data = self.py_encoder(obj)
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 pgproto.bytea_encode(settings, buf, data)
 *             elif self.format == PG_FORMAT_TEXT:
 */
      break;
      case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT:

      /* "asyncpg/protocol/codecs/base.pyx":181
 *                 pgproto.bytea_encode(settings, buf, data)
 *             elif self.format == PG_FORMAT_TEXT:
 *                 pgproto.text_encode(settings, buf, data)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise exceptions.InternalClientError(
 */
      __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_text_encode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":180
 *             if self.format == PG_FORMAT_BINARY:
 *                 pgproto.bytea_encode(settings, buf, data)
 *             elif self.format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                 pgproto.text_encode(settings, buf, data)
 *             else:
 */
      break;
      default:

      /* "asyncpg/protocol/codecs/base.pyx":183
 *                 pgproto.text_encode(settings, buf, data)
 *             else:
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":184
 *             else:
 *                 raise exceptions.InternalClientError(
 *                     'unexpected data format: {}'.format(self.format))             # <<<<<<<<<<<<<<
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 *             self.c_encoder(settings, buf, data)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_data_format, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 184, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_self->format); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 184, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_2 = (__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_2)) __PYX_ERR(4, 184, __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(4, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(4, 183, __pyx_L1_error)
      break;
    }

    /* "asyncpg/protocol/codecs/base.pyx":177
 *                           object obj):
 *         data = self.py_encoder(obj)
 *         if self.xformat == PG_XFORMAT_OBJECT:             # <<<<<<<<<<<<<<
 *             if self.format == PG_FORMAT_BINARY:
 *                 pgproto.bytea_encode(settings, buf, data)
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE:

    /* "asyncpg/protocol/codecs/base.pyx":186
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 *             self.c_encoder(settings, buf, data)             # <<<<<<<<<<<<<<
 *         else:
 *             raise exceptions.InternalClientError(
 */
    __pyx_t_1 = __pyx_v_self->c_encoder(__pyx_v_settings, __pyx_v_buf, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":185
 *                 raise exceptions.InternalClientError(
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:             # <<<<<<<<<<<<<<
 *             self.c_encoder(settings, buf, data)
 *         else:
 */
    break;
    default:

    /* "asyncpg/protocol/codecs/base.pyx":188
 *             self.c_encoder(settings, buf, data)
 *         else:
 *             raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                 'unexpected exchange format: {}'.format(self.xformat))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":189
 *         else:
 *             raise exceptions.InternalClientError(
 *                 'unexpected exchange format: {}'.format(self.xformat))             # <<<<<<<<<<<<<<
 * 
 *     cdef encode(self, ConnectionSettings settings, WriteBuffer buf,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_exchange_format, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_v_self->xformat); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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(4, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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(4, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 188, __pyx_L1_error)
    break;
  }

  /* "asyncpg/protocol/codecs/base.pyx":174
 *         record_encode_frame(settings, buf, elem_data, <int32_t>count)
 * 
 *     cdef encode_in_python(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj):
 *         data = self.py_encoder(obj)
 */

  /* 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_6);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.encode_in_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":191
 *                 'unexpected exchange format: {}'.format(self.xformat))
 * 
 *     cdef encode(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                 object obj):
 *         return self.encoder(self, settings, buf, obj)
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj) {
  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("encode", 0);

  /* "asyncpg/protocol/codecs/base.pyx":193
 *     cdef encode(self, ConnectionSettings settings, WriteBuffer buf,
 *                 object obj):
 *         return self.encoder(self, settings, buf, obj)             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_scalar(self, ConnectionSettings settings, FRBuffer *buf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->encoder(__pyx_v_self, __pyx_v_settings, __pyx_v_buf, __pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":191
 *                 'unexpected exchange format: {}'.format(self.xformat))
 * 
 *     cdef encode(self, ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                 object obj):
 *         return self.encoder(self, settings, buf, obj)
 */

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

/* "asyncpg/protocol/codecs/base.pyx":195
 *         return self.encoder(self, settings, buf, obj)
 * 
 *     cdef decode_scalar(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return self.c_decoder(settings, buf)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_scalar(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("decode_scalar", 0);

  /* "asyncpg/protocol/codecs/base.pyx":196
 * 
 *     cdef decode_scalar(self, ConnectionSettings settings, FRBuffer *buf):
 *         return self.c_decoder(settings, buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_array(self, ConnectionSettings settings, FRBuffer *buf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->c_decoder(__pyx_v_settings, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":195
 *         return self.encoder(self, settings, buf, obj)
 * 
 *     cdef decode_scalar(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return self.c_decoder(settings, buf)
 * 
 */

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

/* "asyncpg/protocol/codecs/base.pyx":198
 *         return self.c_decoder(settings, buf)
 * 
 *     cdef decode_array(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return array_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("decode_array", 0);

  /* "asyncpg/protocol/codecs/base.pyx":199
 * 
 *     cdef decode_array(self, ConnectionSettings settings, FRBuffer *buf):
 *         return array_decode(settings, buf, codec_decode_func_ex,             # <<<<<<<<<<<<<<
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/codecs/base.pyx":200
 *     cdef decode_array(self, ConnectionSettings settings, FRBuffer *buf):
 *         return array_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_array_text(self, ConnectionSettings settings,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_decode(__pyx_v_settings, __pyx_v_buf, __pyx_f_7asyncpg_8protocol_8protocol_codec_decode_func_ex, ((void *)__pyx_v_self->element_codec)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":198
 *         return self.c_decoder(settings, buf)
 * 
 *     cdef decode_array(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return array_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))
 */

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

/* "asyncpg/protocol/codecs/base.pyx":202
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef decode_array_text(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                            FRBuffer *buf):
 *         return textarray_decode(settings, buf, codec_decode_func_ex,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array_text(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("decode_array_text", 0);

  /* "asyncpg/protocol/codecs/base.pyx":204
 *     cdef decode_array_text(self, ConnectionSettings settings,
 *                            FRBuffer *buf):
 *         return textarray_decode(settings, buf, codec_decode_func_ex,             # <<<<<<<<<<<<<<
 *                                 <void*>(<cpython.PyObject>self.element_codec),
 *                                 self.element_delimiter)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/codecs/base.pyx":206
 *         return textarray_decode(settings, buf, codec_decode_func_ex,
 *                                 <void*>(<cpython.PyObject>self.element_codec),
 *                                 self.element_delimiter)             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_range(self, ConnectionSettings settings, FRBuffer *buf):
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_textarray_decode(__pyx_v_settings, __pyx_v_buf, __pyx_f_7asyncpg_8protocol_8protocol_codec_decode_func_ex, ((void *)__pyx_v_self->element_codec), __pyx_v_self->element_delimiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":202
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef decode_array_text(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                            FRBuffer *buf):
 *         return textarray_decode(settings, buf, codec_decode_func_ex,
 */

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

/* "asyncpg/protocol/codecs/base.pyx":208
 *                                 self.element_delimiter)
 * 
 *     cdef decode_range(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return range_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_range(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("decode_range", 0);

  /* "asyncpg/protocol/codecs/base.pyx":209
 * 
 *     cdef decode_range(self, ConnectionSettings settings, FRBuffer *buf):
 *         return range_decode(settings, buf, codec_decode_func_ex,             # <<<<<<<<<<<<<<
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/codecs/base.pyx":210
 *     cdef decode_range(self, ConnectionSettings settings, FRBuffer *buf):
 *         return range_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_composite(self, ConnectionSettings settings,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_range_decode(__pyx_v_settings, __pyx_v_buf, __pyx_f_7asyncpg_8protocol_8protocol_codec_decode_func_ex, ((void *)__pyx_v_self->element_codec)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":208
 *                                 self.element_delimiter)
 * 
 *     cdef decode_range(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return range_decode(settings, buf, codec_decode_func_ex,
 *                             <void*>(<cpython.PyObject>self.element_codec))
 */

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

/* "asyncpg/protocol/codecs/base.pyx":212
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef decode_composite(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf):
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_composite(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_elem_count;
  Py_ssize_t __pyx_v_i;
  int32_t __pyx_v_elem_len;
  uint32_t __pyx_v_elem_typ;
  uint32_t __pyx_v_received_elem_typ;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_elem_codec = 0;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_elem_buf;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  uint32_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decode_composite", 0);

  /* "asyncpg/protocol/codecs/base.pyx":224
 *             FRBuffer elem_buf
 * 
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         if elem_count != len(self.element_type_oids):
 *             raise exceptions.OutdatedSchemaCacheError(
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(4, 224, __pyx_L1_error)
  __pyx_v_elem_count = ((Py_ssize_t)((uint32_t)unpack_int32(__pyx_t_1)));

  /* "asyncpg/protocol/codecs/base.pyx":225
 * 
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         if elem_count != len(self.element_type_oids):             # <<<<<<<<<<<<<<
 *             raise exceptions.OutdatedSchemaCacheError(
 *                 'unexpected number of attributes of composite type: '
 */
  __pyx_t_2 = __pyx_v_self->element_type_oids;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 225, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((__pyx_v_elem_count != __pyx_t_3) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "asyncpg/protocol/codecs/base.pyx":226
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         if elem_count != len(self.element_type_oids):
 *             raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                 'unexpected number of attributes of composite type: '
 *                 '{}, expected {}'
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OutdatedSchemaCacheError); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":229
 *                 'unexpected number of attributes of composite type: '
 *                 '{}, expected {}'
 *                     .format(             # <<<<<<<<<<<<<<
 *                         elem_count,
 *                         len(self.element_type_oids),
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_number_of_attributes, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/codecs/base.pyx":230
 *                 '{}, expected {}'
 *                     .format(
 *                         elem_count,             # <<<<<<<<<<<<<<
 *                         len(self.element_type_oids),
 *                     ),
 */
    __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_elem_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "asyncpg/protocol/codecs/base.pyx":231
 *                     .format(
 *                         elem_count,
 *                         len(self.element_type_oids),             # <<<<<<<<<<<<<<
 *                     ),
 *                 schema=self.schema,
 */
    __pyx_t_8 = __pyx_v_self->element_type_oids;
    __Pyx_INCREF(__pyx_t_8);
    if (unlikely(__pyx_t_8 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(4, 231, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_8); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 231, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 229, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 229, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":226
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         if elem_count != len(self.element_type_oids):
 *             raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                 'unexpected number of attributes of composite type: '
 *                 '{}, expected {}'
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":233
 *                         len(self.element_type_oids),
 *                     ),
 *                 schema=self.schema,             # <<<<<<<<<<<<<<
 *                 data_type=self.name,
 *             )
 */
    __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_schema, __pyx_v_self->schema) < 0) __PYX_ERR(4, 233, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":234
 *                     ),
 *                 schema=self.schema,
 *                 data_type=self.name,             # <<<<<<<<<<<<<<
 *             )
 *         result = record.ApgRecord_New(asyncpg.Record, self.record_desc, elem_count)
 */
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data_type, __pyx_v_self->name) < 0) __PYX_ERR(4, 233, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":226
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         if elem_count != len(self.element_type_oids):
 *             raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                 'unexpected number of attributes of composite type: '
 *                 '{}, expected {}'
 */
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_11, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __PYX_ERR(4, 226, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":225
 * 
 *         elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         if elem_count != len(self.element_type_oids):             # <<<<<<<<<<<<<<
 *             raise exceptions.OutdatedSchemaCacheError(
 *                 'unexpected number of attributes of composite type: '
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":236
 *                 data_type=self.name,
 *             )
 *         result = record.ApgRecord_New(asyncpg.Record, self.record_desc, elem_count)             # <<<<<<<<<<<<<<
 *         for i in range(elem_count):
 *             elem_typ = self.element_type_oids[i]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_asyncpg); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_Record); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (!(likely(PyType_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "type", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(4, 236, __pyx_L1_error)
  __pyx_t_11 = __pyx_v_self->record_desc;
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_6 = ApgRecord_New(((PyTypeObject*)__pyx_t_2), __pyx_t_11, __pyx_v_elem_count); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_result = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":237
 *             )
 *         result = record.ApgRecord_New(asyncpg.Record, self.record_desc, elem_count)
 *         for i in range(elem_count):             # <<<<<<<<<<<<<<
 *             elem_typ = self.element_type_oids[i]
 *             received_elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 */
  __pyx_t_12 = __pyx_v_elem_count;
  __pyx_t_13 = __pyx_t_12;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "asyncpg/protocol/codecs/base.pyx":238
 *         result = record.ApgRecord_New(asyncpg.Record, self.record_desc, elem_count)
 *         for i in range(elem_count):
 *             elem_typ = self.element_type_oids[i]             # <<<<<<<<<<<<<<
 *             received_elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 * 
 */
    if (unlikely(__pyx_v_self->element_type_oids == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 238, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_self->element_type_oids, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_15 = __Pyx_PyInt_As_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_15 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 238, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_elem_typ = __pyx_t_15;

    /* "asyncpg/protocol/codecs/base.pyx":239
 *         for i in range(elem_count):
 *             elem_typ = self.element_type_oids[i]
 *             received_elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 * 
 *             if received_elem_typ != elem_typ:
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(4, 239, __pyx_L1_error)
    __pyx_v_received_elem_typ = ((uint32_t)unpack_int32(__pyx_t_1));

    /* "asyncpg/protocol/codecs/base.pyx":241
 *             received_elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 * 
 *             if received_elem_typ != elem_typ:             # <<<<<<<<<<<<<<
 *                 raise exceptions.OutdatedSchemaCacheError(
 *                     'unexpected data type of composite type attribute {}: '
 */
    __pyx_t_4 = ((__pyx_v_received_elem_typ != __pyx_v_elem_typ) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "asyncpg/protocol/codecs/base.pyx":242
 * 
 *             if received_elem_typ != elem_typ:
 *                 raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                     'unexpected data type of composite type attribute {}: '
 *                     '{!r}, expected {!r}'
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_OutdatedSchemaCacheError); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":245
 *                     'unexpected data type of composite type attribute {}: '
 *                     '{!r}, expected {!r}'
 *                         .format(             # <<<<<<<<<<<<<<
 *                             i,
 *                             BUILTIN_TYPE_OID_MAP.get(
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_data_type_of_composit, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "asyncpg/protocol/codecs/base.pyx":246
 *                     '{!r}, expected {!r}'
 *                         .format(
 *                             i,             # <<<<<<<<<<<<<<
 *                             BUILTIN_TYPE_OID_MAP.get(
 *                                 received_elem_typ, received_elem_typ),
 */
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "asyncpg/protocol/codecs/base.pyx":247
 *                         .format(
 *                             i,
 *                             BUILTIN_TYPE_OID_MAP.get(             # <<<<<<<<<<<<<<
 *                                 received_elem_typ, received_elem_typ),
 *                             BUILTIN_TYPE_OID_MAP.get(
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_BUILTIN_TYPE_OID_MAP); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":248
 *                             i,
 *                             BUILTIN_TYPE_OID_MAP.get(
 *                                 received_elem_typ, received_elem_typ),             # <<<<<<<<<<<<<<
 *                             BUILTIN_TYPE_OID_MAP.get(
 *                                 elem_typ, elem_typ)
 */
      __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_received_elem_typ); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_16 = __Pyx_PyInt_From_uint32_t(__pyx_v_received_elem_typ); if (unlikely(!__pyx_t_16)) __PYX_ERR(4, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_17 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_17)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_7, __pyx_t_16};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_7, __pyx_t_16};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      {
        __pyx_t_18 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_18);
        if (__pyx_t_17) {
          __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_10, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_10, __pyx_t_16);
        __pyx_t_7 = 0;
        __pyx_t_16 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_18, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":249
 *                             BUILTIN_TYPE_OID_MAP.get(
 *                                 received_elem_typ, received_elem_typ),
 *                             BUILTIN_TYPE_OID_MAP.get(             # <<<<<<<<<<<<<<
 *                                 elem_typ, elem_typ)
 *                         ),
 */
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_BUILTIN_TYPE_OID_MAP); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_get); if (unlikely(!__pyx_t_16)) __PYX_ERR(4, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":250
 *                                 received_elem_typ, received_elem_typ),
 *                             BUILTIN_TYPE_OID_MAP.get(
 *                                 elem_typ, elem_typ)             # <<<<<<<<<<<<<<
 *                         ),
 *                     schema=self.schema,
 */
      __pyx_t_18 = __Pyx_PyInt_From_uint32_t(__pyx_v_elem_typ); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_elem_typ); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_17)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_18, __pyx_t_7};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_18, __pyx_t_7};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        if (__pyx_t_17) {
          __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_18);
        PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_t_18);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_7);
        __pyx_t_18 = 0;
        __pyx_t_7 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_16)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_5, __pyx_t_8, __pyx_t_9};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_5, __pyx_t_8, __pyx_t_9};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_19 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        if (__pyx_t_16) {
          __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16); __pyx_t_16 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_10, __pyx_t_9);
        __pyx_t_5 = 0;
        __pyx_t_8 = 0;
        __pyx_t_9 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":242
 * 
 *             if received_elem_typ != elem_typ:
 *                 raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                     'unexpected data type of composite type attribute {}: '
 *                     '{!r}, expected {!r}'
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":252
 *                                 elem_typ, elem_typ)
 *                         ),
 *                     schema=self.schema,             # <<<<<<<<<<<<<<
 *                     data_type=self.name,
 *                     position=i,
 */
      __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_schema, __pyx_v_self->schema) < 0) __PYX_ERR(4, 252, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":253
 *                         ),
 *                     schema=self.schema,
 *                     data_type=self.name,             # <<<<<<<<<<<<<<
 *                     position=i,
 *                 )
 */
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data_type, __pyx_v_self->name) < 0) __PYX_ERR(4, 252, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":254
 *                     schema=self.schema,
 *                     data_type=self.name,
 *                     position=i,             # <<<<<<<<<<<<<<
 *                 )
 * 
 */
      __pyx_t_19 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_position, __pyx_t_19) < 0) __PYX_ERR(4, 252, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":242
 * 
 *             if received_elem_typ != elem_typ:
 *                 raise exceptions.OutdatedSchemaCacheError(             # <<<<<<<<<<<<<<
 *                     'unexpected data type of composite type attribute {}: '
 *                     '{!r}, expected {!r}'
 */
      __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_19, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __PYX_ERR(4, 242, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":241
 *             received_elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 * 
 *             if received_elem_typ != elem_typ:             # <<<<<<<<<<<<<<
 *                 raise exceptions.OutdatedSchemaCacheError(
 *                     'unexpected data type of composite type attribute {}: '
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":257
 *                 )
 * 
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *             if elem_len == -1:
 *                 elem = None
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(4, 257, __pyx_L1_error)
    __pyx_v_elem_len = unpack_int32(__pyx_t_1);

    /* "asyncpg/protocol/codecs/base.pyx":258
 * 
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:             # <<<<<<<<<<<<<<
 *                 elem = None
 *             else:
 */
    __pyx_t_4 = ((__pyx_v_elem_len == -1L) != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":259
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:
 *                 elem = None             # <<<<<<<<<<<<<<
 *             else:
 *                 elem_codec = self.element_codecs[i]
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_elem, Py_None);

      /* "asyncpg/protocol/codecs/base.pyx":258
 * 
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:             # <<<<<<<<<<<<<<
 *                 elem = None
 *             else:
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":261
 *                 elem = None
 *             else:
 *                 elem_codec = self.element_codecs[i]             # <<<<<<<<<<<<<<
 *                 elem = elem_codec.decode(
 *                     settings, frb_slice_from(&elem_buf, buf, elem_len))
 */
    /*else*/ {
      if (unlikely(__pyx_v_self->element_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 261, __pyx_L1_error)
      }
      __pyx_t_19 = __Pyx_GetItemInt_List(__pyx_v_self->element_codecs, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      if (!(likely(((__pyx_t_19) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_19, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 261, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_19));
      __pyx_t_19 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":262
 *             else:
 *                 elem_codec = self.element_codecs[i]
 *                 elem = elem_codec.decode(             # <<<<<<<<<<<<<<
 *                     settings, frb_slice_from(&elem_buf, buf, elem_len))
 * 
 */
      __pyx_t_19 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(__pyx_v_elem_codec, __pyx_v_settings, __pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from((&__pyx_v_elem_buf), __pyx_v_buf, __pyx_v_elem_len)); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_19);
      __pyx_t_19 = 0;
    }
    __pyx_L7:;

    /* "asyncpg/protocol/codecs/base.pyx":265
 *                     settings, frb_slice_from(&elem_buf, buf, elem_len))
 * 
 *             cpython.Py_INCREF(elem)             # <<<<<<<<<<<<<<
 *             record.ApgRecord_SET_ITEM(result, i, elem)
 * 
 */
    Py_INCREF(__pyx_v_elem);

    /* "asyncpg/protocol/codecs/base.pyx":266
 * 
 *             cpython.Py_INCREF(elem)
 *             record.ApgRecord_SET_ITEM(result, i, elem)             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    ApgRecord_SET_ITEM(__pyx_v_result, __pyx_v_i, __pyx_v_elem);
  }

  /* "asyncpg/protocol/codecs/base.pyx":268
 *             record.ApgRecord_SET_ITEM(result, i, elem)
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     cdef decode_in_python(self, ConnectionSettings settings,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":212
 *                             <void*>(<cpython.PyObject>self.element_codec))
 * 
 *     cdef decode_composite(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.decode_composite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_codec);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":270
 *         return result
 * 
 *     cdef decode_in_python(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_in_python(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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;
  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("decode_in_python", 0);

  /* "asyncpg/protocol/codecs/base.pyx":272
 *     cdef decode_in_python(self, ConnectionSettings settings,
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:             # <<<<<<<<<<<<<<
 *             if self.format == PG_FORMAT_BINARY:
 *                 data = pgproto.bytea_decode(settings, buf)
 */
  switch (__pyx_v_self->xformat) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT:

    /* "asyncpg/protocol/codecs/base.pyx":273
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 data = pgproto.bytea_decode(settings, buf)
 *             elif self.format == PG_FORMAT_TEXT:
 */
    switch (__pyx_v_self->format) {
      case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY:

      /* "asyncpg/protocol/codecs/base.pyx":274
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:
 *                 data = pgproto.bytea_decode(settings, buf)             # <<<<<<<<<<<<<<
 *             elif self.format == PG_FORMAT_TEXT:
 *                 data = pgproto.text_decode(settings, buf)
 */
      __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_data = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":273
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:
 *             if self.format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 data = pgproto.bytea_decode(settings, buf)
 *             elif self.format == PG_FORMAT_TEXT:
 */
      break;
      case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT:

      /* "asyncpg/protocol/codecs/base.pyx":276
 *                 data = pgproto.bytea_decode(settings, buf)
 *             elif self.format == PG_FORMAT_TEXT:
 *                 data = pgproto.text_decode(settings, buf)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise exceptions.InternalClientError(
 */
      __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_text_decode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_data = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":275
 *             if self.format == PG_FORMAT_BINARY:
 *                 data = pgproto.bytea_decode(settings, buf)
 *             elif self.format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                 data = pgproto.text_decode(settings, buf)
 *             else:
 */
      break;
      default:

      /* "asyncpg/protocol/codecs/base.pyx":278
 *                 data = pgproto.text_decode(settings, buf)
 *             else:
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":279
 *             else:
 *                 raise exceptions.InternalClientError(
 *                     'unexpected data format: {}'.format(self.format))             # <<<<<<<<<<<<<<
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 *             data = self.c_decoder(settings, buf)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_data_format, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_self->format); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_2 = (__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_2)) __PYX_ERR(4, 279, __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(4, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(4, 278, __pyx_L1_error)
      break;
    }

    /* "asyncpg/protocol/codecs/base.pyx":272
 *     cdef decode_in_python(self, ConnectionSettings settings,
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:             # <<<<<<<<<<<<<<
 *             if self.format == PG_FORMAT_BINARY:
 *                 data = pgproto.bytea_decode(settings, buf)
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE:

    /* "asyncpg/protocol/codecs/base.pyx":281
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:
 *             data = self.c_decoder(settings, buf)             # <<<<<<<<<<<<<<
 *         else:
 *             raise exceptions.InternalClientError(
 */
    __pyx_t_1 = __pyx_v_self->c_decoder(__pyx_v_settings, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_data = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":280
 *                 raise exceptions.InternalClientError(
 *                     'unexpected data format: {}'.format(self.format))
 *         elif self.xformat == PG_XFORMAT_TUPLE:             # <<<<<<<<<<<<<<
 *             data = self.c_decoder(settings, buf)
 *         else:
 */
    break;
    default:

    /* "asyncpg/protocol/codecs/base.pyx":283
 *             data = self.c_decoder(settings, buf)
 *         else:
 *             raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                 'unexpected exchange format: {}'.format(self.xformat))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":284
 *         else:
 *             raise exceptions.InternalClientError(
 *                 'unexpected exchange format: {}'.format(self.xformat))             # <<<<<<<<<<<<<<
 * 
 *         return self.py_decoder(data)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_exchange_format, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_v_self->xformat); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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(4, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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(4, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 283, __pyx_L1_error)
    break;
  }

  /* "asyncpg/protocol/codecs/base.pyx":286
 *                 'unexpected exchange format: {}'.format(self.xformat))
 * 
 *         return self.py_decoder(data)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline decode(self, ConnectionSettings settings, FRBuffer *buf):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->py_decoder);
  __pyx_t_2 = __pyx_v_self->py_decoder; __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_data) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_data);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 286, __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;

  /* "asyncpg/protocol/codecs/base.pyx":270
 *         return result
 * 
 *     cdef decode_in_python(self, ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf):
 *         if self.xformat == PG_XFORMAT_OBJECT:
 */

  /* 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("asyncpg.protocol.protocol.Codec.decode_in_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":288
 *         return self.py_decoder(data)
 * 
 *     cdef inline decode(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return self.decoder(self, settings, buf)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("decode", 0);

  /* "asyncpg/protocol/codecs/base.pyx":289
 * 
 *     cdef inline decode(self, ConnectionSettings settings, FRBuffer *buf):
 *         return self.decoder(self, settings, buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline has_encoder(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->decoder(__pyx_v_self, __pyx_v_settings, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":288
 *         return self.py_decoder(data)
 * 
 *     cdef inline decode(self, ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *         return self.decoder(self, settings, buf)
 * 
 */

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

/* "asyncpg/protocol/codecs/base.pyx":291
 *         return self.decoder(self, settings, buf)
 * 
 *     cdef inline has_encoder(self):             # <<<<<<<<<<<<<<
 *         cdef Codec elem_codec
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_elem_codec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_encoder", 0);

  /* "asyncpg/protocol/codecs/base.pyx":294
 *         cdef Codec elem_codec
 * 
 *         if self.c_encoder is not NULL or self.py_encoder is not None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->c_encoder != NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->py_encoder != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":295
 * 
 *         if self.c_encoder is not NULL or self.py_encoder is not None:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":294
 *         cdef Codec elem_codec
 * 
 *         if self.c_encoder is not NULL or self.py_encoder is not None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":297
 *             return True
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:             # <<<<<<<<<<<<<<
 *             return self.element_codec.has_encoder()
 * 
 */
  switch (__pyx_v_self->type) {
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_ARRAY:
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_RANGE:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":298
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:
 *             return self.element_codec.has_encoder()             # <<<<<<<<<<<<<<
 * 
 *         elif self.type == CODEC_COMPOSITE:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(__pyx_v_self->element_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":297
 *             return True
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:             # <<<<<<<<<<<<<<
 *             return self.element_codec.has_encoder()
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":300
 *             return self.element_codec.has_encoder()
 * 
 *         elif self.type == CODEC_COMPOSITE:             # <<<<<<<<<<<<<<
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_encoder():
 */
  __pyx_t_1 = ((__pyx_v_self->type == __pyx_e_7asyncpg_8protocol_8protocol_CODEC_COMPOSITE) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":301
 * 
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:             # <<<<<<<<<<<<<<
 *                 if not elem_codec.has_encoder():
 *                     return False
 */
    if (unlikely(__pyx_v_self->element_codecs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(4, 301, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_v_self->element_codecs; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    for (;;) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(4, 301, __pyx_L1_error)
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 301, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":302
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_encoder():             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      __pyx_t_6 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(__pyx_v_elem_codec); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 302, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = ((!__pyx_t_1) != 0);
      if (__pyx_t_3) {

        /* "asyncpg/protocol/codecs/base.pyx":303
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_encoder():
 *                     return False             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;

        /* "asyncpg/protocol/codecs/base.pyx":302
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_encoder():             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":301
 * 
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:             # <<<<<<<<<<<<<<
 *                 if not elem_codec.has_encoder():
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":304
 *                 if not elem_codec.has_encoder():
 *                     return False
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":300
 *             return self.element_codec.has_encoder()
 * 
 *         elif self.type == CODEC_COMPOSITE:             # <<<<<<<<<<<<<<
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_encoder():
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":307
 * 
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef has_decoder(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/codecs/base.pyx":291
 *         return self.decoder(self, settings, buf)
 * 
 *     cdef inline has_encoder(self):             # <<<<<<<<<<<<<<
 *         cdef Codec elem_codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.has_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_codec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":309
 *             return False
 * 
 *     cdef has_decoder(self):             # <<<<<<<<<<<<<<
 *         cdef Codec elem_codec
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_elem_codec = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_decoder", 0);

  /* "asyncpg/protocol/codecs/base.pyx":312
 *         cdef Codec elem_codec
 * 
 *         if self.c_decoder is not NULL or self.py_decoder is not None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->c_decoder != NULL) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->py_decoder != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":313
 * 
 *         if self.c_decoder is not NULL or self.py_decoder is not None:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":312
 *         cdef Codec elem_codec
 * 
 *         if self.c_decoder is not NULL or self.py_decoder is not None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":315
 *             return True
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:             # <<<<<<<<<<<<<<
 *             return self.element_codec.has_decoder()
 * 
 */
  switch (__pyx_v_self->type) {
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_ARRAY:
    case __pyx_e_7asyncpg_8protocol_8protocol_CODEC_RANGE:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":316
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:
 *             return self.element_codec.has_decoder()             # <<<<<<<<<<<<<<
 * 
 *         elif self.type == CODEC_COMPOSITE:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(__pyx_v_self->element_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":315
 *             return True
 * 
 *         elif self.type == CODEC_ARRAY or self.type == CODEC_RANGE:             # <<<<<<<<<<<<<<
 *             return self.element_codec.has_decoder()
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":318
 *             return self.element_codec.has_decoder()
 * 
 *         elif self.type == CODEC_COMPOSITE:             # <<<<<<<<<<<<<<
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_decoder():
 */
  __pyx_t_1 = ((__pyx_v_self->type == __pyx_e_7asyncpg_8protocol_8protocol_CODEC_COMPOSITE) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":319
 * 
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:             # <<<<<<<<<<<<<<
 *                 if not elem_codec.has_decoder():
 *                     return False
 */
    if (unlikely(__pyx_v_self->element_codecs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(4, 319, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_v_self->element_codecs; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    for (;;) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(4, 319, __pyx_L1_error)
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 319, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":320
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_decoder():             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      __pyx_t_6 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(__pyx_v_elem_codec); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 320, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = ((!__pyx_t_1) != 0);
      if (__pyx_t_3) {

        /* "asyncpg/protocol/codecs/base.pyx":321
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_decoder():
 *                     return False             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;

        /* "asyncpg/protocol/codecs/base.pyx":320
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_decoder():             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":319
 * 
 *         elif self.type == CODEC_COMPOSITE:
 *             for elem_codec in self.element_codecs:             # <<<<<<<<<<<<<<
 *                 if not elem_codec.has_decoder():
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":322
 *                 if not elem_codec.has_decoder():
 *                     return False
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":318
 *             return self.element_codec.has_decoder()
 * 
 *         elif self.type == CODEC_COMPOSITE:             # <<<<<<<<<<<<<<
 *             for elem_codec in self.element_codecs:
 *                 if not elem_codec.has_decoder():
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":325
 * 
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef is_binary(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/codecs/base.pyx":309
 *             return False
 * 
 *     cdef has_decoder(self):             # <<<<<<<<<<<<<<
 *         cdef Codec elem_codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.has_decoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_codec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":327
 *             return False
 * 
 *     cdef is_binary(self):             # <<<<<<<<<<<<<<
 *         return self.format == PG_FORMAT_BINARY
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_is_binary(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__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("is_binary", 0);

  /* "asyncpg/protocol/codecs/base.pyx":328
 * 
 *     cdef is_binary(self):
 *         return self.format == PG_FORMAT_BINARY             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":327
 *             return False
 * 
 *     cdef is_binary(self):             # <<<<<<<<<<<<<<
 *         return self.format == PG_FORMAT_BINARY
 * 
 */

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

/* "asyncpg/protocol/codecs/base.pyx":330
 *         return self.format == PG_FORMAT_BINARY
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Codec oid={} elem_oid={} core={}>'.format(
 *             self.oid,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Codec_2__repr__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_2__repr__(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__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_t_5;
  PyObject *__pyx_t_6 = NULL;
  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_RefNannySetupContext("__repr__", 0);

  /* "asyncpg/protocol/codecs/base.pyx":331
 * 
 *     def __repr__(self):
 *         return '<Codec oid={} elem_oid={} core={}>'.format(             # <<<<<<<<<<<<<<
 *             self.oid,
 *             'NA' if self.element_codec is None else self.element_codec.oid,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Codec_oid_elem_oid_core, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asyncpg/protocol/codecs/base.pyx":332
 *     def __repr__(self):
 *         return '<Codec oid={} elem_oid={} core={}>'.format(
 *             self.oid,             # <<<<<<<<<<<<<<
 *             'NA' if self.element_codec is None else self.element_codec.oid,
 *             has_core_codec(self.oid))
 */
  __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->oid); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asyncpg/protocol/codecs/base.pyx":333
 *         return '<Codec oid={} elem_oid={} core={}>'.format(
 *             self.oid,
 *             'NA' if self.element_codec is None else self.element_codec.oid,             # <<<<<<<<<<<<<<
 *             has_core_codec(self.oid))
 * 
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_self->element_codec) == Py_None);
  if ((__pyx_t_5 != 0)) {
    __Pyx_INCREF(__pyx_n_u_NA);
    __pyx_t_4 = __pyx_n_u_NA;
  } else {
    __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->element_codec->oid); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __pyx_t_6;
    __pyx_t_6 = 0;
  }

  /* "asyncpg/protocol/codecs/base.pyx":334
 *             self.oid,
 *             'NA' if self.element_codec is None else self.element_codec.oid,
 *             has_core_codec(self.oid))             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_f_7asyncpg_8protocol_8protocol_has_core_codec(__pyx_v_self->oid)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 331, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 331, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":330
 *         return self.format == PG_FORMAT_BINARY
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Codec oid={} elem_oid={} core={}>'.format(
 *             self.oid,
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":337
 * 
 *     @staticmethod
 *     cdef Codec new_array_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                str name,
 *                                str schema,
 */

static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_array_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec, Py_UCS4 __pyx_v_element_delimiter) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_array_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":343
 *                                Py_UCS4 element_delimiter):
 *         cdef Codec codec
 *         codec = Codec(oid)             # <<<<<<<<<<<<<<
 *         codec.init(name, schema, 'array', CODEC_ARRAY, element_codec.format,
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":344
 *         cdef Codec codec
 *         codec = Codec(oid)
 *         codec.init(name, schema, 'array', CODEC_ARRAY, element_codec.format,             # <<<<<<<<<<<<<<
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 *                    None, None, None, element_delimiter)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, __pyx_v_schema, __pyx_n_u_array, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_ARRAY, __pyx_v_element_codec->format, __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT, NULL, NULL, Py_None, Py_None, __pyx_v_element_codec, ((PyObject*)Py_None), Py_None, ((PyObject*)Py_None), __pyx_v_element_delimiter); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":347
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 *                    None, None, None, element_delimiter)
 *         return codec             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":337
 * 
 *     @staticmethod
 *     cdef Codec new_array_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                str name,
 *                                str schema,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.new_array_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":350
 * 
 *     @staticmethod
 *     cdef Codec new_range_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                str name,
 *                                str schema,
 */

static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_range_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_element_codec) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_range_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":355
 *                                Codec element_codec):
 *         cdef Codec codec
 *         codec = Codec(oid)             # <<<<<<<<<<<<<<
 *         codec.init(name, schema, 'range', CODEC_RANGE, element_codec.format,
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":356
 *         cdef Codec codec
 *         codec = Codec(oid)
 *         codec.init(name, schema, 'range', CODEC_RANGE, element_codec.format,             # <<<<<<<<<<<<<<
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 *                    None, None, None, 0)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, __pyx_v_schema, __pyx_n_u_range, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_RANGE, __pyx_v_element_codec->format, __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT, NULL, NULL, Py_None, Py_None, __pyx_v_element_codec, ((PyObject*)Py_None), Py_None, ((PyObject*)Py_None), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":359
 *                    PG_XFORMAT_OBJECT, NULL, NULL, None, None, element_codec,
 *                    None, None, None, 0)
 *         return codec             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":350
 * 
 *     @staticmethod
 *     cdef Codec new_range_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                str name,
 *                                str schema,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.new_range_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":362
 * 
 *     @staticmethod
 *     cdef Codec new_composite_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                    str name,
 *                                    str schema,
 */

static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_composite_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, PyObject *__pyx_v_element_codecs, PyObject *__pyx_v_element_type_oids, PyObject *__pyx_v_element_names) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_composite_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":370
 *                                    object element_names):
 *         cdef Codec codec
 *         codec = Codec(oid)             # <<<<<<<<<<<<<<
 *         codec.init(name, schema, 'composite', CODEC_COMPOSITE,
 *                    format, PG_XFORMAT_OBJECT, NULL, NULL, None, None, None,
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":371
 *         cdef Codec codec
 *         codec = Codec(oid)
 *         codec.init(name, schema, 'composite', CODEC_COMPOSITE,             # <<<<<<<<<<<<<<
 *                    format, PG_XFORMAT_OBJECT, NULL, NULL, None, None, None,
 *                    element_type_oids, element_names, element_codecs, 0)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, __pyx_v_schema, __pyx_n_u_composite, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_COMPOSITE, __pyx_v_format, __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT, NULL, NULL, Py_None, Py_None, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None), __pyx_v_element_type_oids, __pyx_v_element_names, __pyx_v_element_codecs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":374
 *                    format, PG_XFORMAT_OBJECT, NULL, NULL, None, None, None,
 *                    element_type_oids, element_names, element_codecs, 0)
 *         return codec             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":362
 * 
 *     @staticmethod
 *     cdef Codec new_composite_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                    str name,
 *                                    str schema,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.new_composite_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":377
 * 
 *     @staticmethod
 *     cdef Codec new_python_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                 str name,
 *                                 str schema,
 */

static struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_python_codec(uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema, PyObject *__pyx_v_kind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_c_encoder, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_c_decoder, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_python_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":388
 *                                 ClientExchangeFormat xformat):
 *         cdef Codec codec
 *         codec = Codec(oid)             # <<<<<<<<<<<<<<
 *         codec.init(name, schema, kind, CODEC_PY, format, xformat,
 *                    c_encoder, c_decoder, encoder, decoder,
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":389
 *         cdef Codec codec
 *         codec = Codec(oid)
 *         codec.init(name, schema, kind, CODEC_PY, format, xformat,             # <<<<<<<<<<<<<<
 *                    c_encoder, c_decoder, encoder, decoder,
 *                    None, None, None, None, 0)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, __pyx_v_schema, __pyx_v_kind, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_PY, __pyx_v_format, __pyx_v_xformat, __pyx_v_c_encoder, __pyx_v_c_decoder, __pyx_v_encoder, __pyx_v_decoder, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None), ((PyObject*)Py_None), Py_None, ((PyObject*)Py_None), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":392
 *                    c_encoder, c_decoder, encoder, decoder,
 *                    None, None, None, None, 0)
 *         return codec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":377
 * 
 *     @staticmethod
 *     cdef Codec new_python_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                                 str name,
 *                                 str schema,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Codec.new_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__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_7asyncpg_8protocol_8protocol_5Codec_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_5__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_7asyncpg_8protocol_8protocol_5Codec_4__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__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__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.Codec.__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_7asyncpg_8protocol_8protocol_5Codec_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_7__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_7asyncpg_8protocol_8protocol_5Codec_6__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Codec_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__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__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.Codec.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":396
 * 
 * # Encode callback for arrays
 * cdef codec_encode_func_ex(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj, const void *arg):
 *     return (<Codec>arg).encode(settings, buf, obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_codec_encode_func_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, void const *__pyx_v_arg) {
  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("codec_encode_func_ex", 0);

  /* "asyncpg/protocol/codecs/base.pyx":398
 * cdef codec_encode_func_ex(ConnectionSettings settings, WriteBuffer buf,
 *                           object obj, const void *arg):
 *     return (<Codec>arg).encode(settings, buf, obj)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_arg), __pyx_v_settings, __pyx_v_buf, __pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":396
 * 
 * # Encode callback for arrays
 * cdef codec_encode_func_ex(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                           object obj, const void *arg):
 *     return (<Codec>arg).encode(settings, buf, obj)
 */

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

/* "asyncpg/protocol/codecs/base.pyx":402
 * 
 * # Decode callback for arrays
 * cdef codec_decode_func_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                           const void *arg):
 *     return (<Codec>arg).decode(settings, buf)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_codec_decode_func_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, void const *__pyx_v_arg) {
  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("codec_decode_func_ex", 0);

  /* "asyncpg/protocol/codecs/base.pyx":404
 * cdef codec_decode_func_ex(ConnectionSettings settings, FRBuffer *buf,
 *                           const void *arg):
 *     return (<Codec>arg).decode(settings, buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_arg), __pyx_v_settings, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":402
 * 
 * # Decode callback for arrays
 * cdef codec_decode_func_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                           const void *arg):
 *     return (<Codec>arg).decode(settings, buf)
 */

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

/* "asyncpg/protocol/codecs/base.pyx":407
 * 
 * 
 * cdef uint32_t pylong_as_oid(val) except? 0xFFFFFFFFl:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int64_t oid = 0
 */

static uint32_t __pyx_f_7asyncpg_8protocol_8protocol_pylong_as_oid(PyObject *__pyx_v_val) {
  int64_t __pyx_v_oid;
  int __pyx_v_overflow;
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PY_LONG_LONG __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  uint32_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pylong_as_oid", 0);

  /* "asyncpg/protocol/codecs/base.pyx":409
 * cdef uint32_t pylong_as_oid(val) except? 0xFFFFFFFFl:
 *     cdef:
 *         int64_t oid = 0             # <<<<<<<<<<<<<<
 *         bint overflow = False
 * 
 */
  __pyx_v_oid = 0;

  /* "asyncpg/protocol/codecs/base.pyx":410
 *     cdef:
 *         int64_t oid = 0
 *         bint overflow = False             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __pyx_v_overflow = 0;

  /* "asyncpg/protocol/codecs/base.pyx":412
 *         bint overflow = False
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         oid = cpython.PyLong_AsLongLong(val)
 *     except OverflowError:
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/codecs/base.pyx":413
 * 
 *     try:
 *         oid = cpython.PyLong_AsLongLong(val)             # <<<<<<<<<<<<<<
 *     except OverflowError:
 *         overflow = True
 */
      __pyx_t_4 = PyLong_AsLongLong(__pyx_v_val); if (unlikely(__pyx_t_4 == ((PY_LONG_LONG)-1LL) && PyErr_Occurred())) __PYX_ERR(4, 413, __pyx_L3_error)
      __pyx_v_oid = __pyx_t_4;

      /* "asyncpg/protocol/codecs/base.pyx":412
 *         bint overflow = False
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         oid = cpython.PyLong_AsLongLong(val)
 *     except OverflowError:
 */
    }
    __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:;

    /* "asyncpg/protocol/codecs/base.pyx":414
 *     try:
 *         oid = cpython.PyLong_AsLongLong(val)
 *     except OverflowError:             # <<<<<<<<<<<<<<
 *         overflow = True
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.pylong_as_oid", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(4, 414, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "asyncpg/protocol/codecs/base.pyx":415
 *         oid = cpython.PyLong_AsLongLong(val)
 *     except OverflowError:
 *         overflow = True             # <<<<<<<<<<<<<<
 * 
 *     if overflow or (oid < 0 or oid > UINT32_MAX):
 */
      __pyx_v_overflow = 1;
      __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_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asyncpg/protocol/codecs/base.pyx":412
 *         bint overflow = False
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         oid = cpython.PyLong_AsLongLong(val)
 *     except OverflowError:
 */
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "asyncpg/protocol/codecs/base.pyx":417
 *         overflow = True
 * 
 *     if overflow or (oid < 0 or oid > UINT32_MAX):             # <<<<<<<<<<<<<<
 *         raise OverflowError('OID value too large: {!r}'.format(val))
 * 
 */
  __pyx_t_10 = (__pyx_v_overflow != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_9 = __pyx_t_10;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_10 = ((__pyx_v_oid < 0) != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_9 = __pyx_t_10;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_10 = ((__pyx_v_oid > UINT32_MAX) != 0);
  __pyx_t_9 = __pyx_t_10;
  __pyx_L12_bool_binop_done:;
  if (unlikely(__pyx_t_9)) {

    /* "asyncpg/protocol/codecs/base.pyx":418
 * 
 *     if overflow or (oid < 0 or oid > UINT32_MAX):
 *         raise OverflowError('OID value too large: {!r}'.format(val))             # <<<<<<<<<<<<<<
 * 
 *     return <uint32_t>val
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_OID_value_too_large_r, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_val);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_OverflowError, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(4, 418, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":417
 *         overflow = True
 * 
 *     if overflow or (oid < 0 or oid > UINT32_MAX):             # <<<<<<<<<<<<<<
 *         raise OverflowError('OID value too large: {!r}'.format(val))
 * 
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":420
 *         raise OverflowError('OID value too large: {!r}'.format(val))
 * 
 *     return <uint32_t>val             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_11 = __Pyx_PyInt_As_uint32_t(__pyx_v_val); if (unlikely((__pyx_t_11 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 420, __pyx_L1_error)
  __pyx_r = ((uint32_t)__pyx_t_11);
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":407
 * 
 * 
 * cdef uint32_t pylong_as_oid(val) except? 0xFFFFFFFFl:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int64_t oid = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.pylong_as_oid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0xFFFFFFFFL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":424
 * 
 * cdef class DataCodecConfig:
 *     def __init__(self, cache_key):             # <<<<<<<<<<<<<<
 *         # Codec instance cache for derived types:
 *         # composites, arrays, ranges, domains and their combinations.
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_cache_key = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cache_key,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_cache_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(4, 424, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_cache_key = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig___init__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_cache_key);

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

static int __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_cache_key) {
  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("__init__", 0);

  /* "asyncpg/protocol/codecs/base.pyx":427
 *         # Codec instance cache for derived types:
 *         # composites, arrays, ranges, domains and their combinations.
 *         self._derived_type_codecs = {}             # <<<<<<<<<<<<<<
 *         # Codec instances set up by the user for the connection.
 *         self._custom_type_codecs = {}
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_derived_type_codecs);
  __Pyx_DECREF(__pyx_v_self->_derived_type_codecs);
  __pyx_v_self->_derived_type_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":429
 *         self._derived_type_codecs = {}
 *         # Codec instances set up by the user for the connection.
 *         self._custom_type_codecs = {}             # <<<<<<<<<<<<<<
 * 
 *     def add_types(self, types):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_custom_type_codecs);
  __Pyx_DECREF(__pyx_v_self->_custom_type_codecs);
  __pyx_v_self->_custom_type_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":424
 * 
 * cdef class DataCodecConfig:
 *     def __init__(self, cache_key):             # <<<<<<<<<<<<<<
 *         # Codec instance cache for derived types:
 *         # composites, arrays, ranges, domains and their combinations.
 */

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

/* "asyncpg/protocol/codecs/base.pyx":431
 *         self._custom_type_codecs = {}
 * 
 *     def add_types(self, types):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec elem_codec
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_3add_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_3add_types(PyObject *__pyx_v_self, PyObject *__pyx_v_types) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_types (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_2add_types(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), ((PyObject *)__pyx_v_types));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_2add_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_types) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_elem_codec = 0;
  PyObject *__pyx_v_comp_elem_codecs = 0;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_elem_format;
  int __pyx_v_has_text_elements;
  Py_UCS4 __pyx_v_elem_delim;
  PyObject *__pyx_v_ti = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_schema = NULL;
  PyObject *__pyx_v_array_element_oid = NULL;
  PyObject *__pyx_v_range_subtype_oid = NULL;
  PyObject *__pyx_v_comp_type_attrs = NULL;
  PyObject *__pyx_v_base_type = NULL;
  PyObject *__pyx_v_typoid = NULL;
  PyObject *__pyx_v_element_names = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_attrname = 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;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  Py_UCS4 __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_types", 0);

  /* "asyncpg/protocol/codecs/base.pyx":440
 *             Py_UCS4 elem_delim
 * 
 *         for ti in types:             # <<<<<<<<<<<<<<
 *             oid = ti['oid']
 * 
 */
  if (likely(PyList_CheckExact(__pyx_v_types)) || PyTuple_CheckExact(__pyx_v_types)) {
    __pyx_t_1 = __pyx_v_types; __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_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 440, __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(4, 440, __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(4, 440, __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(4, 440, __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(4, 440, __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(4, 440, __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(4, 440, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_ti, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":441
 * 
 *         for ti in types:
 *             oid = ti['oid']             # <<<<<<<<<<<<<<
 * 
 *             if self.get_codec(oid, PG_FORMAT_ANY) is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_oid); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":443
 *             oid = ti['oid']
 * 
 *             if self.get_codec(oid, PG_FORMAT_ANY) is not None:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 443, __pyx_L1_error)
    __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_t_5, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__pyx_t_4 != Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "asyncpg/protocol/codecs/base.pyx":444
 * 
 *             if self.get_codec(oid, PG_FORMAT_ANY) is not None:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             name = ti['name']
 */
      goto __pyx_L3_continue;

      /* "asyncpg/protocol/codecs/base.pyx":443
 *             oid = ti['oid']
 * 
 *             if self.get_codec(oid, PG_FORMAT_ANY) is not None:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":446
 *                 continue
 * 
 *             name = ti['name']             # <<<<<<<<<<<<<<
 *             schema = ti['ns']
 *             array_element_oid = ti['elemtype']
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":447
 * 
 *             name = ti['name']
 *             schema = ti['ns']             # <<<<<<<<<<<<<<
 *             array_element_oid = ti['elemtype']
 *             range_subtype_oid = ti['range_subtype']
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_ns); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_schema, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":448
 *             name = ti['name']
 *             schema = ti['ns']
 *             array_element_oid = ti['elemtype']             # <<<<<<<<<<<<<<
 *             range_subtype_oid = ti['range_subtype']
 *             if ti['attrtypoids']:
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_elemtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_array_element_oid, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":449
 *             schema = ti['ns']
 *             array_element_oid = ti['elemtype']
 *             range_subtype_oid = ti['range_subtype']             # <<<<<<<<<<<<<<
 *             if ti['attrtypoids']:
 *                 comp_type_attrs = tuple(ti['attrtypoids'])
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_range_subtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_range_subtype_oid, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":450
 *             array_element_oid = ti['elemtype']
 *             range_subtype_oid = ti['range_subtype']
 *             if ti['attrtypoids']:             # <<<<<<<<<<<<<<
 *                 comp_type_attrs = tuple(ti['attrtypoids'])
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_attrtypoids); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 450, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {

      /* "asyncpg/protocol/codecs/base.pyx":451
 *             range_subtype_oid = ti['range_subtype']
 *             if ti['attrtypoids']:
 *                 comp_type_attrs = tuple(ti['attrtypoids'])             # <<<<<<<<<<<<<<
 *             else:
 *                 comp_type_attrs = None
 */
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_attrtypoids); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_comp_type_attrs, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":450
 *             array_element_oid = ti['elemtype']
 *             range_subtype_oid = ti['range_subtype']
 *             if ti['attrtypoids']:             # <<<<<<<<<<<<<<
 *                 comp_type_attrs = tuple(ti['attrtypoids'])
 *             else:
 */
      goto __pyx_L6;
    }

    /* "asyncpg/protocol/codecs/base.pyx":453
 *                 comp_type_attrs = tuple(ti['attrtypoids'])
 *             else:
 *                 comp_type_attrs = None             # <<<<<<<<<<<<<<
 *             base_type = ti['basetype']
 * 
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_comp_type_attrs, ((PyObject*)Py_None));
    }
    __pyx_L6:;

    /* "asyncpg/protocol/codecs/base.pyx":454
 *             else:
 *                 comp_type_attrs = None
 *             base_type = ti['basetype']             # <<<<<<<<<<<<<<
 * 
 *             if array_element_oid:
 */
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_basetype); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_base_type, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":456
 *             base_type = ti['basetype']
 * 
 *             if array_element_oid:             # <<<<<<<<<<<<<<
 *                 # Array type (note, there is no separate 'kind' for arrays)
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_array_element_oid); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 456, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "asyncpg/protocol/codecs/base.pyx":460
 * 
 *                 # Canonicalize type name to "elemtype[]"
 *                 if name.startswith('_'):             # <<<<<<<<<<<<<<
 *                     name = name[1:]
 *                 name = '{}[]'.format(name)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 460, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_n_u__2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u__2);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 460, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 460, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_7) {

        /* "asyncpg/protocol/codecs/base.pyx":461
 *                 # Canonicalize type name to "elemtype[]"
 *                 if name.startswith('_'):
 *                     name = name[1:]             # <<<<<<<<<<<<<<
 *                 name = '{}[]'.format(name)
 * 
 */
        __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_name, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 461, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":460
 * 
 *                 # Canonicalize type name to "elemtype[]"
 *                 if name.startswith('_'):             # <<<<<<<<<<<<<<
 *                     name = name[1:]
 *                 name = '{}[]'.format(name)
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":462
 *                 if name.startswith('_'):
 *                     name = name[1:]
 *                 name = '{}[]'.format(name)             # <<<<<<<<<<<<<<
 * 
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u__9, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_name);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":464
 *                 name = '{}[]'.format(name)
 * 
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_array_element_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 464, __pyx_L1_error)
      __pyx_t_8 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_t_5, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY, NULL)); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":465
 * 
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         array_element_oid, ti['elemtype_name'], schema)
 */
      __pyx_t_7 = (((PyObject *)__pyx_v_elem_codec) == Py_None);
      __pyx_t_6 = (__pyx_t_7 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/base.pyx":466
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         array_element_oid, ti['elemtype_name'], schema)
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_declare_fallback_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);

        /* "asyncpg/protocol/codecs/base.pyx":467
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 *                         array_element_oid, ti['elemtype_name'], schema)             # <<<<<<<<<<<<<<
 * 
 *                 elem_delim = <Py_UCS4>ti['elemdelim'][0]
 */
        __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_elemtype_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_11 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_array_element_oid, __pyx_t_9, __pyx_v_schema};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 466, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_array_element_oid, __pyx_t_9, __pyx_v_schema};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 466, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 466, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_v_array_element_oid);
          __Pyx_GIVEREF(__pyx_v_array_element_oid);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_array_element_oid);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_9);
          __Pyx_INCREF(__pyx_v_schema);
          __Pyx_GIVEREF(__pyx_v_schema);
          PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_schema);
          __pyx_t_9 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 466, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":466
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         array_element_oid, ti['elemtype_name'], schema)
 * 
 */
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 466, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":465
 * 
 *                 elem_codec = self.get_codec(array_element_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         array_element_oid, ti['elemtype_name'], schema)
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":469
 *                         array_element_oid, ti['elemtype_name'], schema)
 * 
 *                 elem_delim = <Py_UCS4>ti['elemdelim'][0]             # <<<<<<<<<<<<<<
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \
 */
      __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_elemdelim); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_13 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_4); if (unlikely((__pyx_t_13 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(4, 469, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_elem_delim = ((Py_UCS4)__pyx_t_13);

      /* "asyncpg/protocol/codecs/base.pyx":473
 *                 self._derived_type_codecs[oid, elem_codec.format] = \
 *                     Codec.new_array_codec(
 *                         oid, name, schema, elem_codec, elem_delim)             # <<<<<<<<<<<<<<
 * 
 *             elif ti['kind'] == b'c':
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 473, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(4, 473, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_schema))||((__pyx_v_schema) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_schema)->tp_name), 0))) __PYX_ERR(4, 473, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":472
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \
 *                     Codec.new_array_codec(             # <<<<<<<<<<<<<<
 *                         oid, name, schema, elem_codec, elem_delim)
 * 
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_array_codec(__pyx_t_5, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_schema), __pyx_v_elem_codec, __pyx_v_elem_delim)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "asyncpg/protocol/codecs/base.pyx":471
 *                 elem_delim = <Py_UCS4>ti['elemdelim'][0]
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \             # <<<<<<<<<<<<<<
 *                     Codec.new_array_codec(
 *                         oid, name, schema, elem_codec, elem_delim)
 */
      if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 471, __pyx_L1_error)
      }
      __pyx_t_8 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_elem_codec->format); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_oid);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_8);
      __pyx_t_8 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_self->_derived_type_codecs, __pyx_t_12, __pyx_t_4) < 0)) __PYX_ERR(4, 471, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":456
 *             base_type = ti['basetype']
 * 
 *             if array_element_oid:             # <<<<<<<<<<<<<<
 *                 # Array type (note, there is no separate 'kind' for arrays)
 * 
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":475
 *                         oid, name, schema, elem_codec, elem_delim)
 * 
 *             elif ti['kind'] == b'c':             # <<<<<<<<<<<<<<
 *                 # Composite type
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_n_b_c, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 475, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/base.pyx":478
 *                 # Composite type
 * 
 *                 if not comp_type_attrs:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing field types for composite {oid}')
 */
      __pyx_t_6 = (__pyx_v_comp_type_attrs != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_comp_type_attrs) != 0);
      __pyx_t_7 = ((!__pyx_t_6) != 0);
      if (unlikely(__pyx_t_7)) {

        /* "asyncpg/protocol/codecs/base.pyx":479
 * 
 *                 if not comp_type_attrs:
 *                     raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                         f'type record missing field types for composite {oid}')
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":480
 *                 if not comp_type_attrs:
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing field types for composite {oid}')             # <<<<<<<<<<<<<<
 * 
 *                 comp_elem_codecs = []
 */
        __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_oid, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_kp_u_type_record_missing_field_types, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_12, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(4, 479, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/base.pyx":478
 *                 # Composite type
 * 
 *                 if not comp_type_attrs:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing field types for composite {oid}')
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":482
 *                         f'type record missing field types for composite {oid}')
 * 
 *                 comp_elem_codecs = []             # <<<<<<<<<<<<<<
 *                 has_text_elements = False
 * 
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_comp_elem_codecs, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":483
 * 
 *                 comp_elem_codecs = []
 *                 has_text_elements = False             # <<<<<<<<<<<<<<
 * 
 *                 for typoid in comp_type_attrs:
 */
      __pyx_v_has_text_elements = 0;

      /* "asyncpg/protocol/codecs/base.pyx":485
 *                 has_text_elements = False
 * 
 *                 for typoid in comp_type_attrs:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)
 *                     if elem_codec is None:
 */
      if (unlikely(__pyx_v_comp_type_attrs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(4, 485, __pyx_L1_error)
      }
      __pyx_t_4 = __pyx_v_comp_type_attrs; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0;
      for (;;) {
        if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(4, 485, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_typoid, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":486
 * 
 *                 for typoid in comp_type_attrs:
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *                     if elem_codec is None:
 *                         raise exceptions.InternalClientError(
 */
        __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_typoid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 486, __pyx_L1_error)
        __pyx_t_8 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_t_5, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY, NULL)); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 486, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":487
 *                 for typoid in comp_type_attrs:
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)
 *                     if elem_codec is None:             # <<<<<<<<<<<<<<
 *                         raise exceptions.InternalClientError(
 *                             f'no codec for composite attribute type {typoid}')
 */
        __pyx_t_7 = (((PyObject *)__pyx_v_elem_codec) == Py_None);
        __pyx_t_6 = (__pyx_t_7 != 0);
        if (unlikely(__pyx_t_6)) {

          /* "asyncpg/protocol/codecs/base.pyx":488
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)
 *                     if elem_codec is None:
 *                         raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                             f'no codec for composite attribute type {typoid}')
 *                     if elem_codec.format is PG_FORMAT_TEXT:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "asyncpg/protocol/codecs/base.pyx":489
 *                     if elem_codec is None:
 *                         raise exceptions.InternalClientError(
 *                             f'no codec for composite attribute type {typoid}')             # <<<<<<<<<<<<<<
 *                     if elem_codec.format is PG_FORMAT_TEXT:
 *                         has_text_elements = True
 */
          __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_typoid, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 489, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_no_codec_for_composite_attribute, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 489, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_9)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_9);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_10);
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(4, 488, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/base.pyx":487
 *                 for typoid in comp_type_attrs:
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)
 *                     if elem_codec is None:             # <<<<<<<<<<<<<<
 *                         raise exceptions.InternalClientError(
 *                             f'no codec for composite attribute type {typoid}')
 */
        }

        /* "asyncpg/protocol/codecs/base.pyx":490
 *                         raise exceptions.InternalClientError(
 *                             f'no codec for composite attribute type {typoid}')
 *                     if elem_codec.format is PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                         has_text_elements = True
 *                     comp_elem_codecs.append(elem_codec)
 */
        __pyx_t_6 = ((__pyx_v_elem_codec->format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT) != 0);
        if (__pyx_t_6) {

          /* "asyncpg/protocol/codecs/base.pyx":491
 *                             f'no codec for composite attribute type {typoid}')
 *                     if elem_codec.format is PG_FORMAT_TEXT:
 *                         has_text_elements = True             # <<<<<<<<<<<<<<
 *                     comp_elem_codecs.append(elem_codec)
 * 
 */
          __pyx_v_has_text_elements = 1;

          /* "asyncpg/protocol/codecs/base.pyx":490
 *                         raise exceptions.InternalClientError(
 *                             f'no codec for composite attribute type {typoid}')
 *                     if elem_codec.format is PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                         has_text_elements = True
 *                     comp_elem_codecs.append(elem_codec)
 */
        }

        /* "asyncpg/protocol/codecs/base.pyx":492
 *                     if elem_codec.format is PG_FORMAT_TEXT:
 *                         has_text_elements = True
 *                     comp_elem_codecs.append(elem_codec)             # <<<<<<<<<<<<<<
 * 
 *                 element_names = collections.OrderedDict()
 */
        __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_comp_elem_codecs, ((PyObject *)__pyx_v_elem_codec)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(4, 492, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/base.pyx":485
 *                 has_text_elements = False
 * 
 *                 for typoid in comp_type_attrs:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.get_codec(typoid, PG_FORMAT_ANY)
 *                     if elem_codec is None:
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":494
 *                     comp_elem_codecs.append(elem_codec)
 * 
 *                 element_names = collections.OrderedDict()             # <<<<<<<<<<<<<<
 *                 for i, attrname in enumerate(ti['attrnames']):
 *                     element_names[attrname] = i
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_collections); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v_element_names, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":495
 * 
 *                 element_names = collections.OrderedDict()
 *                 for i, attrname in enumerate(ti['attrnames']):             # <<<<<<<<<<<<<<
 *                     element_names[attrname] = i
 * 
 */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_t_4 = __pyx_int_0;
      __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_attrnames); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (likely(PyList_CheckExact(__pyx_t_12)) || PyTuple_CheckExact(__pyx_t_12)) {
        __pyx_t_8 = __pyx_t_12; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
        __pyx_t_16 = NULL;
      } else {
        __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(4, 495, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      for (;;) {
        if (likely(!__pyx_t_16)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_12); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(4, 495, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 495, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          } else {
            if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_12); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(4, 495, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 495, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          }
        } else {
          __pyx_t_12 = __pyx_t_16(__pyx_t_8);
          if (unlikely(!__pyx_t_12)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(4, 495, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_XDECREF_SET(__pyx_v_attrname, __pyx_t_12);
        __pyx_t_12 = 0;
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
        __pyx_t_12 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_4 = __pyx_t_12;
        __pyx_t_12 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":496
 *                 element_names = collections.OrderedDict()
 *                 for i, attrname in enumerate(ti['attrnames']):
 *                     element_names[attrname] = i             # <<<<<<<<<<<<<<
 * 
 *                 # If at least one element is text-encoded, we must
 */
        if (unlikely(PyObject_SetItem(__pyx_v_element_names, __pyx_v_attrname, __pyx_v_i) < 0)) __PYX_ERR(4, 496, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/base.pyx":495
 * 
 *                 element_names = collections.OrderedDict()
 *                 for i, attrname in enumerate(ti['attrnames']):             # <<<<<<<<<<<<<<
 *                     element_names[attrname] = i
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":500
 *                 # If at least one element is text-encoded, we must
 *                 # encode the whole composite as text.
 *                 if has_text_elements:             # <<<<<<<<<<<<<<
 *                     elem_format = PG_FORMAT_TEXT
 *                 else:
 */
      __pyx_t_6 = (__pyx_v_has_text_elements != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/base.pyx":501
 *                 # encode the whole composite as text.
 *                 if has_text_elements:
 *                     elem_format = PG_FORMAT_TEXT             # <<<<<<<<<<<<<<
 *                 else:
 *                     elem_format = PG_FORMAT_BINARY
 */
        __pyx_v_elem_format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT;

        /* "asyncpg/protocol/codecs/base.pyx":500
 *                 # If at least one element is text-encoded, we must
 *                 # encode the whole composite as text.
 *                 if has_text_elements:             # <<<<<<<<<<<<<<
 *                     elem_format = PG_FORMAT_TEXT
 *                 else:
 */
        goto __pyx_L17;
      }

      /* "asyncpg/protocol/codecs/base.pyx":503
 *                     elem_format = PG_FORMAT_TEXT
 *                 else:
 *                     elem_format = PG_FORMAT_BINARY             # <<<<<<<<<<<<<<
 * 
 *                 self._derived_type_codecs[oid, elem_format] = \
 */
      /*else*/ {
        __pyx_v_elem_format = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY;
      }
      __pyx_L17:;

      /* "asyncpg/protocol/codecs/base.pyx":507
 *                 self._derived_type_codecs[oid, elem_format] = \
 *                     Codec.new_composite_codec(
 *                         oid, name, schema, elem_format, comp_elem_codecs,             # <<<<<<<<<<<<<<
 *                         comp_type_attrs, element_names)
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 507, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(4, 507, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_schema))||((__pyx_v_schema) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_schema)->tp_name), 0))) __PYX_ERR(4, 507, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/base.pyx":506
 * 
 *                 self._derived_type_codecs[oid, elem_format] = \
 *                     Codec.new_composite_codec(             # <<<<<<<<<<<<<<
 *                         oid, name, schema, elem_format, comp_elem_codecs,
 *                         comp_type_attrs, element_names)
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_composite_codec(__pyx_t_5, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_schema), __pyx_v_elem_format, __pyx_v_comp_elem_codecs, __pyx_v_comp_type_attrs, __pyx_v_element_names)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "asyncpg/protocol/codecs/base.pyx":505
 *                     elem_format = PG_FORMAT_BINARY
 * 
 *                 self._derived_type_codecs[oid, elem_format] = \             # <<<<<<<<<<<<<<
 *                     Codec.new_composite_codec(
 *                         oid, name, schema, elem_format, comp_elem_codecs,
 */
      if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 505, __pyx_L1_error)
      }
      __pyx_t_8 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_elem_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_oid);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_8);
      __pyx_t_8 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_self->_derived_type_codecs, __pyx_t_12, __pyx_t_4) < 0)) __PYX_ERR(4, 505, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":475
 *                         oid, name, schema, elem_codec, elem_delim)
 * 
 *             elif ti['kind'] == b'c':             # <<<<<<<<<<<<<<
 *                 # Composite type
 * 
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":510
 *                         comp_type_attrs, element_names)
 * 
 *             elif ti['kind'] == b'd':             # <<<<<<<<<<<<<<
 *                 # Domain type
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_kind); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_n_b_d, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/base.pyx":513
 *                 # Domain type
 * 
 *                 if not base_type:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for domain {oid}')
 */
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_base_type); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 513, __pyx_L1_error)
      __pyx_t_7 = ((!__pyx_t_6) != 0);
      if (unlikely(__pyx_t_7)) {

        /* "asyncpg/protocol/codecs/base.pyx":514
 * 
 *                 if not base_type:
 *                     raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                         f'type record missing base type for domain {oid}')
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":515
 *                 if not base_type:
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for domain {oid}')             # <<<<<<<<<<<<<<
 * 
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)
 */
        __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_oid, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_type_record_missing_base_type_fo, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __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_4)) __PYX_ERR(4, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(4, 514, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/base.pyx":513
 *                 # Domain type
 * 
 *                 if not base_type:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for domain {oid}')
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":517
 *                         f'type record missing base type for domain {oid}')
 * 
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_base_type); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 517, __pyx_L1_error)
      __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_t_5, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":518
 * 
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         base_type, ti['basetype_name'], schema)
 */
      __pyx_t_7 = (((PyObject *)__pyx_v_elem_codec) == Py_None);
      __pyx_t_6 = (__pyx_t_7 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/base.pyx":519
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         base_type, ti['basetype_name'], schema)
 * 
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_declare_fallback_codec); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 519, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "asyncpg/protocol/codecs/base.pyx":520
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 *                         base_type, ti['basetype_name'], schema)             # <<<<<<<<<<<<<<
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = elem_codec
 */
        __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_basetype_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 520, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_11 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_base_type, __pyx_t_10, __pyx_v_schema};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 519, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_base_type, __pyx_t_10, __pyx_v_schema};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 519, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_INCREF(__pyx_v_base_type);
          __Pyx_GIVEREF(__pyx_v_base_type);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_v_base_type);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_t_10);
          __Pyx_INCREF(__pyx_v_schema);
          __Pyx_GIVEREF(__pyx_v_schema);
          PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_11, __pyx_v_schema);
          __pyx_t_10 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":519
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         base_type, ti['basetype_name'], schema)
 * 
 */
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 519, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":518
 * 
 *                 elem_codec = self.get_codec(base_type, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         base_type, ti['basetype_name'], schema)
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":522
 *                         base_type, ti['basetype_name'], schema)
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = elem_codec             # <<<<<<<<<<<<<<
 * 
 *             elif ti['kind'] == b'r':
 */
      if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 522, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_elem_codec->format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_oid);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_self->_derived_type_codecs, __pyx_t_8, ((PyObject *)__pyx_v_elem_codec)) < 0)) __PYX_ERR(4, 522, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":510
 *                         comp_type_attrs, element_names)
 * 
 *             elif ti['kind'] == b'd':             # <<<<<<<<<<<<<<
 *                 # Domain type
 * 
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":524
 *                 self._derived_type_codecs[oid, elem_codec.format] = elem_codec
 * 
 *             elif ti['kind'] == b'r':             # <<<<<<<<<<<<<<
 *                 # Range type
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_kind); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_t_8, __pyx_n_b_r, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/base.pyx":527
 *                 # Range type
 * 
 *                 if not range_subtype_oid:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for range {oid}')
 */
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_range_subtype_oid); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 527, __pyx_L1_error)
      __pyx_t_7 = ((!__pyx_t_6) != 0);
      if (unlikely(__pyx_t_7)) {

        /* "asyncpg/protocol/codecs/base.pyx":528
 * 
 *                 if not range_subtype_oid:
 *                     raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                         f'type record missing base type for range {oid}')
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 528, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 528, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":529
 *                 if not range_subtype_oid:
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for range {oid}')             # <<<<<<<<<<<<<<
 * 
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)
 */
        __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_oid, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 529, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_type_record_missing_base_type_fo_2, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 529, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 528, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_Raise(__pyx_t_8, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(4, 528, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/base.pyx":527
 *                 # Range type
 * 
 *                 if not range_subtype_oid:             # <<<<<<<<<<<<<<
 *                     raise exceptions.InternalClientError(
 *                         f'type record missing base type for range {oid}')
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":531
 *                         f'type record missing base type for range {oid}')
 * 
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_range_subtype_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 531, __pyx_L1_error)
      __pyx_t_8 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_t_5, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY, NULL)); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":532
 * 
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         range_subtype_oid, ti['range_subtype_name'], schema)
 */
      __pyx_t_7 = (((PyObject *)__pyx_v_elem_codec) == Py_None);
      __pyx_t_6 = (__pyx_t_7 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/base.pyx":533
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         range_subtype_oid, ti['range_subtype_name'], schema)
 * 
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_declare_fallback_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 533, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);

        /* "asyncpg/protocol/codecs/base.pyx":534
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(
 *                         range_subtype_oid, ti['range_subtype_name'], schema)             # <<<<<<<<<<<<<<
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \
 */
        __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_range_subtype_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
            __pyx_t_11 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_range_subtype_oid, __pyx_t_10, __pyx_v_schema};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 533, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_range_subtype_oid, __pyx_t_10, __pyx_v_schema};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 533, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 533, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_range_subtype_oid);
          __Pyx_GIVEREF(__pyx_v_range_subtype_oid);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_range_subtype_oid);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
          __Pyx_INCREF(__pyx_v_schema);
          __Pyx_GIVEREF(__pyx_v_schema);
          PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_schema);
          __pyx_t_10 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 533, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":533
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:
 *                     elem_codec = self.declare_fallback_codec(             # <<<<<<<<<<<<<<
 *                         range_subtype_oid, ti['range_subtype_name'], schema)
 * 
 */
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 533, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":532
 * 
 *                 elem_codec = self.get_codec(range_subtype_oid, PG_FORMAT_ANY)
 *                 if elem_codec is None:             # <<<<<<<<<<<<<<
 *                     elem_codec = self.declare_fallback_codec(
 *                         range_subtype_oid, ti['range_subtype_name'], schema)
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":537
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \
 *                     Codec.new_range_codec(oid, name, schema, elem_codec)             # <<<<<<<<<<<<<<
 * 
 *             elif ti['kind'] == b'e':
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 537, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(4, 537, __pyx_L1_error)
      if (!(likely(PyUnicode_CheckExact(__pyx_v_schema))||((__pyx_v_schema) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_schema)->tp_name), 0))) __PYX_ERR(4, 537, __pyx_L1_error)
      __pyx_t_8 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_range_codec(__pyx_t_5, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_schema), __pyx_v_elem_codec)); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);

      /* "asyncpg/protocol/codecs/base.pyx":536
 *                         range_subtype_oid, ti['range_subtype_name'], schema)
 * 
 *                 self._derived_type_codecs[oid, elem_codec.format] = \             # <<<<<<<<<<<<<<
 *                     Codec.new_range_codec(oid, name, schema, elem_codec)
 * 
 */
      if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(4, 536, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_elem_codec->format); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_oid);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_9);
      __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_self->_derived_type_codecs, __pyx_t_12, __pyx_t_8) < 0)) __PYX_ERR(4, 536, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":524
 *                 self._derived_type_codecs[oid, elem_codec.format] = elem_codec
 * 
 *             elif ti['kind'] == b'r':             # <<<<<<<<<<<<<<
 *                 # Range type
 * 
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":539
 *                     Codec.new_range_codec(oid, name, schema, elem_codec)
 * 
 *             elif ti['kind'] == b'e':             # <<<<<<<<<<<<<<
 *                 # Enum types are essentially text
 *                 self._set_builtin_type_codec(oid, name, schema, 'scalar',
 */
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_ti, __pyx_n_u_kind); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_t_8, __pyx_n_b_e, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(4, 539, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/base.pyx":541
 *             elif ti['kind'] == b'e':
 *                 # Enum types are essentially text
 *                 self._set_builtin_type_codec(oid, name, schema, 'scalar',             # <<<<<<<<<<<<<<
 *                                              TEXTOID, PG_FORMAT_ANY)
 *             else:
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_builtin_type_codec_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);

      /* "asyncpg/protocol/codecs/base.pyx":542
 *                 # Enum types are essentially text
 *                 self._set_builtin_type_codec(oid, name, schema, 'scalar',
 *                                              TEXTOID, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.declare_fallback_codec(oid, name, schema)
 */
      __pyx_t_9 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 542, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_v_oid, __pyx_v_name, __pyx_v_schema, __pyx_n_u_scalar, __pyx_int_25, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 541, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_v_oid, __pyx_v_name, __pyx_v_schema, __pyx_n_u_scalar, __pyx_int_25, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 541, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(6+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 541, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_v_oid);
        __Pyx_GIVEREF(__pyx_v_oid);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_v_oid);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_v_name);
        __Pyx_INCREF(__pyx_v_schema);
        __Pyx_GIVEREF(__pyx_v_schema);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_v_schema);
        __Pyx_INCREF(__pyx_n_u_scalar);
        __Pyx_GIVEREF(__pyx_n_u_scalar);
        PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_11, __pyx_n_u_scalar);
        __Pyx_INCREF(__pyx_int_25);
        __Pyx_GIVEREF(__pyx_int_25);
        PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_11, __pyx_int_25);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_4, 5+__pyx_t_11, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 541, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":539
 *                     Codec.new_range_codec(oid, name, schema, elem_codec)
 * 
 *             elif ti['kind'] == b'e':             # <<<<<<<<<<<<<<
 *                 # Enum types are essentially text
 *                 self._set_builtin_type_codec(oid, name, schema, 'scalar',
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":544
 *                                              TEXTOID, PG_FORMAT_ANY)
 *             else:
 *                 self.declare_fallback_codec(oid, name, schema)             # <<<<<<<<<<<<<<
 * 
 *     def add_python_codec(self, typeoid, typename, typeschema, typekind,
 */
    /*else*/ {
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_declare_fallback_codec); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 544, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_4 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_oid, __pyx_v_name, __pyx_v_schema};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 544, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_oid, __pyx_v_name, __pyx_v_schema};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 544, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 544, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_oid);
        __Pyx_GIVEREF(__pyx_v_oid);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_v_oid);
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_v_name);
        __Pyx_INCREF(__pyx_v_schema);
        __Pyx_GIVEREF(__pyx_v_schema);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_11, __pyx_v_schema);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 544, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L7:;

    /* "asyncpg/protocol/codecs/base.pyx":440
 *             Py_UCS4 elem_delim
 * 
 *         for ti in types:             # <<<<<<<<<<<<<<
 *             oid = ti['oid']
 * 
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":431
 *         self._custom_type_codecs = {}
 * 
 *     def add_types(self, types):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec elem_codec
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.add_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_codec);
  __Pyx_XDECREF(__pyx_v_comp_elem_codecs);
  __Pyx_XDECREF(__pyx_v_ti);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_schema);
  __Pyx_XDECREF(__pyx_v_array_element_oid);
  __Pyx_XDECREF(__pyx_v_range_subtype_oid);
  __Pyx_XDECREF(__pyx_v_comp_type_attrs);
  __Pyx_XDECREF(__pyx_v_base_type);
  __Pyx_XDECREF(__pyx_v_typoid);
  __Pyx_XDECREF(__pyx_v_element_names);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_attrname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":546
 *                 self.declare_fallback_codec(oid, name, schema)
 * 
 *     def add_python_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                          encoder, decoder, format, xformat):
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_5add_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_5add_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  PyObject *__pyx_v_typekind = 0;
  PyObject *__pyx_v_encoder = 0;
  PyObject *__pyx_v_decoder = 0;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_xformat = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_python_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,&__pyx_n_s_typekind,&__pyx_n_s_encoder,&__pyx_n_s_decoder,&__pyx_n_s_format,&__pyx_n_s_xformat,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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 1); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 2); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typekind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 3); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 4); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_decoder)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 5); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 6); __PYX_ERR(4, 546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xformat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, 7); __PYX_ERR(4, 546, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_python_codec") < 0)) __PYX_ERR(4, 546, __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_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
    __pyx_v_typekind = values[3];
    __pyx_v_encoder = values[4];
    __pyx_v_decoder = values[5];
    __pyx_v_format = values[6];
    __pyx_v_xformat = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_python_codec", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 546, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.add_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_4add_python_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_encoder, __pyx_v_decoder, __pyx_v_format, __pyx_v_xformat);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_4add_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_encoder, PyObject *__pyx_v_decoder, PyObject *__pyx_v_format, PyObject *__pyx_v_xformat) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_core_codec = 0;
  __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_c_encoder;
  __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_c_decoder;
  uint32_t __pyx_v_oid;
  int __pyx_v_codec_set;
  PyObject *__pyx_v_formats = NULL;
  PyObject *__pyx_v_fmt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_t_10;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_t_11;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec __pyx_t_12;
  int __pyx_t_13;
  __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_t_14;
  __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_python_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":550
 *         cdef:
 *             Codec core_codec
 *             encode_func c_encoder = NULL             # <<<<<<<<<<<<<<
 *             decode_func c_decoder = NULL
 *             uint32_t oid = pylong_as_oid(typeoid)
 */
  __pyx_v_c_encoder = NULL;

  /* "asyncpg/protocol/codecs/base.pyx":551
 *             Codec core_codec
 *             encode_func c_encoder = NULL
 *             decode_func c_decoder = NULL             # <<<<<<<<<<<<<<
 *             uint32_t oid = pylong_as_oid(typeoid)
 *             bint codec_set = False
 */
  __pyx_v_c_decoder = NULL;

  /* "asyncpg/protocol/codecs/base.pyx":552
 *             encode_func c_encoder = NULL
 *             decode_func c_decoder = NULL
 *             uint32_t oid = pylong_as_oid(typeoid)             # <<<<<<<<<<<<<<
 *             bint codec_set = False
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_pylong_as_oid(__pyx_v_typeoid); if (unlikely(__pyx_t_1 == ((uint32_t)0xFFFFFFFFL) && PyErr_Occurred())) __PYX_ERR(4, 552, __pyx_L1_error)
  __pyx_v_oid = __pyx_t_1;

  /* "asyncpg/protocol/codecs/base.pyx":553
 *             decode_func c_decoder = NULL
 *             uint32_t oid = pylong_as_oid(typeoid)
 *             bint codec_set = False             # <<<<<<<<<<<<<<
 * 
 *         # Clear all previous overrides (this also clears type cache).
 */
  __pyx_v_codec_set = 0;

  /* "asyncpg/protocol/codecs/base.pyx":556
 * 
 *         # Clear all previous overrides (this also clears type cache).
 *         self.remove_python_codec(typeoid, typename, typeschema)             # <<<<<<<<<<<<<<
 * 
 *         if format == PG_FORMAT_ANY:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_python_codec); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 556, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 556, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_typename);
    __Pyx_GIVEREF(__pyx_v_typename);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_typename);
    __Pyx_INCREF(__pyx_v_typeschema);
    __Pyx_GIVEREF(__pyx_v_typeschema);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_typeschema);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":558
 *         self.remove_python_codec(typeoid, typename, typeschema)
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             formats = (PG_FORMAT_TEXT, PG_FORMAT_BINARY)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_7) {

    /* "asyncpg/protocol/codecs/base.pyx":559
 * 
 *         if format == PG_FORMAT_ANY:
 *             formats = (PG_FORMAT_TEXT, PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 *         else:
 *             formats = (format,)
 */
    __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_v_formats = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":558
 *         self.remove_python_codec(typeoid, typename, typeschema)
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             formats = (PG_FORMAT_TEXT, PG_FORMAT_BINARY)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/base.pyx":561
 *             formats = (PG_FORMAT_TEXT, PG_FORMAT_BINARY)
 *         else:
 *             formats = (format,)             # <<<<<<<<<<<<<<
 * 
 *         for fmt in formats:
 */
  /*else*/ {
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_format);
    __Pyx_GIVEREF(__pyx_v_format);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_format);
    __pyx_v_formats = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/base.pyx":563
 *             formats = (format,)
 * 
 *         for fmt in formats:             # <<<<<<<<<<<<<<
 *             if xformat == PG_XFORMAT_TUPLE:
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 */
  if (likely(PyList_CheckExact(__pyx_v_formats)) || PyTuple_CheckExact(__pyx_v_formats)) {
    __pyx_t_6 = __pyx_v_formats; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_formats); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 563, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(4, 563, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 563, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(4, 563, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 563, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_9(__pyx_t_6);
      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(4, 563, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":564
 * 
 *         for fmt in formats:
 *             if xformat == PG_XFORMAT_TUPLE:             # <<<<<<<<<<<<<<
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 *                 if core_codec is None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_xformat, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 564, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 564, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_7) {

      /* "asyncpg/protocol/codecs/base.pyx":565
 *         for fmt in formats:
 *             if xformat == PG_XFORMAT_TUPLE:
 *                 core_codec = get_core_codec(oid, fmt, xformat)             # <<<<<<<<<<<<<<
 *                 if core_codec is None:
 *                     continue
 */
      __pyx_t_10 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_fmt)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 565, __pyx_L1_error)
      __pyx_t_11 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_v_xformat)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 565, __pyx_L1_error)
      __pyx_t_12.__pyx_n = 1;
      __pyx_t_12.xformat = __pyx_t_11;
      __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(__pyx_v_oid, __pyx_t_10, &__pyx_t_12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_core_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":566
 *             if xformat == PG_XFORMAT_TUPLE:
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 *                 if core_codec is None:             # <<<<<<<<<<<<<<
 *                     continue
 *                 c_encoder = core_codec.c_encoder
 */
      __pyx_t_7 = (((PyObject *)__pyx_v_core_codec) == Py_None);
      __pyx_t_13 = (__pyx_t_7 != 0);
      if (__pyx_t_13) {

        /* "asyncpg/protocol/codecs/base.pyx":567
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 *                 if core_codec is None:
 *                     continue             # <<<<<<<<<<<<<<
 *                 c_encoder = core_codec.c_encoder
 *                 c_decoder = core_codec.c_decoder
 */
        goto __pyx_L4_continue;

        /* "asyncpg/protocol/codecs/base.pyx":566
 *             if xformat == PG_XFORMAT_TUPLE:
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 *                 if core_codec is None:             # <<<<<<<<<<<<<<
 *                     continue
 *                 c_encoder = core_codec.c_encoder
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":568
 *                 if core_codec is None:
 *                     continue
 *                 c_encoder = core_codec.c_encoder             # <<<<<<<<<<<<<<
 *                 c_decoder = core_codec.c_decoder
 * 
 */
      __pyx_t_14 = __pyx_v_core_codec->c_encoder;
      __pyx_v_c_encoder = __pyx_t_14;

      /* "asyncpg/protocol/codecs/base.pyx":569
 *                     continue
 *                 c_encoder = core_codec.c_encoder
 *                 c_decoder = core_codec.c_decoder             # <<<<<<<<<<<<<<
 * 
 *             self._custom_type_codecs[typeoid, fmt] = \
 */
      __pyx_t_15 = __pyx_v_core_codec->c_decoder;
      __pyx_v_c_decoder = __pyx_t_15;

      /* "asyncpg/protocol/codecs/base.pyx":564
 * 
 *         for fmt in formats:
 *             if xformat == PG_XFORMAT_TUPLE:             # <<<<<<<<<<<<<<
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 *                 if core_codec is None:
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":572
 * 
 *             self._custom_type_codecs[typeoid, fmt] = \
 *                 Codec.new_python_codec(oid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                        encoder, decoder, c_encoder, c_decoder,
 *                                        fmt, xformat)
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typename))||((__pyx_v_typename) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typename)->tp_name), 0))) __PYX_ERR(4, 572, __pyx_L1_error)
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typeschema))||((__pyx_v_typeschema) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typeschema)->tp_name), 0))) __PYX_ERR(4, 572, __pyx_L1_error)
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typekind))||((__pyx_v_typekind) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typekind)->tp_name), 0))) __PYX_ERR(4, 572, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":574
 *                 Codec.new_python_codec(oid, typename, typeschema, typekind,
 *                                        encoder, decoder, c_encoder, c_decoder,
 *                                        fmt, xformat)             # <<<<<<<<<<<<<<
 *             codec_set = True
 * 
 */
    __pyx_t_10 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_fmt)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 574, __pyx_L1_error)
    __pyx_t_11 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(__pyx_v_xformat)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 574, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":572
 * 
 *             self._custom_type_codecs[typeoid, fmt] = \
 *                 Codec.new_python_codec(oid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                        encoder, decoder, c_encoder, c_decoder,
 *                                        fmt, xformat)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_python_codec(__pyx_v_oid, ((PyObject*)__pyx_v_typename), ((PyObject*)__pyx_v_typeschema), ((PyObject*)__pyx_v_typekind), __pyx_v_encoder, __pyx_v_decoder, __pyx_v_c_encoder, __pyx_v_c_decoder, __pyx_t_10, __pyx_t_11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/codecs/base.pyx":571
 *                 c_decoder = core_codec.c_decoder
 * 
 *             self._custom_type_codecs[typeoid, fmt] = \             # <<<<<<<<<<<<<<
 *                 Codec.new_python_codec(oid, typename, typeschema, typekind,
 *                                        encoder, decoder, c_encoder, c_decoder,
 */
    if (unlikely(__pyx_v_self->_custom_type_codecs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 571, __pyx_L1_error)
    }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_fmt);
    __Pyx_GIVEREF(__pyx_v_fmt);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_fmt);
    if (unlikely(PyDict_SetItem(__pyx_v_self->_custom_type_codecs, __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(4, 571, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":575
 *                                        encoder, decoder, c_encoder, c_decoder,
 *                                        fmt, xformat)
 *             codec_set = True             # <<<<<<<<<<<<<<
 * 
 *         if not codec_set:
 */
    __pyx_v_codec_set = 1;

    /* "asyncpg/protocol/codecs/base.pyx":563
 *             formats = (format,)
 * 
 *         for fmt in formats:             # <<<<<<<<<<<<<<
 *             if xformat == PG_XFORMAT_TUPLE:
 *                 core_codec = get_core_codec(oid, fmt, xformat)
 */
    __pyx_L4_continue:;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":577
 *             codec_set = True
 * 
 *         if not codec_set:             # <<<<<<<<<<<<<<
 *             raise exceptions.InterfaceError(
 *                 "{} type does not support the 'tuple' exchange format".format(
 */
  __pyx_t_13 = ((!(__pyx_v_codec_set != 0)) != 0);
  if (unlikely(__pyx_t_13)) {

    /* "asyncpg/protocol/codecs/base.pyx":578
 * 
 *         if not codec_set:
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 "{} type does not support the 'tuple' exchange format".format(
 *                     typename))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":579
 *         if not codec_set:
 *             raise exceptions.InterfaceError(
 *                 "{} type does not support the 'tuple' exchange format".format(             # <<<<<<<<<<<<<<
 *                     typename))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_type_does_not_support_the_tuple, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/codecs/base.pyx":580
 *             raise exceptions.InterfaceError(
 *                 "{} type does not support the 'tuple' exchange format".format(
 *                     typename))             # <<<<<<<<<<<<<<
 * 
 *     def remove_python_codec(self, typeoid, typename, typeschema):
 */
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_v_typename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_typename);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_6 = (__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_6)) __PYX_ERR(4, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(4, 578, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":577
 *             codec_set = True
 * 
 *         if not codec_set:             # <<<<<<<<<<<<<<
 *             raise exceptions.InterfaceError(
 *                 "{} type does not support the 'tuple' exchange format".format(
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":546
 *                 self.declare_fallback_codec(oid, name, schema)
 * 
 *     def add_python_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                          encoder, decoder, format, xformat):
 *         cdef:
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.add_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_core_codec);
  __Pyx_XDECREF(__pyx_v_formats);
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":582
 *                     typename))
 * 
 *     def remove_python_codec(self, typeoid, typename, typeschema):             # <<<<<<<<<<<<<<
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):
 *             self._custom_type_codecs.pop((typeoid, fmt), None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_7remove_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_7remove_python_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  CYTHON_UNUSED PyObject *__pyx_v_typename = 0;
  CYTHON_UNUSED PyObject *__pyx_v_typeschema = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_python_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, 1); __PYX_ERR(4, 582, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, 2); __PYX_ERR(4, 582, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_python_codec") < 0)) __PYX_ERR(4, 582, __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_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_python_codec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 582, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.remove_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_6remove_python_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_6remove_python_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, CYTHON_UNUSED PyObject *__pyx_v_typename, CYTHON_UNUSED PyObject *__pyx_v_typeschema) {
  PyObject *__pyx_v_fmt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_python_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":583
 * 
 *     def remove_python_codec(self, typeoid, typename, typeschema):
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):             # <<<<<<<<<<<<<<
 *             self._custom_type_codecs.pop((typeoid, fmt), None)
 *         self.clear_type_cache()
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_4 >= 2) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(4, 583, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":584
 *     def remove_python_codec(self, typeoid, typename, typeschema):
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):
 *             self._custom_type_codecs.pop((typeoid, fmt), None)             # <<<<<<<<<<<<<<
 *         self.clear_type_cache()
 * 
 */
    if (unlikely(__pyx_v_self->_custom_type_codecs == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
      __PYX_ERR(4, 584, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_fmt);
    __Pyx_GIVEREF(__pyx_v_fmt);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_fmt);
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_self->_custom_type_codecs, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 584, __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;

    /* "asyncpg/protocol/codecs/base.pyx":583
 * 
 *     def remove_python_codec(self, typeoid, typename, typeschema):
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):             # <<<<<<<<<<<<<<
 *             self._custom_type_codecs.pop((typeoid, fmt), None)
 *         self.clear_type_cache()
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":585
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):
 *             self._custom_type_codecs.pop((typeoid, fmt), None)
 *         self.clear_type_cache()             # <<<<<<<<<<<<<<
 * 
 *     def _set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear_type_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 585, __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_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 585, __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;

  /* "asyncpg/protocol/codecs/base.pyx":582
 *                     typename))
 * 
 *     def remove_python_codec(self, typeoid, typename, typeschema):             # <<<<<<<<<<<<<<
 *         for fmt in (PG_FORMAT_BINARY, PG_FORMAT_TEXT):
 *             self._custom_type_codecs.pop((typeoid, fmt), 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("asyncpg.protocol.protocol.DataCodecConfig.remove_python_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":587
 *         self.clear_type_cache()
 * 
 *     def _set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                 alias_to, format=PG_FORMAT_ANY):
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_9_set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_9_set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  PyObject *__pyx_v_typekind = 0;
  PyObject *__pyx_v_alias_to = 0;
  PyObject *__pyx_v_format = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_builtin_type_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,&__pyx_n_s_typekind,&__pyx_n_s_alias_to,&__pyx_n_s_format,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = __pyx_k__10;
    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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_builtin_type_codec", 0, 5, 6, 1); __PYX_ERR(4, 587, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_builtin_type_codec", 0, 5, 6, 2); __PYX_ERR(4, 587, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typekind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_builtin_type_codec", 0, 5, 6, 3); __PYX_ERR(4, 587, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alias_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_builtin_type_codec", 0, 5, 6, 4); __PYX_ERR(4, 587, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_builtin_type_codec") < 0)) __PYX_ERR(4, 587, __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);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
    __pyx_v_typekind = values[3];
    __pyx_v_alias_to = values[4];
    __pyx_v_format = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_builtin_type_codec", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig._set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_8_set_builtin_type_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_8_set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_target_codec = 0;
  CYTHON_UNUSED uint32_t __pyx_v_oid;
  uint32_t __pyx_v_alias_oid;
  int __pyx_v_codec_set;
  PyObject *__pyx_v_formats = NULL;
  PyObject *__pyx_v_codec_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_t_11;
  Py_UCS4 __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_builtin_type_codec", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "asyncpg/protocol/codecs/base.pyx":592
 *             Codec codec
 *             Codec target_codec
 *             uint32_t oid = pylong_as_oid(typeoid)             # <<<<<<<<<<<<<<
 *             uint32_t alias_oid = 0
 *             bint codec_set = False
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_pylong_as_oid(__pyx_v_typeoid); if (unlikely(__pyx_t_1 == ((uint32_t)0xFFFFFFFFL) && PyErr_Occurred())) __PYX_ERR(4, 592, __pyx_L1_error)
  __pyx_v_oid = __pyx_t_1;

  /* "asyncpg/protocol/codecs/base.pyx":593
 *             Codec target_codec
 *             uint32_t oid = pylong_as_oid(typeoid)
 *             uint32_t alias_oid = 0             # <<<<<<<<<<<<<<
 *             bint codec_set = False
 * 
 */
  __pyx_v_alias_oid = 0;

  /* "asyncpg/protocol/codecs/base.pyx":594
 *             uint32_t oid = pylong_as_oid(typeoid)
 *             uint32_t alias_oid = 0
 *             bint codec_set = False             # <<<<<<<<<<<<<<
 * 
 *         if format == PG_FORMAT_ANY:
 */
  __pyx_v_codec_set = 0;

  /* "asyncpg/protocol/codecs/base.pyx":596
 *             bint codec_set = False
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             formats = (PG_FORMAT_BINARY, PG_FORMAT_TEXT)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 596, __pyx_L1_error)
  __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(4, 596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "asyncpg/protocol/codecs/base.pyx":597
 * 
 *         if format == PG_FORMAT_ANY:
 *             formats = (PG_FORMAT_BINARY, PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 *         else:
 *             formats = (format,)
 */
    __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_v_formats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":596
 *             bint codec_set = False
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             formats = (PG_FORMAT_BINARY, PG_FORMAT_TEXT)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/base.pyx":599
 *             formats = (PG_FORMAT_BINARY, PG_FORMAT_TEXT)
 *         else:
 *             formats = (format,)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(alias_to, int):
 */
  /*else*/ {
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_format);
    __Pyx_GIVEREF(__pyx_v_format);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_format);
    __pyx_v_formats = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/base.pyx":601
 *             formats = (format,)
 * 
 *         if isinstance(alias_to, int):             # <<<<<<<<<<<<<<
 *             alias_oid = pylong_as_oid(alias_to)
 *         else:
 */
  __pyx_t_4 = PyInt_Check(__pyx_v_alias_to); 
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (__pyx_t_6) {

    /* "asyncpg/protocol/codecs/base.pyx":602
 * 
 *         if isinstance(alias_to, int):
 *             alias_oid = pylong_as_oid(alias_to)             # <<<<<<<<<<<<<<
 *         else:
 *             alias_oid = BUILTIN_TYPE_NAME_MAP.get(alias_to, 0)
 */
    __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_pylong_as_oid(__pyx_v_alias_to); if (unlikely(__pyx_t_1 == ((uint32_t)0xFFFFFFFFL) && PyErr_Occurred())) __PYX_ERR(4, 602, __pyx_L1_error)
    __pyx_v_alias_oid = __pyx_t_1;

    /* "asyncpg/protocol/codecs/base.pyx":601
 *             formats = (format,)
 * 
 *         if isinstance(alias_to, int):             # <<<<<<<<<<<<<<
 *             alias_oid = pylong_as_oid(alias_to)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "asyncpg/protocol/codecs/base.pyx":604
 *             alias_oid = pylong_as_oid(alias_to)
 *         else:
 *             alias_oid = BUILTIN_TYPE_NAME_MAP.get(alias_to, 0)             # <<<<<<<<<<<<<<
 * 
 *         for format in formats:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_7 = 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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_alias_to, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 604, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_alias_to, __pyx_int_0};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 604, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_alias_to);
      __Pyx_GIVEREF(__pyx_v_alias_to);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_alias_to);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_int_0);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 604, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_alias_oid = __pyx_t_1;
  }
  __pyx_L4:;

  /* "asyncpg/protocol/codecs/base.pyx":606
 *             alias_oid = BUILTIN_TYPE_NAME_MAP.get(alias_to, 0)
 * 
 *         for format in formats:             # <<<<<<<<<<<<<<
 *             if alias_oid != 0:
 *                 target_codec = self.get_codec(alias_oid, format)
 */
  if (likely(PyList_CheckExact(__pyx_v_formats)) || PyTuple_CheckExact(__pyx_v_formats)) {
    __pyx_t_5 = __pyx_v_formats; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_formats); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 606, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(4, 606, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(4, 606, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_5);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(4, 606, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":607
 * 
 *         for format in formats:
 *             if alias_oid != 0:             # <<<<<<<<<<<<<<
 *                 target_codec = self.get_codec(alias_oid, format)
 *             else:
 */
    __pyx_t_6 = ((__pyx_v_alias_oid != 0) != 0);
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/base.pyx":608
 *         for format in formats:
 *             if alias_oid != 0:
 *                 target_codec = self.get_codec(alias_oid, format)             # <<<<<<<<<<<<<<
 *             else:
 *                 target_codec = get_extra_codec(alias_to, format)
 */
      __pyx_t_11 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 608, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_v_alias_oid, __pyx_t_11, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_target_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":607
 * 
 *         for format in formats:
 *             if alias_oid != 0:             # <<<<<<<<<<<<<<
 *                 target_codec = self.get_codec(alias_oid, format)
 *             else:
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/base.pyx":610
 *                 target_codec = self.get_codec(alias_oid, format)
 *             else:
 *                 target_codec = get_extra_codec(alias_to, format)             # <<<<<<<<<<<<<<
 * 
 *             if target_codec is None:
 */
    /*else*/ {
      if (!(likely(PyUnicode_CheckExact(__pyx_v_alias_to))||((__pyx_v_alias_to) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_alias_to)->tp_name), 0))) __PYX_ERR(4, 610, __pyx_L1_error)
      __pyx_t_11 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 610, __pyx_L1_error)
      __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_extra_codec(((PyObject*)__pyx_v_alias_to), __pyx_t_11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_target_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
      __pyx_t_3 = 0;
    }
    __pyx_L7:;

    /* "asyncpg/protocol/codecs/base.pyx":612
 *                 target_codec = get_extra_codec(alias_to, format)
 * 
 *             if target_codec is None:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_6 = (((PyObject *)__pyx_v_target_codec) == Py_None);
    __pyx_t_4 = (__pyx_t_6 != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":613
 * 
 *             if target_codec is None:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             codec = target_codec.copy()
 */
      goto __pyx_L5_continue;

      /* "asyncpg/protocol/codecs/base.pyx":612
 *                 target_codec = get_extra_codec(alias_to, format)
 * 
 *             if target_codec is None:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":615
 *                 continue
 * 
 *             codec = target_codec.copy()             # <<<<<<<<<<<<<<
 *             codec.oid = typeoid
 *             codec.name = typename
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_5Codec_copy(__pyx_v_target_codec)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":616
 * 
 *             codec = target_codec.copy()
 *             codec.oid = typeoid             # <<<<<<<<<<<<<<
 *             codec.name = typename
 *             codec.schema = typeschema
 */
    __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_typeoid); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 616, __pyx_L1_error)
    __pyx_v_codec->oid = __pyx_t_1;

    /* "asyncpg/protocol/codecs/base.pyx":617
 *             codec = target_codec.copy()
 *             codec.oid = typeoid
 *             codec.name = typename             # <<<<<<<<<<<<<<
 *             codec.schema = typeschema
 *             codec.kind = typekind
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typename))||((__pyx_v_typename) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typename)->tp_name), 0))) __PYX_ERR(4, 617, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_typename;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_codec->name);
    __Pyx_DECREF(__pyx_v_codec->name);
    __pyx_v_codec->name = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":618
 *             codec.oid = typeoid
 *             codec.name = typename
 *             codec.schema = typeschema             # <<<<<<<<<<<<<<
 *             codec.kind = typekind
 * 
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typeschema))||((__pyx_v_typeschema) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typeschema)->tp_name), 0))) __PYX_ERR(4, 618, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_typeschema;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_codec->schema);
    __Pyx_DECREF(__pyx_v_codec->schema);
    __pyx_v_codec->schema = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":619
 *             codec.name = typename
 *             codec.schema = typeschema
 *             codec.kind = typekind             # <<<<<<<<<<<<<<
 * 
 *             self._custom_type_codecs[typeoid, format] = codec
 */
    if (!(likely(PyUnicode_CheckExact(__pyx_v_typekind))||((__pyx_v_typekind) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_typekind)->tp_name), 0))) __PYX_ERR(4, 619, __pyx_L1_error)
    __pyx_t_3 = __pyx_v_typekind;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_codec->kind);
    __Pyx_DECREF(__pyx_v_codec->kind);
    __pyx_v_codec->kind = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":621
 *             codec.kind = typekind
 * 
 *             self._custom_type_codecs[typeoid, format] = codec             # <<<<<<<<<<<<<<
 *             codec_set = True
 * 
 */
    if (unlikely(__pyx_v_self->_custom_type_codecs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 621, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_format);
    __Pyx_GIVEREF(__pyx_v_format);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_format);
    if (unlikely(PyDict_SetItem(__pyx_v_self->_custom_type_codecs, __pyx_t_3, ((PyObject *)__pyx_v_codec)) < 0)) __PYX_ERR(4, 621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":622
 * 
 *             self._custom_type_codecs[typeoid, format] = codec
 *             codec_set = True             # <<<<<<<<<<<<<<
 * 
 *         if not codec_set:
 */
    __pyx_v_codec_set = 1;

    /* "asyncpg/protocol/codecs/base.pyx":606
 *             alias_oid = BUILTIN_TYPE_NAME_MAP.get(alias_to, 0)
 * 
 *         for format in formats:             # <<<<<<<<<<<<<<
 *             if alias_oid != 0:
 *                 target_codec = self.get_codec(alias_oid, format)
 */
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":624
 *             codec_set = True
 * 
 *         if not codec_set:             # <<<<<<<<<<<<<<
 *             if format == PG_FORMAT_BINARY:
 *                 codec_str = 'binary'
 */
  __pyx_t_4 = ((!(__pyx_v_codec_set != 0)) != 0);
  if (__pyx_t_4) {

    /* "asyncpg/protocol/codecs/base.pyx":625
 * 
 *         if not codec_set:
 *             if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 codec_str = 'binary'
 *             elif format == PG_FORMAT_TEXT:
 */
    __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 625, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 625, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":626
 *         if not codec_set:
 *             if format == PG_FORMAT_BINARY:
 *                 codec_str = 'binary'             # <<<<<<<<<<<<<<
 *             elif format == PG_FORMAT_TEXT:
 *                 codec_str = 'text'
 */
      __Pyx_INCREF(__pyx_n_u_binary);
      __pyx_v_codec_str = __pyx_n_u_binary;

      /* "asyncpg/protocol/codecs/base.pyx":625
 * 
 *         if not codec_set:
 *             if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *                 codec_str = 'binary'
 *             elif format == PG_FORMAT_TEXT:
 */
      goto __pyx_L10;
    }

    /* "asyncpg/protocol/codecs/base.pyx":627
 *             if format == PG_FORMAT_BINARY:
 *                 codec_str = 'binary'
 *             elif format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                 codec_str = 'text'
 *             else:
 */
    __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 627, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_format, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 627, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 627, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":628
 *                 codec_str = 'binary'
 *             elif format == PG_FORMAT_TEXT:
 *                 codec_str = 'text'             # <<<<<<<<<<<<<<
 *             else:
 *                 codec_str = 'text or binary'
 */
      __Pyx_INCREF(__pyx_n_u_text);
      __pyx_v_codec_str = __pyx_n_u_text;

      /* "asyncpg/protocol/codecs/base.pyx":627
 *             if format == PG_FORMAT_BINARY:
 *                 codec_str = 'binary'
 *             elif format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *                 codec_str = 'text'
 *             else:
 */
      goto __pyx_L10;
    }

    /* "asyncpg/protocol/codecs/base.pyx":630
 *                 codec_str = 'text'
 *             else:
 *                 codec_str = 'text or binary'             # <<<<<<<<<<<<<<
 * 
 *             raise exceptions.InterfaceError(
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_kp_u_text_or_binary_2);
      __pyx_v_codec_str = __pyx_kp_u_text_or_binary_2;
    }
    __pyx_L10:;

    /* "asyncpg/protocol/codecs/base.pyx":632
 *                 codec_str = 'text or binary'
 * 
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 f'cannot alias {typename} to {alias_to}: '
 *                 f'there is no {codec_str} codec for {alias_to}')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":633
 * 
 *             raise exceptions.InterfaceError(
 *                 f'cannot alias {typename} to {alias_to}: '             # <<<<<<<<<<<<<<
 *                 f'there is no {codec_str} codec for {alias_to}')
 * 
 */
    __pyx_t_3 = PyTuple_New(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = 0;
    __pyx_t_12 = 127;
    __Pyx_INCREF(__pyx_kp_u_cannot_alias);
    __pyx_t_9 += 13;
    __Pyx_GIVEREF(__pyx_kp_u_cannot_alias);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_cannot_alias);
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_typename, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_kp_u_to);
    __pyx_t_9 += 4;
    __Pyx_GIVEREF(__pyx_kp_u_to);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_to);
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_alias_to, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_kp_u_there_is_no);
    __pyx_t_9 += 14;
    __Pyx_GIVEREF(__pyx_kp_u_there_is_no);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_there_is_no);

    /* "asyncpg/protocol/codecs/base.pyx":634
 *             raise exceptions.InterfaceError(
 *                 f'cannot alias {typename} to {alias_to}: '
 *                 f'there is no {codec_str} codec for {alias_to}')             # <<<<<<<<<<<<<<
 * 
 *     def set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,
 */
    __Pyx_INCREF(__pyx_v_codec_str);
    __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_codec_str) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_codec_str) : __pyx_t_12;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_codec_str);
    __Pyx_GIVEREF(__pyx_v_codec_str);
    PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_codec_str);
    __Pyx_INCREF(__pyx_kp_u_codec_for);
    __pyx_t_9 += 11;
    __Pyx_GIVEREF(__pyx_kp_u_codec_for);
    PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_kp_u_codec_for);
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_alias_to, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 634, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":633
 * 
 *             raise exceptions.InterfaceError(
 *                 f'cannot alias {typename} to {alias_to}: '             # <<<<<<<<<<<<<<
 *                 f'there is no {codec_str} codec for {alias_to}')
 * 
 */
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 8, __pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 633, __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 && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(4, 632, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":624
 *             codec_set = True
 * 
 *         if not codec_set:             # <<<<<<<<<<<<<<
 *             if format == PG_FORMAT_BINARY:
 *                 codec_str = 'binary'
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":587
 *         self.clear_type_cache()
 * 
 *     def _set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                 alias_to, format=PG_FORMAT_ANY):
 *         cdef:
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig._set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF((PyObject *)__pyx_v_target_codec);
  __Pyx_XDECREF(__pyx_v_formats);
  __Pyx_XDECREF(__pyx_v_codec_str);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":636
 *                 f'there is no {codec_str} codec for {alias_to}')
 * 
 *     def set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                alias_to, format=PG_FORMAT_ANY):
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_11set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_11set_builtin_type_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_typeoid = 0;
  PyObject *__pyx_v_typename = 0;
  PyObject *__pyx_v_typeschema = 0;
  PyObject *__pyx_v_typekind = 0;
  PyObject *__pyx_v_alias_to = 0;
  PyObject *__pyx_v_format = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_builtin_type_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typeoid,&__pyx_n_s_typename,&__pyx_n_s_typeschema,&__pyx_n_s_typekind,&__pyx_n_s_alias_to,&__pyx_n_s_format,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = __pyx_k__11;
    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_typeoid)) != 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_typename)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 0, 5, 6, 1); __PYX_ERR(4, 636, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typeschema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 0, 5, 6, 2); __PYX_ERR(4, 636, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typekind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 0, 5, 6, 3); __PYX_ERR(4, 636, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alias_to)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 0, 5, 6, 4); __PYX_ERR(4, 636, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_builtin_type_codec") < 0)) __PYX_ERR(4, 636, __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);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_typeoid = values[0];
    __pyx_v_typename = values[1];
    __pyx_v_typeschema = values[2];
    __pyx_v_typekind = values[3];
    __pyx_v_alias_to = values[4];
    __pyx_v_format = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_builtin_type_codec", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_10set_builtin_type_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_10set_builtin_type_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, PyObject *__pyx_v_typeoid, PyObject *__pyx_v_typename, PyObject *__pyx_v_typeschema, PyObject *__pyx_v_typekind, PyObject *__pyx_v_alias_to, PyObject *__pyx_v_format) {
  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("set_builtin_type_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":638
 *     def set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,
 *                                alias_to, format=PG_FORMAT_ANY):
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                      alias_to, format)
 *         self.clear_type_cache()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_builtin_type_codec_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asyncpg/protocol/codecs/base.pyx":639
 *                                alias_to, format=PG_FORMAT_ANY):
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,
 *                                      alias_to, format)             # <<<<<<<<<<<<<<
 *         self.clear_type_cache()
 * 
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 6+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 638, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_typeoid, __pyx_v_typename, __pyx_v_typeschema, __pyx_v_typekind, __pyx_v_alias_to, __pyx_v_format};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 6+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 638, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(6+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_typeoid);
    __Pyx_GIVEREF(__pyx_v_typeoid);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_typeoid);
    __Pyx_INCREF(__pyx_v_typename);
    __Pyx_GIVEREF(__pyx_v_typename);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_typename);
    __Pyx_INCREF(__pyx_v_typeschema);
    __Pyx_GIVEREF(__pyx_v_typeschema);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_typeschema);
    __Pyx_INCREF(__pyx_v_typekind);
    __Pyx_GIVEREF(__pyx_v_typekind);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_typekind);
    __Pyx_INCREF(__pyx_v_alias_to);
    __Pyx_GIVEREF(__pyx_v_alias_to);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_alias_to);
    __Pyx_INCREF(__pyx_v_format);
    __Pyx_GIVEREF(__pyx_v_format);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_format);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 638, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":640
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,
 *                                      alias_to, format)
 *         self.clear_type_cache()             # <<<<<<<<<<<<<<
 * 
 *     def clear_type_cache(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear_type_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 640, __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;

  /* "asyncpg/protocol/codecs/base.pyx":636
 *                 f'there is no {codec_str} codec for {alias_to}')
 * 
 *     def set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,             # <<<<<<<<<<<<<<
 *                                alias_to, format=PG_FORMAT_ANY):
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,
 */

  /* 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("asyncpg.protocol.protocol.DataCodecConfig.set_builtin_type_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":642
 *         self.clear_type_cache()
 * 
 *     def clear_type_cache(self):             # <<<<<<<<<<<<<<
 *         self._derived_type_codecs.clear()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_13clear_type_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_13clear_type_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_type_cache (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_12clear_type_cache(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_12clear_type_cache(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_type_cache", 0);

  /* "asyncpg/protocol/codecs/base.pyx":643
 * 
 *     def clear_type_cache(self):
 *         self._derived_type_codecs.clear()             # <<<<<<<<<<<<<<
 * 
 *     def declare_fallback_codec(self, uint32_t oid, str name, str schema):
 */
  if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(4, 643, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->_derived_type_codecs); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 643, __pyx_L1_error)

  /* "asyncpg/protocol/codecs/base.pyx":642
 *         self.clear_type_cache()
 * 
 *     def clear_type_cache(self):             # <<<<<<<<<<<<<<
 *         self._derived_type_codecs.clear()
 * 
 */

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

/* "asyncpg/protocol/codecs/base.pyx":645
 *         self._derived_type_codecs.clear()
 * 
 *     def declare_fallback_codec(self, uint32_t oid, str name, str schema):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_15declare_fallback_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_15declare_fallback_codec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint32_t __pyx_v_oid;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_schema = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("declare_fallback_codec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_oid,&__pyx_n_s_name,&__pyx_n_s_schema,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_oid)) != 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("declare_fallback_codec", 1, 3, 3, 1); __PYX_ERR(4, 645, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_schema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("declare_fallback_codec", 1, 3, 3, 2); __PYX_ERR(4, 645, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "declare_fallback_codec") < 0)) __PYX_ERR(4, 645, __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_oid = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_oid == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 645, __pyx_L3_error)
    __pyx_v_name = ((PyObject*)values[1]);
    __pyx_v_schema = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("declare_fallback_codec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 645, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.declare_fallback_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(4, 645, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), (&PyUnicode_Type), 1, "schema", 1))) __PYX_ERR(4, 645, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_14declare_fallback_codec(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), __pyx_v_oid, __pyx_v_name, __pyx_v_schema);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_14declare_fallback_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, PyObject *__pyx_v_name, PyObject *__pyx_v_schema) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  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;
  Py_ssize_t __pyx_t_5;
  Py_UCS4 __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  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("declare_fallback_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":648
 *         cdef Codec codec
 * 
 *         if oid <= MAXBUILTINOID:             # <<<<<<<<<<<<<<
 *             # This is a BKI type, for which asyncpg has no
 *             # defined codec.  This should only happen for newly
 */
  __pyx_t_1 = ((__pyx_v_oid <= 0x270F) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/codecs/base.pyx":654
 *             # asyncpg is lacking support.
 *             #
 *             raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *                 f'unhandled standard data type {name!r} (OID {oid})')
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_UnsupportedClientFeatureError); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":655
 *             #
 *             raise exceptions.UnsupportedClientFeatureError(
 *                 f'unhandled standard data type {name!r} (OID {oid})')             # <<<<<<<<<<<<<<
 *         else:
 *             # This is a non-BKI type, and as such, has no
 */
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_6 = 127;
    __Pyx_INCREF(__pyx_kp_u_unhandled_standard_data_type);
    __pyx_t_5 += 29;
    __Pyx_GIVEREF(__pyx_kp_u_unhandled_standard_data_type);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_unhandled_standard_data_type);
    __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_name), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u_OID);
    __pyx_t_5 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_OID);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_OID);
    __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_INCREF(__pyx_kp_u__12);
    __pyx_t_5 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__12);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__12);
    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 654, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":648
 *         cdef Codec codec
 * 
 *         if oid <= MAXBUILTINOID:             # <<<<<<<<<<<<<<
 *             # This is a BKI type, for which asyncpg has no
 *             # defined codec.  This should only happen for newly
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":663
 *             # using Connection.set_type_codec().
 *             #
 *             self._set_builtin_type_codec(oid, name, schema, 'scalar',             # <<<<<<<<<<<<<<
 *                                          TEXTOID, PG_FORMAT_TEXT)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_builtin_type_codec_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "asyncpg/protocol/codecs/base.pyx":664
 *             #
 *             self._set_builtin_type_codec(oid, name, schema, 'scalar',
 *                                          TEXTOID, PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 *             codec = self.get_codec(oid, PG_FORMAT_TEXT)
 */
    __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    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 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_8, __pyx_v_name, __pyx_v_schema, __pyx_n_u_scalar, __pyx_int_25, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 663, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_8, __pyx_v_name, __pyx_v_schema, __pyx_n_u_scalar, __pyx_int_25, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 663, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_name);
      __Pyx_INCREF(__pyx_v_schema);
      __Pyx_GIVEREF(__pyx_v_schema);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_schema);
      __Pyx_INCREF(__pyx_n_u_scalar);
      __Pyx_GIVEREF(__pyx_n_u_scalar);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_n_u_scalar);
      __Pyx_INCREF(__pyx_int_25);
      __Pyx_GIVEREF(__pyx_int_25);
      PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_int_25);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_9, __pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":666
 *                                          TEXTOID, PG_FORMAT_TEXT)
 * 
 *             codec = self.get_codec(oid, PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 *         return codec
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "asyncpg/protocol/codecs/base.pyx":668
 *             codec = self.get_codec(oid, PG_FORMAT_TEXT)
 * 
 *         return codec             # <<<<<<<<<<<<<<
 * 
 *     cdef inline Codec get_codec(self, uint32_t oid, ServerDataFormat format,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = ((PyObject *)__pyx_v_codec);
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":645
 *         self._derived_type_codecs.clear()
 * 
 *     def declare_fallback_codec(self, uint32_t oid, str name, str schema):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.declare_fallback_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":670
 *         return codec
 * 
 *     cdef inline Codec get_codec(self, uint32_t oid, ServerDataFormat format,             # <<<<<<<<<<<<<<
 *                                 bint ignore_custom_codec=False):
 *         cdef Codec codec
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec *__pyx_optional_args) {

  /* "asyncpg/protocol/codecs/base.pyx":671
 * 
 *     cdef inline Codec get_codec(self, uint32_t oid, ServerDataFormat format,
 *                                 bint ignore_custom_codec=False):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */
  int __pyx_v_ignore_custom_codec = ((int)0);
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_codec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_ignore_custom_codec = __pyx_optional_args->ignore_custom_codec;
    }
  }

  /* "asyncpg/protocol/codecs/base.pyx":674
 *         cdef Codec codec
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             codec = self.get_codec(
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 */
  __pyx_t_1 = ((__pyx_v_format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":675
 * 
 *         if format == PG_FORMAT_ANY:
 *             codec = self.get_codec(             # <<<<<<<<<<<<<<
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 *             if codec is None:
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.ignore_custom_codec = __pyx_v_ignore_custom_codec;
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":677
 *             codec = self.get_codec(
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 codec = self.get_codec(
 *                     oid, PG_FORMAT_TEXT, ignore_custom_codec)
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":678
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 *             if codec is None:
 *                 codec = self.get_codec(             # <<<<<<<<<<<<<<
 *                     oid, PG_FORMAT_TEXT, ignore_custom_codec)
 *             return codec
 */
      __pyx_t_3.__pyx_n = 1;
      __pyx_t_3.ignore_custom_codec = __pyx_v_ignore_custom_codec;
      __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":677
 *             codec = self.get_codec(
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 codec = self.get_codec(
 *                     oid, PG_FORMAT_TEXT, ignore_custom_codec)
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":680
 *                 codec = self.get_codec(
 *                     oid, PG_FORMAT_TEXT, ignore_custom_codec)
 *             return codec             # <<<<<<<<<<<<<<
 *         else:
 *             if not ignore_custom_codec:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_codec));
    __pyx_r = __pyx_v_codec;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":674
 *         cdef Codec codec
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             codec = self.get_codec(
 *                 oid, PG_FORMAT_BINARY, ignore_custom_codec)
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":682
 *             return codec
 *         else:
 *             if not ignore_custom_codec:             # <<<<<<<<<<<<<<
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:
 */
  /*else*/ {
    __pyx_t_4 = ((!(__pyx_v_ignore_custom_codec != 0)) != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":683
 *         else:
 *             if not ignore_custom_codec:
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)             # <<<<<<<<<<<<<<
 *                 if codec is not None:
 *                     if codec.format != format:
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":684
 *             if not ignore_custom_codec:
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:             # <<<<<<<<<<<<<<
 *                     if codec.format != format:
 *                         # The codec for this OID has been overridden by
 */
      __pyx_t_4 = (((PyObject *)__pyx_v_codec) != Py_None);
      __pyx_t_1 = (__pyx_t_4 != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/base.pyx":685
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:
 *                     if codec.format != format:             # <<<<<<<<<<<<<<
 *                         # The codec for this OID has been overridden by
 *                         # set_{builtin}_type_codec with a different format.
 */
        __pyx_t_1 = ((__pyx_v_codec->format != __pyx_v_format) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/base.pyx":689
 *                         # set_{builtin}_type_codec with a different format.
 *                         # We must respect that and not return a core codec.
 *                         return None             # <<<<<<<<<<<<<<
 *                     else:
 *                         return codec
 */
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); __Pyx_INCREF(Py_None);
          goto __pyx_L0;

          /* "asyncpg/protocol/codecs/base.pyx":685
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:
 *                     if codec.format != format:             # <<<<<<<<<<<<<<
 *                         # The codec for this OID has been overridden by
 *                         # set_{builtin}_type_codec with a different format.
 */
        }

        /* "asyncpg/protocol/codecs/base.pyx":691
 *                         return None
 *                     else:
 *                         return codec             # <<<<<<<<<<<<<<
 * 
 *             codec = get_core_codec(oid, format)
 */
        /*else*/ {
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          __Pyx_INCREF(((PyObject *)__pyx_v_codec));
          __pyx_r = __pyx_v_codec;
          goto __pyx_L0;
        }

        /* "asyncpg/protocol/codecs/base.pyx":684
 *             if not ignore_custom_codec:
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:             # <<<<<<<<<<<<<<
 *                     if codec.format != format:
 *                         # The codec for this OID has been overridden by
 */
      }

      /* "asyncpg/protocol/codecs/base.pyx":682
 *             return codec
 *         else:
 *             if not ignore_custom_codec:             # <<<<<<<<<<<<<<
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_ANY)
 *                 if codec is not None:
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":693
 *                         return codec
 * 
 *             codec = get_core_codec(oid, format)             # <<<<<<<<<<<<<<
 *             if codec is not None:
 *                 return codec
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(__pyx_v_oid, __pyx_v_format, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":694
 * 
 *             codec = get_core_codec(oid, format)
 *             if codec is not None:             # <<<<<<<<<<<<<<
 *                 return codec
 *             else:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_codec) != Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":695
 *             codec = get_core_codec(oid, format)
 *             if codec is not None:
 *                 return codec             # <<<<<<<<<<<<<<
 *             else:
 *                 try:
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_codec));
      __pyx_r = __pyx_v_codec;
      goto __pyx_L0;

      /* "asyncpg/protocol/codecs/base.pyx":694
 * 
 *             codec = get_core_codec(oid, format)
 *             if codec is not None:             # <<<<<<<<<<<<<<
 *                 return codec
 *             else:
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":697
 *                 return codec
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return self._derived_type_codecs[oid, format]
 *                 except KeyError:
 */
    /*else*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "asyncpg/protocol/codecs/base.pyx":698
 *             else:
 *                 try:
 *                     return self._derived_type_codecs[oid, format]             # <<<<<<<<<<<<<<
 *                 except KeyError:
 *                     return None
 */
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          if (unlikely(__pyx_v_self->_derived_type_codecs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(4, 698, __pyx_L9_error)
          }
          __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 698, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 698, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 698, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
          __pyx_t_2 = 0;
          __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_self->_derived_type_codecs, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 698, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 698, __pyx_L9_error)
          __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L13_try_return;

          /* "asyncpg/protocol/codecs/base.pyx":697
 *                 return codec
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return self._derived_type_codecs[oid, format]
 *                 except KeyError:
 */
        }
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "asyncpg/protocol/codecs/base.pyx":699
 *                 try:
 *                     return self._derived_type_codecs[oid, format]
 *                 except KeyError:             # <<<<<<<<<<<<<<
 *                     return None
 * 
 */
        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_10) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.get_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(4, 699, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_2);

          /* "asyncpg/protocol/codecs/base.pyx":700
 *                     return self._derived_type_codecs[oid, format]
 *                 except KeyError:
 *                     return None             # <<<<<<<<<<<<<<
 * 
 *     cdef inline Codec get_custom_codec(
 */
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); __Pyx_INCREF(Py_None);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L12_except_return;
        }
        goto __pyx_L11_except_error;
        __pyx_L11_except_error:;

        /* "asyncpg/protocol/codecs/base.pyx":697
 *                 return codec
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return self._derived_type_codecs[oid, format]
 *                 except KeyError:
 */
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L13_try_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L12_except_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L0;
      }
    }
  }

  /* "asyncpg/protocol/codecs/base.pyx":670
 *         return codec
 * 
 *     cdef inline Codec get_codec(self, uint32_t oid, ServerDataFormat format,             # <<<<<<<<<<<<<<
 *                                 bint ignore_custom_codec=False):
 *         cdef Codec codec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.get_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":702
 *                     return None
 * 
 *     cdef inline Codec get_custom_codec(             # <<<<<<<<<<<<<<
 *         self,
 *         uint32_t oid,
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_custom_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":709
 *         cdef Codec codec
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)
 *             if codec is None:
 */
  __pyx_t_1 = ((__pyx_v_format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":710
 * 
 *         if format == PG_FORMAT_ANY:
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 *             if codec is None:
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_TEXT)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":711
 *         if format == PG_FORMAT_ANY:
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_TEXT)
 *         else:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "asyncpg/protocol/codecs/base.pyx":712
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)
 *             if codec is None:
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 *         else:
 *             codec = self._custom_type_codecs.get((oid, format))
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec(__pyx_v_self, __pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":711
 *         if format == PG_FORMAT_ANY:
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_TEXT)
 *         else:
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":709
 *         cdef Codec codec
 * 
 *         if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *             codec = self.get_custom_codec(oid, PG_FORMAT_BINARY)
 *             if codec is None:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/base.pyx":714
 *                 codec = self.get_custom_codec(oid, PG_FORMAT_TEXT)
 *         else:
 *             codec = self._custom_type_codecs.get((oid, format))             # <<<<<<<<<<<<<<
 * 
 *         return codec
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->_custom_type_codecs == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
      __PYX_ERR(4, 714, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_custom_type_codecs, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 714, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 714, __pyx_L1_error)
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/base.pyx":716
 *             codec = self._custom_type_codecs.get((oid, format))
 * 
 *         return codec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":702
 *                     return None
 * 
 *     cdef inline Codec get_custom_codec(             # <<<<<<<<<<<<<<
 *         self,
 *         uint32_t oid,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.get_custom_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_17__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_7asyncpg_8protocol_8protocol_15DataCodecConfig_16__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_16__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  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("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._custom_type_codecs, self._derived_type_codecs)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_custom_type_codecs);
  __Pyx_GIVEREF(__pyx_v_self->_custom_type_codecs);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_custom_type_codecs);
  __Pyx_INCREF(__pyx_v_self->_derived_type_codecs);
  __Pyx_GIVEREF(__pyx_v_self->_derived_type_codecs);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_derived_type_codecs);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._custom_type_codecs, self._derived_type_codecs)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self._custom_type_codecs, self._derived_type_codecs)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._custom_type_codecs is not None or self._derived_type_codecs is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._custom_type_codecs, self._derived_type_codecs)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._custom_type_codecs is not None or self._derived_type_codecs is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, None), state
 */
  /*else*/ {
    __pyx_t_2 = (__pyx_v_self->_custom_type_codecs != ((PyObject*)Py_None));
    __pyx_t_5 = (__pyx_t_2 != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_3 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->_derived_type_codecs != ((PyObject*)Py_None));
    __pyx_t_2 = (__pyx_t_5 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._custom_type_codecs is not None or self._derived_type_codecs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self._custom_type_codecs is not None or self._derived_type_codecs is not None
 *     if use_setstate:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_DataCodecConfig); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_120810133);
    __Pyx_GIVEREF(__pyx_int_120810133);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_120810133);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._custom_type_codecs is not None or self._derived_type_codecs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, None), state
 *     else:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_DataCodecConfig__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_DataCodecConfig); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_120810133);
    __Pyx_GIVEREF(__pyx_int_120810133);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_120810133);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_DataCodecConfig__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_19__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_7asyncpg_8protocol_8protocol_15DataCodecConfig_18__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_15DataCodecConfig_18__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v_self, 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)":17
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_DataCodecConfig__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_DataCodecConfig__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_DataCodecConfig, (type(self), 0x7336a95, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_DataCodecConfig__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.DataCodecConfig.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":719
 * 
 * 
 * cdef inline Codec get_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec *__pyx_optional_args) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat = __pyx_k__13;
  void *__pyx_v_ptr;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_core_codec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_xformat = __pyx_optional_args->xformat;
    }
  }

  /* "asyncpg/protocol/codecs/base.pyx":723
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 *     cdef:
 *         void *ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     if oid > MAXSUPPORTEDOID:
 */
  __pyx_v_ptr = NULL;

  /* "asyncpg/protocol/codecs/base.pyx":725
 *         void *ptr = NULL
 * 
 *     if oid > MAXSUPPORTEDOID:             # <<<<<<<<<<<<<<
 *         return None
 *     if format == PG_FORMAT_BINARY:
 */
  __pyx_t_1 = ((__pyx_v_oid > 0x13D8) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":726
 * 
 *     if oid > MAXSUPPORTEDOID:
 *         return None             # <<<<<<<<<<<<<<
 *     if format == PG_FORMAT_BINARY:
 *         ptr = binary_codec_map[oid * xformat]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":725
 *         void *ptr = NULL
 * 
 *     if oid > MAXSUPPORTEDOID:             # <<<<<<<<<<<<<<
 *         return None
 *     if format == PG_FORMAT_BINARY:
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":727
 *     if oid > MAXSUPPORTEDOID:
 *         return None
 *     if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *         ptr = binary_codec_map[oid * xformat]
 *     elif format == PG_FORMAT_TEXT:
 */
  switch (__pyx_v_format) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY:

    /* "asyncpg/protocol/codecs/base.pyx":728
 *         return None
 *     if format == PG_FORMAT_BINARY:
 *         ptr = binary_codec_map[oid * xformat]             # <<<<<<<<<<<<<<
 *     elif format == PG_FORMAT_TEXT:
 *         ptr = text_codec_map[oid * xformat]
 */
    __pyx_v_ptr = (__pyx_v_7asyncpg_8protocol_8protocol_binary_codec_map[(__pyx_v_oid * __pyx_v_xformat)]);

    /* "asyncpg/protocol/codecs/base.pyx":727
 *     if oid > MAXSUPPORTEDOID:
 *         return None
 *     if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *         ptr = binary_codec_map[oid * xformat]
 *     elif format == PG_FORMAT_TEXT:
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT:

    /* "asyncpg/protocol/codecs/base.pyx":730
 *         ptr = binary_codec_map[oid * xformat]
 *     elif format == PG_FORMAT_TEXT:
 *         ptr = text_codec_map[oid * xformat]             # <<<<<<<<<<<<<<
 * 
 *     if ptr is NULL:
 */
    __pyx_v_ptr = (__pyx_v_7asyncpg_8protocol_8protocol_text_codec_map[(__pyx_v_oid * __pyx_v_xformat)]);

    /* "asyncpg/protocol/codecs/base.pyx":729
 *     if format == PG_FORMAT_BINARY:
 *         ptr = binary_codec_map[oid * xformat]
 *     elif format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *         ptr = text_codec_map[oid * xformat]
 * 
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/codecs/base.pyx":732
 *         ptr = text_codec_map[oid * xformat]
 * 
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":733
 * 
 *     if ptr is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <Codec>ptr
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/base.pyx":732
 *         ptr = text_codec_map[oid * xformat]
 * 
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":735
 *         return None
 *     else:
 *         return <Codec>ptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_ptr)));
    __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_v_ptr);
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/codecs/base.pyx":719
 * 
 * 
 * cdef inline Codec get_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */

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

/* "asyncpg/protocol/codecs/base.pyx":738
 * 
 * 
 * cdef inline Codec get_any_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_get_any_core_codec(uint32_t __pyx_v_oid, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_any_core_codec *__pyx_optional_args) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat = __pyx_k__14;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_get_core_codec __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_any_core_codec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_xformat = __pyx_optional_args->xformat;
    }
  }

  /* "asyncpg/protocol/codecs/base.pyx":745
 *         Codec codec
 * 
 *     if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)
 *         if codec is None:
 */
  __pyx_t_1 = ((__pyx_v_format == __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/base.pyx":746
 * 
 *     if format == PG_FORMAT_ANY:
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)             # <<<<<<<<<<<<<<
 *         if codec is None:
 *             codec = get_core_codec(oid, PG_FORMAT_TEXT, xformat)
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.xformat = __pyx_v_xformat;
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(__pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":747
 *     if format == PG_FORMAT_ANY:
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)
 *         if codec is None:             # <<<<<<<<<<<<<<
 *             codec = get_core_codec(oid, PG_FORMAT_TEXT, xformat)
 *     else:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/base.pyx":748
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)
 *         if codec is None:
 *             codec = get_core_codec(oid, PG_FORMAT_TEXT, xformat)             # <<<<<<<<<<<<<<
 *     else:
 *         codec = get_core_codec(oid, format, xformat)
 */
      __pyx_t_3.__pyx_n = 1;
      __pyx_t_3.xformat = __pyx_v_xformat;
      __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(__pyx_v_oid, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 748, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/base.pyx":747
 *     if format == PG_FORMAT_ANY:
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)
 *         if codec is None:             # <<<<<<<<<<<<<<
 *             codec = get_core_codec(oid, PG_FORMAT_TEXT, xformat)
 *     else:
 */
    }

    /* "asyncpg/protocol/codecs/base.pyx":745
 *         Codec codec
 * 
 *     if format == PG_FORMAT_ANY:             # <<<<<<<<<<<<<<
 *         codec = get_core_codec(oid, PG_FORMAT_BINARY, xformat)
 *         if codec is None:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/base.pyx":750
 *             codec = get_core_codec(oid, PG_FORMAT_TEXT, xformat)
 *     else:
 *         codec = get_core_codec(oid, format, xformat)             # <<<<<<<<<<<<<<
 * 
 *     return codec
 */
  /*else*/ {
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.xformat = __pyx_v_xformat;
    __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_get_core_codec(__pyx_v_oid, __pyx_v_format, &__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/base.pyx":752
 *         codec = get_core_codec(oid, format, xformat)
 * 
 *     return codec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_codec));
  __pyx_r = __pyx_v_codec;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":738
 * 
 * 
 * cdef inline Codec get_any_core_codec(             # <<<<<<<<<<<<<<
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.get_any_core_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":755
 * 
 * 
 * cdef inline int has_core_codec(uint32_t oid):             # <<<<<<<<<<<<<<
 *     return binary_codec_map[oid] != NULL or text_codec_map[oid] != NULL
 * 
 */

static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol_has_core_codec(uint32_t __pyx_v_oid) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("has_core_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":756
 * 
 * cdef inline int has_core_codec(uint32_t oid):
 *     return binary_codec_map[oid] != NULL or text_codec_map[oid] != NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((__pyx_v_7asyncpg_8protocol_8protocol_binary_codec_map[__pyx_v_oid]) != NULL);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_7asyncpg_8protocol_8protocol_text_codec_map[__pyx_v_oid]) != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":755
 * 
 * 
 * cdef inline int has_core_codec(uint32_t oid):             # <<<<<<<<<<<<<<
 *     return binary_codec_map[oid] != NULL or text_codec_map[oid] != NULL
 * 
 */

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

/* "asyncpg/protocol/codecs/base.pyx":759
 * 
 * 
 * cdef register_core_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                          encode_func encode,
 *                          decode_func decode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(uint32_t __pyx_v_oid, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_encode, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_decode, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_register_core_codec *__pyx_optional_args) {
  enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __pyx_v_xformat = __pyx_k__15;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_kind = 0;
  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;
  PyObject *__pyx_t_6 = NULL;
  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_RefNannySetupContext("register_core_codec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_xformat = __pyx_optional_args->xformat;
    }
  }

  /* "asyncpg/protocol/codecs/base.pyx":765
 *                          ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 * 
 *     if oid > MAXSUPPORTEDOID:             # <<<<<<<<<<<<<<
 *         raise exceptions.InternalClientError(
 *             'cannot register core codec for OID {}: it is greater '
 */
  __pyx_t_1 = ((__pyx_v_oid > 0x13D8) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/codecs/base.pyx":766
 * 
 *     if oid > MAXSUPPORTEDOID:
 *         raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *             'cannot register core codec for OID {}: it is greater '
 *             'than MAXSUPPORTEDOID ({})'.format(oid, MAXSUPPORTEDOID))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":768
 *         raise exceptions.InternalClientError(
 *             'cannot register core codec for OID {}: it is greater '
 *             'than MAXSUPPORTEDOID ({})'.format(oid, MAXSUPPORTEDOID))             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_register_core_codec_for_O, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_5080};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 768, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_5080};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 768, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_5080);
      __Pyx_GIVEREF(__pyx_int_5080);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_int_5080);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 766, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/base.pyx":765
 *                          ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):
 * 
 *     if oid > MAXSUPPORTEDOID:             # <<<<<<<<<<<<<<
 *         raise exceptions.InternalClientError(
 *             'cannot register core codec for OID {}: it is greater '
 */
  }

  /* "asyncpg/protocol/codecs/base.pyx":775
 *         str kind
 * 
 *     name = BUILTIN_TYPE_OID_MAP[oid]             # <<<<<<<<<<<<<<
 *     kind = 'array' if oid in ARRAY_TYPES else 'scalar'
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_OID_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_oid, uint32_t, 0, __Pyx_PyInt_From_uint32_t, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(4, 775, __pyx_L1_error)
  __pyx_v_name = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":776
 * 
 *     name = BUILTIN_TYPE_OID_MAP[oid]
 *     kind = 'array' if oid in ARRAY_TYPES else 'scalar'             # <<<<<<<<<<<<<<
 * 
 *     codec = Codec(oid)
 */
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((__pyx_t_1 != 0)) {
    __Pyx_INCREF(__pyx_n_u_array);
    __pyx_t_4 = __pyx_n_u_array;
  } else {
    __Pyx_INCREF(__pyx_n_u_scalar);
    __pyx_t_4 = __pyx_n_u_scalar;
  }
  __pyx_v_kind = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":778
 *     kind = 'array' if oid in ARRAY_TYPES else 'scalar'
 * 
 *     codec = Codec(oid)             # <<<<<<<<<<<<<<
 *     codec.init(name, 'pg_catalog', kind, CODEC_C, format, xformat,
 *                encode, decode, None, None, None, None, None, None, 0)
 */
  __pyx_t_4 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":779
 * 
 *     codec = Codec(oid)
 *     codec.init(name, 'pg_catalog', kind, CODEC_C, format, xformat,             # <<<<<<<<<<<<<<
 *                encode, decode, None, None, None, None, None, None, 0)
 *     cpython.Py_INCREF(codec)  # immortalize
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, __pyx_n_u_pg_catalog, __pyx_v_kind, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_C, __pyx_v_format, __pyx_v_xformat, __pyx_v_encode, __pyx_v_decode, Py_None, Py_None, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None), ((PyObject*)Py_None), Py_None, ((PyObject*)Py_None), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":781
 *     codec.init(name, 'pg_catalog', kind, CODEC_C, format, xformat,
 *                encode, decode, None, None, None, None, None, None, 0)
 *     cpython.Py_INCREF(codec)  # immortalize             # <<<<<<<<<<<<<<
 * 
 *     if format == PG_FORMAT_BINARY:
 */
  Py_INCREF(((PyObject *)__pyx_v_codec));

  /* "asyncpg/protocol/codecs/base.pyx":783
 *     cpython.Py_INCREF(codec)  # immortalize
 * 
 *     if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *         binary_codec_map[oid * xformat] = <void*>codec
 *     elif format == PG_FORMAT_TEXT:
 */
  switch (__pyx_v_format) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY:

    /* "asyncpg/protocol/codecs/base.pyx":784
 * 
 *     if format == PG_FORMAT_BINARY:
 *         binary_codec_map[oid * xformat] = <void*>codec             # <<<<<<<<<<<<<<
 *     elif format == PG_FORMAT_TEXT:
 *         text_codec_map[oid * xformat] = <void*>codec
 */
    (__pyx_v_7asyncpg_8protocol_8protocol_binary_codec_map[(__pyx_v_oid * __pyx_v_xformat)]) = ((void *)__pyx_v_codec);

    /* "asyncpg/protocol/codecs/base.pyx":783
 *     cpython.Py_INCREF(codec)  # immortalize
 * 
 *     if format == PG_FORMAT_BINARY:             # <<<<<<<<<<<<<<
 *         binary_codec_map[oid * xformat] = <void*>codec
 *     elif format == PG_FORMAT_TEXT:
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT:

    /* "asyncpg/protocol/codecs/base.pyx":786
 *         binary_codec_map[oid * xformat] = <void*>codec
 *     elif format == PG_FORMAT_TEXT:
 *         text_codec_map[oid * xformat] = <void*>codec             # <<<<<<<<<<<<<<
 *     else:
 *         raise exceptions.InternalClientError(
 */
    (__pyx_v_7asyncpg_8protocol_8protocol_text_codec_map[(__pyx_v_oid * __pyx_v_xformat)]) = ((void *)__pyx_v_codec);

    /* "asyncpg/protocol/codecs/base.pyx":785
 *     if format == PG_FORMAT_BINARY:
 *         binary_codec_map[oid * xformat] = <void*>codec
 *     elif format == PG_FORMAT_TEXT:             # <<<<<<<<<<<<<<
 *         text_codec_map[oid * xformat] = <void*>codec
 *     else:
 */
    break;
    default:

    /* "asyncpg/protocol/codecs/base.pyx":788
 *         text_codec_map[oid * xformat] = <void*>codec
 *     else:
 *         raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *             'invalid data format: {}'.format(format))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/base.pyx":789
 *     else:
 *         raise exceptions.InternalClientError(
 *             'invalid data format: {}'.format(format))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_data_format, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __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_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 789, __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 && 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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 788, __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(4, 788, __pyx_L1_error)
    break;
  }

  /* "asyncpg/protocol/codecs/base.pyx":759
 * 
 * 
 * cdef register_core_codec(uint32_t oid,             # <<<<<<<<<<<<<<
 *                          encode_func encode,
 *                          decode_func decode,
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.register_core_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_kind);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":792
 * 
 * 
 * cdef register_extra_codec(str name,             # <<<<<<<<<<<<<<
 *                           encode_func encode,
 *                           decode_func decode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_register_extra_codec(PyObject *__pyx_v_name, __pyx_t_7asyncpg_8protocol_8protocol_encode_func __pyx_v_encode, __pyx_t_7asyncpg_8protocol_8protocol_decode_func __pyx_v_decode, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_kind = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_extra_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":800
 *         str kind
 * 
 *     kind = 'scalar'             # <<<<<<<<<<<<<<
 * 
 *     codec = Codec(INVALIDOID)
 */
  __Pyx_INCREF(__pyx_n_u_scalar);
  __pyx_v_kind = __pyx_n_u_scalar;

  /* "asyncpg/protocol/codecs/base.pyx":802
 *     kind = 'scalar'
 * 
 *     codec = Codec(INVALIDOID)             # <<<<<<<<<<<<<<
 *     codec.init(name, None, kind, CODEC_C, format, PG_XFORMAT_OBJECT,
 *                encode, decode, None, None, None, None, None, None, 0)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_Codec), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":803
 * 
 *     codec = Codec(INVALIDOID)
 *     codec.init(name, None, kind, CODEC_C, format, PG_XFORMAT_OBJECT,             # <<<<<<<<<<<<<<
 *                encode, decode, None, None, None, None, None, None, 0)
 *     EXTRA_CODECS[name, format] = codec
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_init(__pyx_v_codec, __pyx_v_name, ((PyObject*)Py_None), __pyx_v_kind, __pyx_e_7asyncpg_8protocol_8protocol_CODEC_C, __pyx_v_format, __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT, __pyx_v_encode, __pyx_v_decode, Py_None, Py_None, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None), ((PyObject*)Py_None), Py_None, ((PyObject*)Py_None), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":805
 *     codec.init(name, None, kind, CODEC_C, format, PG_XFORMAT_OBJECT,
 *                encode, decode, None, None, None, None, None, None, 0)
 *     EXTRA_CODECS[name, format] = codec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 805, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS, __pyx_t_2, ((PyObject *)__pyx_v_codec)) < 0)) __PYX_ERR(4, 805, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":792
 * 
 * 
 * cdef register_extra_codec(str name,             # <<<<<<<<<<<<<<
 *                           encode_func encode,
 *                           decode_func decode,
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.register_extra_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_kind);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/base.pyx":808
 * 
 * 
 * cdef inline Codec get_extra_codec(str name, ServerDataFormat format):             # <<<<<<<<<<<<<<
 *     return EXTRA_CODECS.get((name, format))
 */

static CYTHON_INLINE struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_f_7asyncpg_8protocol_8protocol_get_extra_codec(PyObject *__pyx_v_name, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __pyx_v_format) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_extra_codec", 0);

  /* "asyncpg/protocol/codecs/base.pyx":809
 * 
 * cdef inline Codec get_extra_codec(str name, ServerDataFormat format):
 *     return EXTRA_CODECS.get((name, format))             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (unlikely(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(4, 809, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_v_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(4, 809, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/base.pyx":808
 * 
 * 
 * cdef inline Codec get_extra_codec(str name, ServerDataFormat format):             # <<<<<<<<<<<<<<
 *     return EXTRA_CODECS.get((name, format))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.get_extra_codec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/textutils.pyx":8
 * 
 * 
 * cdef inline uint32_t _apg_tolower(uint32_t c):             # <<<<<<<<<<<<<<
 *     if c >= <uint32_t><Py_UCS4>'A' and c <= <uint32_t><Py_UCS4>'Z':
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'
 */

static CYTHON_INLINE uint32_t __pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(uint32_t __pyx_v_c) {
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_apg_tolower", 0);

  /* "asyncpg/protocol/codecs/textutils.pyx":9
 * 
 * cdef inline uint32_t _apg_tolower(uint32_t c):
 *     if c >= <uint32_t><Py_UCS4>'A' and c <= <uint32_t><Py_UCS4>'Z':             # <<<<<<<<<<<<<<
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_c >= ((uint32_t)((Py_UCS4)65))) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_c <= ((uint32_t)((Py_UCS4)90))) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":10
 * cdef inline uint32_t _apg_tolower(uint32_t c):
 *     if c >= <uint32_t><Py_UCS4>'A' and c <= <uint32_t><Py_UCS4>'Z':
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'             # <<<<<<<<<<<<<<
 *     else:
 *         return c
 */
    __pyx_r = ((__pyx_v_c + ((uint32_t)((Py_UCS4)97))) - ((uint32_t)((Py_UCS4)65)));
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/textutils.pyx":9
 * 
 * cdef inline uint32_t _apg_tolower(uint32_t c):
 *     if c >= <uint32_t><Py_UCS4>'A' and c <= <uint32_t><Py_UCS4>'Z':             # <<<<<<<<<<<<<<
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'
 *     else:
 */
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":12
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'
 *     else:
 *         return c             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_r = __pyx_v_c;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":8
 * 
 * 
 * cdef inline uint32_t _apg_tolower(uint32_t c):             # <<<<<<<<<<<<<<
 *     if c >= <uint32_t><Py_UCS4>'A' and c <= <uint32_t><Py_UCS4>'Z':
 *         return c + <uint32_t><Py_UCS4>'a' - <uint32_t><Py_UCS4>'A'
 */

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

/* "asyncpg/protocol/codecs/textutils.pyx":15
 * 
 * 
 * cdef int apg_strcasecmp(const Py_UCS4 *s1, const Py_UCS4 *s2):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t c1
 */

static int __pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp(Py_UCS4 const *__pyx_v_s1, Py_UCS4 const *__pyx_v_s2) {
  uint32_t __pyx_v_c1;
  uint32_t __pyx_v_c2;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("apg_strcasecmp", 0);

  /* "asyncpg/protocol/codecs/textutils.pyx":19
 *         uint32_t c1
 *         uint32_t c2
 *         int i = 0             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
  __pyx_v_i = 0;

  /* "asyncpg/protocol/codecs/textutils.pyx":21
 *         int i = 0
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         c1 = s1[i]
 *         c2 = s2[i]
 */
  while (1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":22
 * 
 *     while True:
 *         c1 = s1[i]             # <<<<<<<<<<<<<<
 *         c2 = s2[i]
 * 
 */
    __pyx_v_c1 = (__pyx_v_s1[__pyx_v_i]);

    /* "asyncpg/protocol/codecs/textutils.pyx":23
 *     while True:
 *         c1 = s1[i]
 *         c2 = s2[i]             # <<<<<<<<<<<<<<
 * 
 *         if c1 != c2:
 */
    __pyx_v_c2 = (__pyx_v_s2[__pyx_v_i]);

    /* "asyncpg/protocol/codecs/textutils.pyx":25
 *         c2 = s2[i]
 * 
 *         if c1 != c2:             # <<<<<<<<<<<<<<
 *             c1 = _apg_tolower(c1)
 *             c2 = _apg_tolower(c2)
 */
    __pyx_t_1 = ((__pyx_v_c1 != __pyx_v_c2) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/textutils.pyx":26
 * 
 *         if c1 != c2:
 *             c1 = _apg_tolower(c1)             # <<<<<<<<<<<<<<
 *             c2 = _apg_tolower(c2)
 *             if c1 != c2:
 */
      __pyx_v_c1 = __pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(__pyx_v_c1);

      /* "asyncpg/protocol/codecs/textutils.pyx":27
 *         if c1 != c2:
 *             c1 = _apg_tolower(c1)
 *             c2 = _apg_tolower(c2)             # <<<<<<<<<<<<<<
 *             if c1 != c2:
 *                 return <int32_t>c1 - <int32_t>c2
 */
      __pyx_v_c2 = __pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(__pyx_v_c2);

      /* "asyncpg/protocol/codecs/textutils.pyx":28
 *             c1 = _apg_tolower(c1)
 *             c2 = _apg_tolower(c2)
 *             if c1 != c2:             # <<<<<<<<<<<<<<
 *                 return <int32_t>c1 - <int32_t>c2
 * 
 */
      __pyx_t_1 = ((__pyx_v_c1 != __pyx_v_c2) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/textutils.pyx":29
 *             c2 = _apg_tolower(c2)
 *             if c1 != c2:
 *                 return <int32_t>c1 - <int32_t>c2             # <<<<<<<<<<<<<<
 * 
 *         if c1 == 0 or c2 == 0:
 */
        __pyx_r = (((int32_t)__pyx_v_c1) - ((int32_t)__pyx_v_c2));
        goto __pyx_L0;

        /* "asyncpg/protocol/codecs/textutils.pyx":28
 *             c1 = _apg_tolower(c1)
 *             c2 = _apg_tolower(c2)
 *             if c1 != c2:             # <<<<<<<<<<<<<<
 *                 return <int32_t>c1 - <int32_t>c2
 * 
 */
      }

      /* "asyncpg/protocol/codecs/textutils.pyx":25
 *         c2 = s2[i]
 * 
 *         if c1 != c2:             # <<<<<<<<<<<<<<
 *             c1 = _apg_tolower(c1)
 *             c2 = _apg_tolower(c2)
 */
    }

    /* "asyncpg/protocol/codecs/textutils.pyx":31
 *                 return <int32_t>c1 - <int32_t>c2
 * 
 *         if c1 == 0 or c2 == 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_2 = ((__pyx_v_c1 == 0) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c2 == 0) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/textutils.pyx":32
 * 
 *         if c1 == 0 or c2 == 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         i += 1
 */
      goto __pyx_L4_break;

      /* "asyncpg/protocol/codecs/textutils.pyx":31
 *                 return <int32_t>c1 - <int32_t>c2
 * 
 *         if c1 == 0 or c2 == 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    }

    /* "asyncpg/protocol/codecs/textutils.pyx":34
 *             break
 * 
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }
  __pyx_L4_break:;

  /* "asyncpg/protocol/codecs/textutils.pyx":36
 *         i += 1
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/textutils.pyx":15
 * 
 * 
 * cdef int apg_strcasecmp(const Py_UCS4 *s1, const Py_UCS4 *s2):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t c1
 */

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

/* "asyncpg/protocol/codecs/textutils.pyx":39
 * 
 * 
 * cdef int apg_strcasecmp_char(const char *s1, const char *s2):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint8_t c1
 */

static int __pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp_char(char const *__pyx_v_s1, char const *__pyx_v_s2) {
  uint8_t __pyx_v_c1;
  uint8_t __pyx_v_c2;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("apg_strcasecmp_char", 0);

  /* "asyncpg/protocol/codecs/textutils.pyx":43
 *         uint8_t c1
 *         uint8_t c2
 *         int i = 0             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
  __pyx_v_i = 0;

  /* "asyncpg/protocol/codecs/textutils.pyx":45
 *         int i = 0
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         c1 = <uint8_t>s1[i]
 *         c2 = <uint8_t>s2[i]
 */
  while (1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":46
 * 
 *     while True:
 *         c1 = <uint8_t>s1[i]             # <<<<<<<<<<<<<<
 *         c2 = <uint8_t>s2[i]
 * 
 */
    __pyx_v_c1 = ((uint8_t)(__pyx_v_s1[__pyx_v_i]));

    /* "asyncpg/protocol/codecs/textutils.pyx":47
 *     while True:
 *         c1 = <uint8_t>s1[i]
 *         c2 = <uint8_t>s2[i]             # <<<<<<<<<<<<<<
 * 
 *         if c1 != c2:
 */
    __pyx_v_c2 = ((uint8_t)(__pyx_v_s2[__pyx_v_i]));

    /* "asyncpg/protocol/codecs/textutils.pyx":49
 *         c2 = <uint8_t>s2[i]
 * 
 *         if c1 != c2:             # <<<<<<<<<<<<<<
 *             c1 = <uint8_t>_apg_tolower(c1)
 *             c2 = <uint8_t>_apg_tolower(c2)
 */
    __pyx_t_1 = ((__pyx_v_c1 != __pyx_v_c2) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/textutils.pyx":50
 * 
 *         if c1 != c2:
 *             c1 = <uint8_t>_apg_tolower(c1)             # <<<<<<<<<<<<<<
 *             c2 = <uint8_t>_apg_tolower(c2)
 *             if c1 != c2:
 */
      __pyx_v_c1 = ((uint8_t)__pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(__pyx_v_c1));

      /* "asyncpg/protocol/codecs/textutils.pyx":51
 *         if c1 != c2:
 *             c1 = <uint8_t>_apg_tolower(c1)
 *             c2 = <uint8_t>_apg_tolower(c2)             # <<<<<<<<<<<<<<
 *             if c1 != c2:
 *                 return <int8_t>c1 - <int8_t>c2
 */
      __pyx_v_c2 = ((uint8_t)__pyx_f_7asyncpg_8protocol_8protocol__apg_tolower(__pyx_v_c2));

      /* "asyncpg/protocol/codecs/textutils.pyx":52
 *             c1 = <uint8_t>_apg_tolower(c1)
 *             c2 = <uint8_t>_apg_tolower(c2)
 *             if c1 != c2:             # <<<<<<<<<<<<<<
 *                 return <int8_t>c1 - <int8_t>c2
 * 
 */
      __pyx_t_1 = ((__pyx_v_c1 != __pyx_v_c2) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/textutils.pyx":53
 *             c2 = <uint8_t>_apg_tolower(c2)
 *             if c1 != c2:
 *                 return <int8_t>c1 - <int8_t>c2             # <<<<<<<<<<<<<<
 * 
 *         if c1 == 0 or c2 == 0:
 */
        __pyx_r = (((int8_t)__pyx_v_c1) - ((int8_t)__pyx_v_c2));
        goto __pyx_L0;

        /* "asyncpg/protocol/codecs/textutils.pyx":52
 *             c1 = <uint8_t>_apg_tolower(c1)
 *             c2 = <uint8_t>_apg_tolower(c2)
 *             if c1 != c2:             # <<<<<<<<<<<<<<
 *                 return <int8_t>c1 - <int8_t>c2
 * 
 */
      }

      /* "asyncpg/protocol/codecs/textutils.pyx":49
 *         c2 = <uint8_t>s2[i]
 * 
 *         if c1 != c2:             # <<<<<<<<<<<<<<
 *             c1 = <uint8_t>_apg_tolower(c1)
 *             c2 = <uint8_t>_apg_tolower(c2)
 */
    }

    /* "asyncpg/protocol/codecs/textutils.pyx":55
 *                 return <int8_t>c1 - <int8_t>c2
 * 
 *         if c1 == 0 or c2 == 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_2 = ((__pyx_v_c1 == 0) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_c2 == 0) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/textutils.pyx":56
 * 
 *         if c1 == 0 or c2 == 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         i += 1
 */
      goto __pyx_L4_break;

      /* "asyncpg/protocol/codecs/textutils.pyx":55
 *                 return <int8_t>c1 - <int8_t>c2
 * 
 *         if c1 == 0 or c2 == 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    }

    /* "asyncpg/protocol/codecs/textutils.pyx":58
 *             break
 * 
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }
  __pyx_L4_break:;

  /* "asyncpg/protocol/codecs/textutils.pyx":60
 *         i += 1
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/textutils.pyx":39
 * 
 * 
 * cdef int apg_strcasecmp_char(const char *s1, const char *s2):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint8_t c1
 */

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

/* "asyncpg/protocol/codecs/textutils.pyx":63
 * 
 * 
 * cdef inline bint apg_ascii_isspace(Py_UCS4 ch):             # <<<<<<<<<<<<<<
 *     return (
 *         ch == ' ' or
 */

static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace(Py_UCS4 __pyx_v_ch) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("apg_ascii_isspace", 0);

  /* "asyncpg/protocol/codecs/textutils.pyx":65
 * cdef inline bint apg_ascii_isspace(Py_UCS4 ch):
 *     return (
 *         ch == ' ' or             # <<<<<<<<<<<<<<
 *         ch == '\n' or
 *         ch == '\r' or
 */
  switch (__pyx_v_ch) {
    case 32:
    case 10:

    /* "asyncpg/protocol/codecs/textutils.pyx":66
 *     return (
 *         ch == ' ' or
 *         ch == '\n' or             # <<<<<<<<<<<<<<
 *         ch == '\r' or
 *         ch == '\t' or
 */
    case 13:

    /* "asyncpg/protocol/codecs/textutils.pyx":67
 *         ch == ' ' or
 *         ch == '\n' or
 *         ch == '\r' or             # <<<<<<<<<<<<<<
 *         ch == '\t' or
 *         ch == '\v' or
 */
    case 9:

    /* "asyncpg/protocol/codecs/textutils.pyx":68
 *         ch == '\n' or
 *         ch == '\r' or
 *         ch == '\t' or             # <<<<<<<<<<<<<<
 *         ch == '\v' or
 *         ch == '\f'
 */
    case 11:

    /* "asyncpg/protocol/codecs/textutils.pyx":69
 *         ch == '\r' or
 *         ch == '\t' or
 *         ch == '\v' or             # <<<<<<<<<<<<<<
 *         ch == '\f'
 *     )
 */
    case 12:

    /* "asyncpg/protocol/codecs/textutils.pyx":65
 * cdef inline bint apg_ascii_isspace(Py_UCS4 ch):
 *     return (
 *         ch == ' ' or             # <<<<<<<<<<<<<<
 *         ch == '\n' or
 *         ch == '\r' or
 */
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/textutils.pyx":63
 * 
 * 
 * cdef inline bint apg_ascii_isspace(Py_UCS4 ch):             # <<<<<<<<<<<<<<
 *     return (
 *         ch == ' ' or
 */

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

/* "asyncpg/protocol/codecs/textutils.pyx":74
 * 
 * 
 * cdef Py_UCS4 *apg_parse_int32(Py_UCS4 *buf, int32_t *num):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_UCS4 *p
 */

static Py_UCS4 *__pyx_f_7asyncpg_8protocol_8protocol_apg_parse_int32(Py_UCS4 *__pyx_v_buf, int32_t *__pyx_v_num) {
  Py_UCS4 *__pyx_v_p;
  int32_t __pyx_v_n;
  int32_t __pyx_v_neg;
  Py_UCS4 *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("apg_parse_int32", 0);

  /* "asyncpg/protocol/codecs/textutils.pyx":77
 *     cdef:
 *         Py_UCS4 *p
 *         int32_t n = 0             # <<<<<<<<<<<<<<
 *         int32_t neg = 0
 * 
 */
  __pyx_v_n = 0;

  /* "asyncpg/protocol/codecs/textutils.pyx":78
 *         Py_UCS4 *p
 *         int32_t n = 0
 *         int32_t neg = 0             # <<<<<<<<<<<<<<
 * 
 *     if buf[0] == '-':
 */
  __pyx_v_neg = 0;

  /* "asyncpg/protocol/codecs/textutils.pyx":80
 *         int32_t neg = 0
 * 
 *     if buf[0] == '-':             # <<<<<<<<<<<<<<
 *         neg = 1
 *         buf += 1
 */
  __pyx_t_1 = (((__pyx_v_buf[0]) == 45) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":81
 * 
 *     if buf[0] == '-':
 *         neg = 1             # <<<<<<<<<<<<<<
 *         buf += 1
 *     elif buf[0] == '+':
 */
    __pyx_v_neg = 1;

    /* "asyncpg/protocol/codecs/textutils.pyx":82
 *     if buf[0] == '-':
 *         neg = 1
 *         buf += 1             # <<<<<<<<<<<<<<
 *     elif buf[0] == '+':
 *         buf += 1
 */
    __pyx_v_buf = (__pyx_v_buf + 1);

    /* "asyncpg/protocol/codecs/textutils.pyx":80
 *         int32_t neg = 0
 * 
 *     if buf[0] == '-':             # <<<<<<<<<<<<<<
 *         neg = 1
 *         buf += 1
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":83
 *         neg = 1
 *         buf += 1
 *     elif buf[0] == '+':             # <<<<<<<<<<<<<<
 *         buf += 1
 * 
 */
  __pyx_t_1 = (((__pyx_v_buf[0]) == 43) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":84
 *         buf += 1
 *     elif buf[0] == '+':
 *         buf += 1             # <<<<<<<<<<<<<<
 * 
 *     p = buf
 */
    __pyx_v_buf = (__pyx_v_buf + 1);

    /* "asyncpg/protocol/codecs/textutils.pyx":83
 *         neg = 1
 *         buf += 1
 *     elif buf[0] == '+':             # <<<<<<<<<<<<<<
 *         buf += 1
 * 
 */
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/textutils.pyx":86
 *         buf += 1
 * 
 *     p = buf             # <<<<<<<<<<<<<<
 *     while <int>p[0] >= <int><Py_UCS4>'0' and <int>p[0] <= <int><Py_UCS4>'9':
 *         n = 10 * n - (<int>p[0] - <int32_t><Py_UCS4>'0')
 */
  __pyx_v_p = __pyx_v_buf;

  /* "asyncpg/protocol/codecs/textutils.pyx":87
 * 
 *     p = buf
 *     while <int>p[0] >= <int><Py_UCS4>'0' and <int>p[0] <= <int><Py_UCS4>'9':             # <<<<<<<<<<<<<<
 *         n = 10 * n - (<int>p[0] - <int32_t><Py_UCS4>'0')
 *         p += 1
 */
  while (1) {
    __pyx_t_2 = ((((int)(__pyx_v_p[0])) >= ((int)((Py_UCS4)48))) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_2 = ((((int)(__pyx_v_p[0])) <= ((int)((Py_UCS4)57))) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L6_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "asyncpg/protocol/codecs/textutils.pyx":88
 *     p = buf
 *     while <int>p[0] >= <int><Py_UCS4>'0' and <int>p[0] <= <int><Py_UCS4>'9':
 *         n = 10 * n - (<int>p[0] - <int32_t><Py_UCS4>'0')             # <<<<<<<<<<<<<<
 *         p += 1
 * 
 */
    __pyx_v_n = ((10 * __pyx_v_n) - (((int)(__pyx_v_p[0])) - ((int32_t)((Py_UCS4)48))));

    /* "asyncpg/protocol/codecs/textutils.pyx":89
 *     while <int>p[0] >= <int><Py_UCS4>'0' and <int>p[0] <= <int><Py_UCS4>'9':
 *         n = 10 * n - (<int>p[0] - <int32_t><Py_UCS4>'0')
 *         p += 1             # <<<<<<<<<<<<<<
 * 
 *     if p == buf:
 */
    __pyx_v_p = (__pyx_v_p + 1);
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":91
 *         p += 1
 * 
 *     if p == buf:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  __pyx_t_1 = ((__pyx_v_p == __pyx_v_buf) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":92
 * 
 *     if p == buf:
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 *     if not neg:
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/textutils.pyx":91
 *         p += 1
 * 
 *     if p == buf:             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":94
 *         return NULL
 * 
 *     if not neg:             # <<<<<<<<<<<<<<
 *         n = -n
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_neg != 0)) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/textutils.pyx":95
 * 
 *     if not neg:
 *         n = -n             # <<<<<<<<<<<<<<
 * 
 *     num[0] = n
 */
    __pyx_v_n = (-__pyx_v_n);

    /* "asyncpg/protocol/codecs/textutils.pyx":94
 *         return NULL
 * 
 *     if not neg:             # <<<<<<<<<<<<<<
 *         n = -n
 * 
 */
  }

  /* "asyncpg/protocol/codecs/textutils.pyx":97
 *         n = -n
 * 
 *     num[0] = n             # <<<<<<<<<<<<<<
 * 
 *     return p
 */
  (__pyx_v_num[0]) = __pyx_v_n;

  /* "asyncpg/protocol/codecs/textutils.pyx":99
 *     num[0] = n
 * 
 *     return p             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/textutils.pyx":74
 * 
 * 
 * cdef Py_UCS4 *apg_parse_int32(Py_UCS4 *buf, int32_t *num):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_UCS4 *p
 */

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

/* "asyncpg/protocol/codecs/pgproto.pyx":8
 * 
 * 
 * cdef init_bits_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BITOID,
 *                         <encode_func>pgproto.bits_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_bits_codecs(void) {
  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_bits_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":9
 * 
 * cdef init_bits_codecs():
 *     register_core_codec(BITOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bits_encode,
 *                         <decode_func>pgproto.bits_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x618, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bits_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bits_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":14
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(VARBITOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bits_encode,
 *                         <decode_func>pgproto.bits_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x61A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bits_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bits_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":8
 * 
 * 
 * cdef init_bits_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BITOID,
 *                         <encode_func>pgproto.bits_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_bits_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":20
 * 
 * 
 * cdef init_bytea_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BYTEAOID,
 *                         <encode_func>pgproto.bytea_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_bytea_codecs(void) {
  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_bytea_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":21
 * 
 * cdef init_bytea_codecs():
 *     register_core_codec(BYTEAOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bytea_encode,
 *                         <decode_func>pgproto.bytea_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(17, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":26
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(CHAROID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bytea_encode,
 *                         <decode_func>pgproto.bytea_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(18, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":20
 * 
 * 
 * cdef init_bytea_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BYTEAOID,
 *                         <encode_func>pgproto.bytea_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_bytea_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":32
 * 
 * 
 * cdef init_datetime_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(DATEOID,
 *                         <encode_func>pgproto.date_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_datetime_codecs(void) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_register_core_codec __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_datetime_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":33
 * 
 * cdef init_datetime_codecs():
 *     register_core_codec(DATEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.date_encode,
 *                         <decode_func>pgproto.date_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x43A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":38
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(DATEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.date_encode_tuple,
 *                         <decode_func>pgproto.date_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x43A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":44
 *                         PG_XFORMAT_TUPLE)
 * 
 *     register_core_codec(TIMEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.time_encode,
 *                         <decode_func>pgproto.time_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x43B, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":49
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(TIMEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.time_encode_tuple,
 *                         <decode_func>pgproto.time_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x43B, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":55
 *                         PG_XFORMAT_TUPLE)
 * 
 *     register_core_codec(TIMETZOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timetz_encode,
 *                         <decode_func>pgproto.timetz_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4F2, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":60
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(TIMETZOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timetz_encode_tuple,
 *                         <decode_func>pgproto.timetz_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4F2, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":66
 *                         PG_XFORMAT_TUPLE)
 * 
 *     register_core_codec(TIMESTAMPOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timestamp_encode,
 *                         <decode_func>pgproto.timestamp_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x45A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":71
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(TIMESTAMPOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timestamp_encode_tuple,
 *                         <decode_func>pgproto.timestamp_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x45A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":77
 *                         PG_XFORMAT_TUPLE)
 * 
 *     register_core_codec(TIMESTAMPTZOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timestamptz_encode,
 *                         <decode_func>pgproto.timestamptz_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4A0, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":82
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(TIMESTAMPTZOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.timestamp_encode_tuple,
 *                         <decode_func>pgproto.timestamp_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4A0, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":88
 *                         PG_XFORMAT_TUPLE)
 * 
 *     register_core_codec(INTERVALOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.interval_encode,
 *                         <decode_func>pgproto.interval_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4A2, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":93
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(INTERVALOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.interval_encode_tuple,
 *                         <decode_func>pgproto.interval_decode_tuple,
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.xformat = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_TUPLE;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x4A2, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode_tuple), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode_tuple), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":102
 *     # interpret the value, and simply return and pass it as text.
 *     #
 *     register_core_codec(ABSTIMEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2BE, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":107
 *                         PG_FORMAT_TEXT)
 * 
 *     register_core_codec(RELTIMEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2BF, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":112
 *                         PG_FORMAT_TEXT)
 * 
 *     register_core_codec(TINTERVALOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2C0, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":32
 * 
 * 
 * cdef init_datetime_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(DATEOID,
 *                         <encode_func>pgproto.date_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_datetime_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":118
 * 
 * 
 * cdef init_float_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(FLOAT4OID,
 *                         <encode_func>pgproto.float4_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_float_codecs(void) {
  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_float_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":119
 * 
 * cdef init_float_codecs():
 *     register_core_codec(FLOAT4OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.float4_encode,
 *                         <decode_func>pgproto.float4_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2BC, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_float4_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_float4_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":124
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(FLOAT8OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.float8_encode,
 *                         <decode_func>pgproto.float8_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2BD, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_float8_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_float8_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":118
 * 
 * 
 * cdef init_float_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(FLOAT4OID,
 *                         <encode_func>pgproto.float4_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_float_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":130
 * 
 * 
 * cdef init_geometry_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BOXOID,
 *                         <encode_func>pgproto.box_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_geometry_codecs(void) {
  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_geometry_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":131
 * 
 * cdef init_geometry_codecs():
 *     register_core_codec(BOXOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.box_encode,
 *                         <decode_func>pgproto.box_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x25B, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_box_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_box_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":136
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(LINEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.line_encode,
 *                         <decode_func>pgproto.line_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x274, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_line_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_line_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":141
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(LSEGOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.lseg_encode,
 *                         <decode_func>pgproto.lseg_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x259, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":146
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(POINTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.point_encode,
 *                         <decode_func>pgproto.point_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x258, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_point_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_point_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":151
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(PATHOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.path_encode,
 *                         <decode_func>pgproto.path_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x25A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_path_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_path_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":156
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(POLYGONOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.poly_encode,
 *                         <decode_func>pgproto.poly_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x25C, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_poly_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_poly_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":161
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(CIRCLEOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.circle_encode,
 *                         <decode_func>pgproto.circle_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2CE, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_circle_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_circle_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":130
 * 
 * 
 * cdef init_geometry_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(BOXOID,
 *                         <encode_func>pgproto.box_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_geometry_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":167
 * 
 * 
 * cdef init_hstore_codecs():             # <<<<<<<<<<<<<<
 *     register_extra_codec('pg_contrib.hstore',
 *                          <encode_func>pgproto.hstore_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_hstore_codecs(void) {
  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_hstore_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":168
 * 
 * cdef init_hstore_codecs():
 *     register_extra_codec('pg_contrib.hstore',             # <<<<<<<<<<<<<<
 *                          <encode_func>pgproto.hstore_encode,
 *                          <decode_func>pgproto.hstore_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_extra_codec(__pyx_kp_u_pg_contrib_hstore, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":167
 * 
 * 
 * cdef init_hstore_codecs():             # <<<<<<<<<<<<<<
 *     register_extra_codec('pg_contrib.hstore',
 *                          <encode_func>pgproto.hstore_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_hstore_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":174
 * 
 * 
 * cdef init_json_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(JSONOID,
 *                         <encode_func>pgproto.text_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_json_codecs(void) {
  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_json_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":175
 * 
 * cdef init_json_codecs():
 *     register_core_codec(JSONOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x72, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":179
 *                         <decode_func>pgproto.text_decode,
 *                         PG_FORMAT_BINARY)
 *     register_core_codec(JSONBOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.jsonb_encode,
 *                         <decode_func>pgproto.jsonb_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xEDA, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":183
 *                         <decode_func>pgproto.jsonb_decode,
 *                         PG_FORMAT_BINARY)
 *     register_core_codec(JSONPATHOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.jsonpath_encode,
 *                         <decode_func>pgproto.jsonpath_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xFE8, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":174
 * 
 * 
 * cdef init_json_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(JSONOID,
 *                         <encode_func>pgproto.text_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_json_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":189
 * 
 * 
 * cdef init_int_codecs():             # <<<<<<<<<<<<<<
 * 
 *     register_core_codec(BOOLOID,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_int_codecs(void) {
  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_int_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":191
 * cdef init_int_codecs():
 * 
 *     register_core_codec(BOOLOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bool_encode,
 *                         <decode_func>pgproto.bool_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(16, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bool_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bool_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":196
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(INT2OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.int2_encode,
 *                         <decode_func>pgproto.int2_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(21, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int2_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int2_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":201
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(INT4OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.int4_encode,
 *                         <decode_func>pgproto.int4_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(23, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int4_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int4_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":206
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(INT8OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.int8_encode,
 *                         <decode_func>pgproto.int8_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(20, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int8_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int8_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":189
 * 
 * 
 * cdef init_int_codecs():             # <<<<<<<<<<<<<<
 * 
 *     register_core_codec(BOOLOID,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_int_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":212
 * 
 * 
 * cdef init_pseudo_codecs():             # <<<<<<<<<<<<<<
 *     # Void type is returned by SELECT void_returning_function()
 *     register_core_codec(VOIDOID,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_pseudo_codecs(void) {
  PyObject *__pyx_v_oid_types = NULL;
  PyObject *__pyx_v_oid_type = NULL;
  PyObject *__pyx_v_oid8_types = NULL;
  PyObject *__pyx_v_reg_types = NULL;
  PyObject *__pyx_v_reg_type = NULL;
  PyObject *__pyx_v_no_io_types = NULL;
  PyObject *__pyx_v_no_io_type = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_pseudo_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":214
 * cdef init_pseudo_codecs():
 *     # Void type is returned by SELECT void_returning_function()
 *     register_core_codec(VOIDOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.void_encode,
 *                         <decode_func>pgproto.void_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x8E6, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_void_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_void_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":220
 * 
 *     # Unknown type, always decoded as text
 *     register_core_codec(UNKNOWNOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x2C1, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":226
 * 
 *     # OID and friends
 *     oid_types = [             # <<<<<<<<<<<<<<
 *         OIDOID, XIDOID, CIDOID
 *     ]
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_26);
  __Pyx_GIVEREF(__pyx_int_26);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_26);
  __Pyx_INCREF(__pyx_int_28);
  __Pyx_GIVEREF(__pyx_int_28);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_28);
  __Pyx_INCREF(__pyx_int_29);
  __Pyx_GIVEREF(__pyx_int_29);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_29);
  __pyx_v_oid_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":230
 *     ]
 * 
 *     for oid_type in oid_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid_type,
 *                             <encode_func>pgproto.uint4_encode,
 */
  __pyx_t_1 = __pyx_v_oid_types; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 230, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid_type, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":231
 * 
 *     for oid_type in oid_types:
 *         register_core_codec(oid_type,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.uint4_encode,
 *                             <decode_func>pgproto.uint4_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid_type); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 231, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":234
 *                             <encode_func>pgproto.uint4_encode,
 *                             <decode_func>pgproto.uint4_decode,
 *                             PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 * 
 *     # 64-bit OID types
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":230
 *     ]
 * 
 *     for oid_type in oid_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid_type,
 *                             <encode_func>pgproto.uint4_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":237
 * 
 *     # 64-bit OID types
 *     oid8_types = [             # <<<<<<<<<<<<<<
 *         XID8OID,
 *     ]
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_5069);
  __Pyx_GIVEREF(__pyx_int_5069);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_5069);
  __pyx_v_oid8_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":241
 *     ]
 * 
 *     for oid_type in oid8_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid_type,
 *                             <encode_func>pgproto.uint8_encode,
 */
  __pyx_t_1 = __pyx_v_oid8_types; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 241, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid_type, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":242
 * 
 *     for oid_type in oid8_types:
 *         register_core_codec(oid_type,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.uint8_encode,
 *                             <decode_func>pgproto.uint8_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid_type); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 242, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":245
 *                             <encode_func>pgproto.uint8_encode,
 *                             <decode_func>pgproto.uint8_decode,
 *                             PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 * 
 *     # reg* types -- these are really system catalog OIDs, but
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":241
 *     ]
 * 
 *     for oid_type in oid8_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid_type,
 *                             <encode_func>pgproto.uint8_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":252
 *     # useful.
 *     #
 *     reg_types = [             # <<<<<<<<<<<<<<
 *         REGPROCOID, REGPROCEDUREOID, REGOPEROID, REGOPERATOROID,
 *         REGCLASSOID, REGTYPEOID, REGCONFIGOID, REGDICTIONARYOID,
 */
  __pyx_t_1 = PyList_New(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_24);
  __Pyx_GIVEREF(__pyx_int_24);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_24);
  __Pyx_INCREF(__pyx_int_2202);
  __Pyx_GIVEREF(__pyx_int_2202);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_2202);
  __Pyx_INCREF(__pyx_int_2203);
  __Pyx_GIVEREF(__pyx_int_2203);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_2203);
  __Pyx_INCREF(__pyx_int_2204);
  __Pyx_GIVEREF(__pyx_int_2204);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_int_2204);
  __Pyx_INCREF(__pyx_int_2205);
  __Pyx_GIVEREF(__pyx_int_2205);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_int_2205);
  __Pyx_INCREF(__pyx_int_2206);
  __Pyx_GIVEREF(__pyx_int_2206);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_int_2206);
  __Pyx_INCREF(__pyx_int_3734);
  __Pyx_GIVEREF(__pyx_int_3734);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_int_3734);
  __Pyx_INCREF(__pyx_int_3769);
  __Pyx_GIVEREF(__pyx_int_3769);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_int_3769);
  __Pyx_INCREF(__pyx_int_4089);
  __Pyx_GIVEREF(__pyx_int_4089);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_int_4089);
  __Pyx_INCREF(__pyx_int_4096);
  __Pyx_GIVEREF(__pyx_int_4096);
  PyList_SET_ITEM(__pyx_t_1, 9, __pyx_int_4096);
  __Pyx_INCREF(__pyx_int_1790);
  __Pyx_GIVEREF(__pyx_int_1790);
  PyList_SET_ITEM(__pyx_t_1, 10, __pyx_int_1790);
  __Pyx_INCREF(__pyx_int_4191);
  __Pyx_GIVEREF(__pyx_int_4191);
  PyList_SET_ITEM(__pyx_t_1, 11, __pyx_int_4191);
  __pyx_v_reg_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":258
 *     ]
 * 
 *     for reg_type in reg_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(reg_type,
 *                             <encode_func>pgproto.text_encode,
 */
  __pyx_t_1 = __pyx_v_reg_types; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 258, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_reg_type, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":259
 * 
 *     for reg_type in reg_types:
 *         register_core_codec(reg_type,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_reg_type); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 259, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":262
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 *                             PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 *     # cstring type is used by Postgres' I/O functions
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":258
 *     ]
 * 
 *     for reg_type in reg_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(reg_type,
 *                             <encode_func>pgproto.text_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":265
 * 
 *     # cstring type is used by Postgres' I/O functions
 *     register_core_codec(CSTRINGOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x8E3, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":271
 * 
 *     # various system pseudotypes with no I/O
 *     no_io_types = [             # <<<<<<<<<<<<<<
 *         ANYOID, TRIGGEROID, EVENT_TRIGGEROID, LANGUAGE_HANDLEROID,
 *         FDW_HANDLEROID, TSM_HANDLEROID, INTERNALOID, OPAQUEOID,
 */
  __pyx_t_1 = PyList_New(17); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_2276);
  __Pyx_GIVEREF(__pyx_int_2276);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_2276);
  __Pyx_INCREF(__pyx_int_2279);
  __Pyx_GIVEREF(__pyx_int_2279);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_2279);
  __Pyx_INCREF(__pyx_int_3838);
  __Pyx_GIVEREF(__pyx_int_3838);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_3838);
  __Pyx_INCREF(__pyx_int_2280);
  __Pyx_GIVEREF(__pyx_int_2280);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_int_2280);
  __Pyx_INCREF(__pyx_int_3115);
  __Pyx_GIVEREF(__pyx_int_3115);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_int_3115);
  __Pyx_INCREF(__pyx_int_3310);
  __Pyx_GIVEREF(__pyx_int_3310);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_int_3310);
  __Pyx_INCREF(__pyx_int_2281);
  __Pyx_GIVEREF(__pyx_int_2281);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_int_2281);
  __Pyx_INCREF(__pyx_int_2282);
  __Pyx_GIVEREF(__pyx_int_2282);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_int_2282);
  __Pyx_INCREF(__pyx_int_2283);
  __Pyx_GIVEREF(__pyx_int_2283);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_int_2283);
  __Pyx_INCREF(__pyx_int_2776);
  __Pyx_GIVEREF(__pyx_int_2776);
  PyList_SET_ITEM(__pyx_t_1, 9, __pyx_int_2776);
  __Pyx_INCREF(__pyx_int_5077);
  __Pyx_GIVEREF(__pyx_int_5077);
  PyList_SET_ITEM(__pyx_t_1, 10, __pyx_int_5077);
  __Pyx_INCREF(__pyx_int_5078);
  __Pyx_GIVEREF(__pyx_int_5078);
  PyList_SET_ITEM(__pyx_t_1, 11, __pyx_int_5078);
  __Pyx_INCREF(__pyx_int_5079);
  __Pyx_GIVEREF(__pyx_int_5079);
  PyList_SET_ITEM(__pyx_t_1, 12, __pyx_int_5079);
  __Pyx_INCREF(__pyx_int_5080);
  __Pyx_GIVEREF(__pyx_int_5080);
  PyList_SET_ITEM(__pyx_t_1, 13, __pyx_int_5080);
  __Pyx_INCREF(__pyx_int_32);
  __Pyx_GIVEREF(__pyx_int_32);
  PyList_SET_ITEM(__pyx_t_1, 14, __pyx_int_32);
  __Pyx_INCREF(__pyx_int_325);
  __Pyx_GIVEREF(__pyx_int_325);
  PyList_SET_ITEM(__pyx_t_1, 15, __pyx_int_325);
  __Pyx_INCREF(__pyx_int_269);
  __Pyx_GIVEREF(__pyx_int_269);
  PyList_SET_ITEM(__pyx_t_1, 16, __pyx_int_269);
  __pyx_v_no_io_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":280
 *     ]
 * 
 *     register_core_codec(ANYENUMOID,             # <<<<<<<<<<<<<<
 *                         NULL,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xDAC, NULL, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":285
 *                         PG_FORMAT_TEXT)
 * 
 *     for no_io_type in no_io_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(no_io_type,
 *                             NULL,
 */
  __pyx_t_1 = __pyx_v_no_io_types; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 285, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_no_io_type, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":286
 * 
 *     for no_io_type in no_io_types:
 *         register_core_codec(no_io_type,             # <<<<<<<<<<<<<<
 *                             NULL,
 *                             NULL,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_no_io_type); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 286, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":289
 *                             NULL,
 *                             NULL,
 *                             PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 * 
 *     # ACL specification string
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, NULL, NULL, __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":285
 *                         PG_FORMAT_TEXT)
 * 
 *     for no_io_type in no_io_types:             # <<<<<<<<<<<<<<
 *         register_core_codec(no_io_type,
 *                             NULL,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":292
 * 
 *     # ACL specification string
 *     register_core_codec(ACLITEMOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x409, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":298
 * 
 *     # Postgres' serialized expression tree type
 *     register_core_codec(PG_NODE_TREEOID,             # <<<<<<<<<<<<<<
 *                         NULL,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xC2, NULL, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":304
 * 
 *     # pg_lsn type -- a pointer to a location in the XLOG.
 *     register_core_codec(PG_LSNOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.int8_encode,
 *                         <decode_func>pgproto.int8_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xC94, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int8_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_int8_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":309
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(SMGROID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xD2, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":316
 *     # pg_dependencies and pg_ndistinct are special types
 *     # used in pg_statistic_ext columns.
 *     register_core_codec(PG_DEPENDENCIESOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xD4A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":321
 *                         PG_FORMAT_TEXT)
 * 
 *     register_core_codec(PG_NDISTINCTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xD21, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":328
 *     # pg_mcv_list is a special type used in pg_statistic_ext_data
 *     # system catalog
 *     register_core_codec(PG_MCV_LISTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.bytea_encode,
 *                         <decode_func>pgproto.bytea_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x1399, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":212
 * 
 * 
 * cdef init_pseudo_codecs():             # <<<<<<<<<<<<<<
 *     # Void type is returned by SELECT void_returning_function()
 *     register_core_codec(VOIDOID,
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.init_pseudo_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_oid_types);
  __Pyx_XDECREF(__pyx_v_oid_type);
  __Pyx_XDECREF(__pyx_v_oid8_types);
  __Pyx_XDECREF(__pyx_v_reg_types);
  __Pyx_XDECREF(__pyx_v_reg_type);
  __Pyx_XDECREF(__pyx_v_no_io_types);
  __Pyx_XDECREF(__pyx_v_no_io_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":334
 * 
 * 
 * cdef init_text_codecs():             # <<<<<<<<<<<<<<
 *     textoids = [
 *         NAMEOID,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_text_codecs(void) {
  PyObject *__pyx_v_textoids = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_text_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":335
 * 
 * cdef init_text_codecs():
 *     textoids = [             # <<<<<<<<<<<<<<
 *         NAMEOID,
 *         BPCHAROID,
 */
  __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_19);
  __Pyx_GIVEREF(__pyx_int_19);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_19);
  __Pyx_INCREF(__pyx_int_1042);
  __Pyx_GIVEREF(__pyx_int_1042);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_1042);
  __Pyx_INCREF(__pyx_int_1043);
  __Pyx_GIVEREF(__pyx_int_1043);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_1043);
  __Pyx_INCREF(__pyx_int_25);
  __Pyx_GIVEREF(__pyx_int_25);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_int_25);
  __Pyx_INCREF(__pyx_int_142);
  __Pyx_GIVEREF(__pyx_int_142);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_int_142);
  __pyx_v_textoids = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":343
 *     ]
 * 
 *     for oid in textoids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  __pyx_t_1 = __pyx_v_textoids; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 343, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":344
 * 
 *     for oid in textoids:
 *         register_core_codec(oid,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 344, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":347
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 *                             PG_FORMAT_BINARY)             # <<<<<<<<<<<<<<
 * 
 *         register_core_codec(oid,
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":349
 *                             PG_FORMAT_BINARY)
 * 
 *         register_core_codec(oid,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 349, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":352
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 *                             PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":343
 *     ]
 * 
 *     for oid in textoids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":334
 * 
 * 
 * cdef init_text_codecs():             # <<<<<<<<<<<<<<
 *     textoids = [
 *         NAMEOID,
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.init_text_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_textoids);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":355
 * 
 * 
 * cdef init_tid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(TIDOID,
 *                         <encode_func>pgproto.tid_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_tid_codecs(void) {
  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_tid_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":356
 * 
 * cdef init_tid_codecs():
 *     register_core_codec(TIDOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.tid_encode,
 *                         <decode_func>pgproto.tid_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(27, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_tid_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_tid_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":355
 * 
 * 
 * cdef init_tid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(TIDOID,
 *                         <encode_func>pgproto.tid_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_tid_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":362
 * 
 * 
 * cdef init_txid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(TXID_SNAPSHOTOID,
 *                         <encode_func>pgproto.pg_snapshot_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_txid_codecs(void) {
  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_txid_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":363
 * 
 * cdef init_txid_codecs():
 *     register_core_codec(TXID_SNAPSHOTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.pg_snapshot_encode,
 *                         <decode_func>pgproto.pg_snapshot_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xB9A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":368
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(PG_SNAPSHOTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.pg_snapshot_encode,
 *                         <decode_func>pgproto.pg_snapshot_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x13AE, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":362
 * 
 * 
 * cdef init_txid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(TXID_SNAPSHOTOID,
 *                         <encode_func>pgproto.pg_snapshot_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_txid_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":374
 * 
 * 
 * cdef init_tsearch_codecs():             # <<<<<<<<<<<<<<
 *     ts_oids = [
 *         TSQUERYOID,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_tsearch_codecs(void) {
  PyObject *__pyx_v_ts_oids = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_tsearch_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":375
 * 
 * cdef init_tsearch_codecs():
 *     ts_oids = [             # <<<<<<<<<<<<<<
 *         TSQUERYOID,
 *         TSVECTOROID,
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_3615);
  __Pyx_GIVEREF(__pyx_int_3615);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_3615);
  __Pyx_INCREF(__pyx_int_3614);
  __Pyx_GIVEREF(__pyx_int_3614);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_3614);
  __pyx_v_ts_oids = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":380
 *     ]
 * 
 *     for oid in ts_oids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  __pyx_t_1 = __pyx_v_ts_oids; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 380, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":381
 * 
 *     for oid in ts_oids:
 *         register_core_codec(oid,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 381, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":384
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 *                             PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 *     register_core_codec(GTSVECTOROID,
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":380
 *     ]
 * 
 *     for oid in ts_oids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":386
 *                             PG_FORMAT_TEXT)
 * 
 *     register_core_codec(GTSVECTOROID,             # <<<<<<<<<<<<<<
 *                         NULL,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xE3A, NULL, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":374
 * 
 * 
 * cdef init_tsearch_codecs():             # <<<<<<<<<<<<<<
 *     ts_oids = [
 *         TSQUERYOID,
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.init_tsearch_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ts_oids);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":392
 * 
 * 
 * cdef init_uuid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(UUIDOID,
 *                         <encode_func>pgproto.uuid_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_uuid_codecs(void) {
  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_uuid_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":393
 * 
 * cdef init_uuid_codecs():
 *     register_core_codec(UUIDOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.uuid_encode,
 *                         <decode_func>pgproto.uuid_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xB86, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":392
 * 
 * 
 * cdef init_uuid_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(UUIDOID,
 *                         <encode_func>pgproto.uuid_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_uuid_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":399
 * 
 * 
 * cdef init_numeric_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(NUMERICOID,
 *                         <encode_func>pgproto.numeric_encode_text,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_numeric_codecs(void) {
  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_numeric_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":400
 * 
 * cdef init_numeric_codecs():
 *     register_core_codec(NUMERICOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.numeric_encode_text,
 *                         <decode_func>pgproto.numeric_decode_text,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x6A4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_text), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_text), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":405
 *                         PG_FORMAT_TEXT)
 * 
 *     register_core_codec(NUMERICOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.numeric_encode_binary,
 *                         <decode_func>pgproto.numeric_decode_binary,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x6A4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_binary), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_binary), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":399
 * 
 * 
 * cdef init_numeric_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(NUMERICOID,
 *                         <encode_func>pgproto.numeric_encode_text,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_numeric_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":411
 * 
 * 
 * cdef init_network_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(CIDROID,
 *                         <encode_func>pgproto.cidr_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_network_codecs(void) {
  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_network_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":412
 * 
 * cdef init_network_codecs():
 *     register_core_codec(CIDROID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.cidr_encode,
 *                         <decode_func>pgproto.cidr_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x28A, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":417
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(INETOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.inet_encode,
 *                         <decode_func>pgproto.inet_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x365, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_inet_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_inet_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":422
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(MACADDROID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x33D, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":427
 *                         PG_FORMAT_TEXT)
 * 
 *     register_core_codec(MACADDR8OID,             # <<<<<<<<<<<<<<
 *                         <encode_func>pgproto.text_encode,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x306, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":411
 * 
 * 
 * cdef init_network_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(CIDROID,
 *                         <encode_func>pgproto.cidr_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_network_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":433
 * 
 * 
 * cdef init_monetary_codecs():             # <<<<<<<<<<<<<<
 *     moneyoids = [
 *         MONEYOID,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_monetary_codecs(void) {
  PyObject *__pyx_v_moneyoids = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_monetary_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":434
 * 
 * cdef init_monetary_codecs():
 *     moneyoids = [             # <<<<<<<<<<<<<<
 *         MONEYOID,
 *     ]
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_790);
  __Pyx_GIVEREF(__pyx_int_790);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_790);
  __pyx_v_moneyoids = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":438
 *     ]
 * 
 *     for oid in moneyoids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  __pyx_t_1 = __pyx_v_moneyoids; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(9, 438, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":439
 * 
 *     for oid in moneyoids:
 *         register_core_codec(oid,             # <<<<<<<<<<<<<<
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 439, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/pgproto.pyx":442
 *                             <encode_func>pgproto.text_encode,
 *                             <decode_func>pgproto.text_decode,
 *                             PG_FORMAT_TEXT)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(__pyx_t_4, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/pgproto.pyx":438
 *     ]
 * 
 *     for oid in moneyoids:             # <<<<<<<<<<<<<<
 *         register_core_codec(oid,
 *                             <encode_func>pgproto.text_encode,
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":433
 * 
 * 
 * cdef init_monetary_codecs():             # <<<<<<<<<<<<<<
 *     moneyoids = [
 *         MONEYOID,
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.init_monetary_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_moneyoids);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/pgproto.pyx":445
 * 
 * 
 * cdef init_all_pgproto_codecs():             # <<<<<<<<<<<<<<
 *     # Builtin types, in lexicographical order.
 *     init_bits_codecs()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_all_pgproto_codecs(void) {
  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_all_pgproto_codecs", 0);

  /* "asyncpg/protocol/codecs/pgproto.pyx":447
 * cdef init_all_pgproto_codecs():
 *     # Builtin types, in lexicographical order.
 *     init_bits_codecs()             # <<<<<<<<<<<<<<
 *     init_bytea_codecs()
 *     init_datetime_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_bits_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":448
 *     # Builtin types, in lexicographical order.
 *     init_bits_codecs()
 *     init_bytea_codecs()             # <<<<<<<<<<<<<<
 *     init_datetime_codecs()
 *     init_float_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_bytea_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":449
 *     init_bits_codecs()
 *     init_bytea_codecs()
 *     init_datetime_codecs()             # <<<<<<<<<<<<<<
 *     init_float_codecs()
 *     init_geometry_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_datetime_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":450
 *     init_bytea_codecs()
 *     init_datetime_codecs()
 *     init_float_codecs()             # <<<<<<<<<<<<<<
 *     init_geometry_codecs()
 *     init_int_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_float_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":451
 *     init_datetime_codecs()
 *     init_float_codecs()
 *     init_geometry_codecs()             # <<<<<<<<<<<<<<
 *     init_int_codecs()
 *     init_json_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_geometry_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":452
 *     init_float_codecs()
 *     init_geometry_codecs()
 *     init_int_codecs()             # <<<<<<<<<<<<<<
 *     init_json_codecs()
 *     init_monetary_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_int_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":453
 *     init_geometry_codecs()
 *     init_int_codecs()
 *     init_json_codecs()             # <<<<<<<<<<<<<<
 *     init_monetary_codecs()
 *     init_network_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_json_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":454
 *     init_int_codecs()
 *     init_json_codecs()
 *     init_monetary_codecs()             # <<<<<<<<<<<<<<
 *     init_network_codecs()
 *     init_numeric_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_monetary_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":455
 *     init_json_codecs()
 *     init_monetary_codecs()
 *     init_network_codecs()             # <<<<<<<<<<<<<<
 *     init_numeric_codecs()
 *     init_text_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_network_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":456
 *     init_monetary_codecs()
 *     init_network_codecs()
 *     init_numeric_codecs()             # <<<<<<<<<<<<<<
 *     init_text_codecs()
 *     init_tid_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_numeric_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":457
 *     init_network_codecs()
 *     init_numeric_codecs()
 *     init_text_codecs()             # <<<<<<<<<<<<<<
 *     init_tid_codecs()
 *     init_tsearch_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_text_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":458
 *     init_numeric_codecs()
 *     init_text_codecs()
 *     init_tid_codecs()             # <<<<<<<<<<<<<<
 *     init_tsearch_codecs()
 *     init_txid_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_tid_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":459
 *     init_text_codecs()
 *     init_tid_codecs()
 *     init_tsearch_codecs()             # <<<<<<<<<<<<<<
 *     init_txid_codecs()
 *     init_uuid_codecs()
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_tsearch_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":460
 *     init_tid_codecs()
 *     init_tsearch_codecs()
 *     init_txid_codecs()             # <<<<<<<<<<<<<<
 *     init_uuid_codecs()
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_txid_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":461
 *     init_tsearch_codecs()
 *     init_txid_codecs()
 *     init_uuid_codecs()             # <<<<<<<<<<<<<<
 * 
 *     # Various pseudotypes and system types
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_uuid_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":464
 * 
 *     # Various pseudotypes and system types
 *     init_pseudo_codecs()             # <<<<<<<<<<<<<<
 * 
 *     # contrib
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_pseudo_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":467
 * 
 *     # contrib
 *     init_hstore_codecs()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_hstore_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/pgproto.pyx":445
 * 
 * 
 * cdef init_all_pgproto_codecs():             # <<<<<<<<<<<<<<
 *     # Builtin types, in lexicographical order.
 *     init_bits_codecs()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_all_pgproto_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":32
 * 
 * 
 * cdef inline bint _is_trivial_container(object obj):             # <<<<<<<<<<<<<<
 *     return cpython.PyUnicode_Check(obj) or cpython.PyBytes_Check(obj) or \
 *             cpythonx.PyByteArray_Check(obj) or cpythonx.PyMemoryView_Check(obj)
 */

static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__is_trivial_container(PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_is_trivial_container", 0);

  /* "asyncpg/protocol/codecs/array.pyx":33
 * 
 * cdef inline bint _is_trivial_container(object obj):
 *     return cpython.PyUnicode_Check(obj) or cpython.PyBytes_Check(obj) or \             # <<<<<<<<<<<<<<
 *             cpythonx.PyByteArray_Check(obj) or cpythonx.PyMemoryView_Check(obj)
 * 
 */
  __pyx_t_2 = (PyUnicode_Check(__pyx_v_obj) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (PyBytes_Check(__pyx_v_obj) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }

  /* "asyncpg/protocol/codecs/array.pyx":34
 * cdef inline bint _is_trivial_container(object obj):
 *     return cpython.PyUnicode_Check(obj) or cpython.PyBytes_Check(obj) or \
 *             cpythonx.PyByteArray_Check(obj) or cpythonx.PyMemoryView_Check(obj)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (PyByteArray_Check(__pyx_v_obj) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (PyMemoryView_Check(__pyx_v_obj) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":32
 * 
 * 
 * cdef inline bint _is_trivial_container(object obj):             # <<<<<<<<<<<<<<
 *     return cpython.PyUnicode_Check(obj) or cpython.PyBytes_Check(obj) or \
 *             cpythonx.PyByteArray_Check(obj) or cpythonx.PyMemoryView_Check(obj)
 */

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

/* "asyncpg/protocol/codecs/array.pyx":37
 * 
 * 
 * cdef inline _is_array_iterable(object obj):             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(obj, IterableABC) and
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol__is_array_iterable(PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_array_iterable", 0);

  /* "asyncpg/protocol/codecs/array.pyx":38
 * 
 * cdef inline _is_array_iterable(object obj):
 *     return (             # <<<<<<<<<<<<<<
 *         isinstance(obj, IterableABC) and
 *         isinstance(obj, SizedABC) and
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/codecs/array.pyx":39
 * cdef inline _is_array_iterable(object obj):
 *     return (
 *         isinstance(obj, IterableABC) and             # <<<<<<<<<<<<<<
 *         isinstance(obj, SizedABC) and
 *         not _is_trivial_container(obj) and
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IterableABC); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(5, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "asyncpg/protocol/codecs/array.pyx":40
 *     return (
 *         isinstance(obj, IterableABC) and
 *         isinstance(obj, SizedABC) and             # <<<<<<<<<<<<<<
 *         not _is_trivial_container(obj) and
 *         not isinstance(obj, MappingABC)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SizedABC); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(5, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "asyncpg/protocol/codecs/array.pyx":41
 *         isinstance(obj, IterableABC) and
 *         isinstance(obj, SizedABC) and
 *         not _is_trivial_container(obj) and             # <<<<<<<<<<<<<<
 *         not isinstance(obj, MappingABC)
 *     )
 */
  __pyx_t_3 = (!(__pyx_f_7asyncpg_8protocol_8protocol__is_trivial_container(__pyx_v_obj) != 0));
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "asyncpg/protocol/codecs/array.pyx":42
 *         isinstance(obj, SizedABC) and
 *         not _is_trivial_container(obj) and
 *         not isinstance(obj, MappingABC)             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MappingABC); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(5, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!(__pyx_t_3 != 0));
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":37
 * 
 * 
 * cdef inline _is_array_iterable(object obj):             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(obj, IterableABC) and
 */

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

/* "asyncpg/protocol/codecs/array.pyx":46
 * 
 * 
 * cdef inline _is_sub_array_iterable(object obj):             # <<<<<<<<<<<<<<
 *     # Sub-arrays have a specialized check, because we treat
 *     # nested tuples as records.
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol__is_sub_array_iterable(PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_sub_array_iterable", 0);

  /* "asyncpg/protocol/codecs/array.pyx":49
 *     # Sub-arrays have a specialized check, because we treat
 *     # nested tuples as records.
 *     return _is_array_iterable(obj) and not cpython.PyTuple_Check(obj)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol__is_array_iterable(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 49, __pyx_L1_error)
  if (__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (!(PyTuple_Check(__pyx_v_obj) != 0));
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":46
 * 
 * 
 * cdef inline _is_sub_array_iterable(object obj):             # <<<<<<<<<<<<<<
 *     # Sub-arrays have a specialized check, because we treat
 *     # nested tuples as records.
 */

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

/* "asyncpg/protocol/codecs/array.pyx":52
 * 
 * 
 * cdef _get_array_shape(object obj, int32_t *dims, int32_t *ndims):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ssize_t mylen = len(obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__get_array_shape(PyObject *__pyx_v_obj, int32_t *__pyx_v_dims, int32_t *__pyx_v_ndims) {
  Py_ssize_t __pyx_v_mylen;
  Py_ssize_t __pyx_v_elemlen;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_array_shape", 0);

  /* "asyncpg/protocol/codecs/array.pyx":54
 * cdef _get_array_shape(object obj, int32_t *dims, int32_t *ndims):
 *     cdef:
 *         ssize_t mylen = len(obj)             # <<<<<<<<<<<<<<
 *         ssize_t elemlen = -2
 *         object it
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(5, 54, __pyx_L1_error)
  __pyx_v_mylen = __pyx_t_1;

  /* "asyncpg/protocol/codecs/array.pyx":55
 *     cdef:
 *         ssize_t mylen = len(obj)
 *         ssize_t elemlen = -2             # <<<<<<<<<<<<<<
 *         object it
 * 
 */
  __pyx_v_elemlen = -2L;

  /* "asyncpg/protocol/codecs/array.pyx":58
 *         object it
 * 
 *     if mylen > _MAXINT32:             # <<<<<<<<<<<<<<
 *         raise ValueError('too many elements in array value')
 * 
 */
  __pyx_t_2 = ((__pyx_v_mylen > 0x7FFFFFFF) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/codecs/array.pyx":59
 * 
 *     if mylen > _MAXINT32:
 *         raise ValueError('too many elements in array value')             # <<<<<<<<<<<<<<
 * 
 *     if ndims[0] > ARRAY_MAXDIM:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 59, __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(5, 59, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":58
 *         object it
 * 
 *     if mylen > _MAXINT32:             # <<<<<<<<<<<<<<
 *         raise ValueError('too many elements in array value')
 * 
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":61
 *         raise ValueError('too many elements in array value')
 * 
 *     if ndims[0] > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 */
  __pyx_t_2 = (((__pyx_v_ndims[0]) > 6) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/codecs/array.pyx":63
 *     if ndims[0] > ARRAY_MAXDIM:
 *         raise ValueError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.             # <<<<<<<<<<<<<<
 *                 format(ndims[0], ARRAY_MAXDIM))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_number_of_array_dimensions_excee, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/codecs/array.pyx":64
 *         raise ValueError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *                 format(ndims[0], ARRAY_MAXDIM))             # <<<<<<<<<<<<<<
 * 
 *     dims[ndims[0] - 1] = <int32_t>mylen
 */
    __pyx_t_5 = __Pyx_PyInt_From_int32_t((__pyx_v_ndims[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 64, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 64, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
      __Pyx_INCREF(__pyx_int_6);
      __Pyx_GIVEREF(__pyx_int_6);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_int_6);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":62
 * 
 *     if ndims[0] > ARRAY_MAXDIM:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *                 format(ndims[0], ARRAY_MAXDIM))
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 62, __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(5, 62, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":61
 *         raise ValueError('too many elements in array value')
 * 
 *     if ndims[0] > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":66
 *                 format(ndims[0], ARRAY_MAXDIM))
 * 
 *     dims[ndims[0] - 1] = <int32_t>mylen             # <<<<<<<<<<<<<<
 * 
 *     for elem in obj:
 */
  (__pyx_v_dims[((__pyx_v_ndims[0]) - 1)]) = ((int32_t)__pyx_v_mylen);

  /* "asyncpg/protocol/codecs/array.pyx":68
 *     dims[ndims[0] - 1] = <int32_t>mylen
 * 
 *     for elem in obj:             # <<<<<<<<<<<<<<
 *         if _is_sub_array_iterable(elem):
 *             if elemlen == -2:
 */
  if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
    __pyx_t_4 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 68, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(5, 68, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(5, 68, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_9(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(5, 68, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":69
 * 
 *     for elem in obj:
 *         if _is_sub_array_iterable(elem):             # <<<<<<<<<<<<<<
 *             if elemlen == -2:
 *                 elemlen = len(elem)
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__is_sub_array_iterable(__pyx_v_elem); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 69, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/array.pyx":70
 *     for elem in obj:
 *         if _is_sub_array_iterable(elem):
 *             if elemlen == -2:             # <<<<<<<<<<<<<<
 *                 elemlen = len(elem)
 *                 if elemlen > _MAXINT32:
 */
      __pyx_t_2 = ((__pyx_v_elemlen == -2L) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":71
 *         if _is_sub_array_iterable(elem):
 *             if elemlen == -2:
 *                 elemlen = len(elem)             # <<<<<<<<<<<<<<
 *                 if elemlen > _MAXINT32:
 *                     raise ValueError('too many elements in array value')
 */
        __pyx_t_10 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(5, 71, __pyx_L1_error)
        __pyx_v_elemlen = __pyx_t_10;

        /* "asyncpg/protocol/codecs/array.pyx":72
 *             if elemlen == -2:
 *                 elemlen = len(elem)
 *                 if elemlen > _MAXINT32:             # <<<<<<<<<<<<<<
 *                     raise ValueError('too many elements in array value')
 *                 ndims[0] += 1
 */
        __pyx_t_2 = ((__pyx_v_elemlen > 0x7FFFFFFF) != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":73
 *                 elemlen = len(elem)
 *                 if elemlen > _MAXINT32:
 *                     raise ValueError('too many elements in array value')             # <<<<<<<<<<<<<<
 *                 ndims[0] += 1
 *                 _get_array_shape(elem, dims, ndims)
 */
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 73, __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(5, 73, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":72
 *             if elemlen == -2:
 *                 elemlen = len(elem)
 *                 if elemlen > _MAXINT32:             # <<<<<<<<<<<<<<
 *                     raise ValueError('too many elements in array value')
 *                 ndims[0] += 1
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":74
 *                 if elemlen > _MAXINT32:
 *                     raise ValueError('too many elements in array value')
 *                 ndims[0] += 1             # <<<<<<<<<<<<<<
 *                 _get_array_shape(elem, dims, ndims)
 *             else:
 */
        __pyx_t_11 = 0;
        (__pyx_v_ndims[__pyx_t_11]) = ((__pyx_v_ndims[__pyx_t_11]) + 1);

        /* "asyncpg/protocol/codecs/array.pyx":75
 *                     raise ValueError('too many elements in array value')
 *                 ndims[0] += 1
 *                 _get_array_shape(elem, dims, ndims)             # <<<<<<<<<<<<<<
 *             else:
 *                 if len(elem) != elemlen:
 */
        __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__get_array_shape(__pyx_v_elem, __pyx_v_dims, __pyx_v_ndims); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 75, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":70
 *     for elem in obj:
 *         if _is_sub_array_iterable(elem):
 *             if elemlen == -2:             # <<<<<<<<<<<<<<
 *                 elemlen = len(elem)
 *                 if elemlen > _MAXINT32:
 */
        goto __pyx_L8;
      }

      /* "asyncpg/protocol/codecs/array.pyx":77
 *                 _get_array_shape(elem, dims, ndims)
 *             else:
 *                 if len(elem) != elemlen:             # <<<<<<<<<<<<<<
 *                     raise ValueError('non-homogeneous array')
 *         else:
 */
      /*else*/ {
        __pyx_t_10 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(5, 77, __pyx_L1_error)
        __pyx_t_2 = ((__pyx_t_10 != __pyx_v_elemlen) != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":78
 *             else:
 *                 if len(elem) != elemlen:
 *                     raise ValueError('non-homogeneous array')             # <<<<<<<<<<<<<<
 *         else:
 *             if elemlen >= 0:
 */
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 78, __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(5, 78, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":77
 *                 _get_array_shape(elem, dims, ndims)
 *             else:
 *                 if len(elem) != elemlen:             # <<<<<<<<<<<<<<
 *                     raise ValueError('non-homogeneous array')
 *         else:
 */
        }
      }
      __pyx_L8:;

      /* "asyncpg/protocol/codecs/array.pyx":69
 * 
 *     for elem in obj:
 *         if _is_sub_array_iterable(elem):             # <<<<<<<<<<<<<<
 *             if elemlen == -2:
 *                 elemlen = len(elem)
 */
      goto __pyx_L7;
    }

    /* "asyncpg/protocol/codecs/array.pyx":80
 *                     raise ValueError('non-homogeneous array')
 *         else:
 *             if elemlen >= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('non-homogeneous array')
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = ((__pyx_v_elemlen >= 0) != 0);
      if (unlikely(__pyx_t_2)) {

        /* "asyncpg/protocol/codecs/array.pyx":81
 *         else:
 *             if elemlen >= 0:
 *                 raise ValueError('non-homogeneous array')             # <<<<<<<<<<<<<<
 *             else:
 *                 elemlen = -1
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 81, __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(5, 81, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/array.pyx":80
 *                     raise ValueError('non-homogeneous array')
 *         else:
 *             if elemlen >= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('non-homogeneous array')
 *             else:
 */
      }

      /* "asyncpg/protocol/codecs/array.pyx":83
 *                 raise ValueError('non-homogeneous array')
 *             else:
 *                 elemlen = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      /*else*/ {
        __pyx_v_elemlen = -1L;
      }
    }
    __pyx_L7:;

    /* "asyncpg/protocol/codecs/array.pyx":68
 *     dims[ndims[0] - 1] = <int32_t>mylen
 * 
 *     for elem in obj:             # <<<<<<<<<<<<<<
 *         if _is_sub_array_iterable(elem):
 *             if elemlen == -2:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":52
 * 
 * 
 * cdef _get_array_shape(object obj, int32_t *dims, int32_t *ndims):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ssize_t mylen = len(obj)
 */

  /* 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_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._get_array_shape", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":86
 * 
 * 
 * cdef _write_array_data(ConnectionSettings settings, object obj, int32_t ndims,             # <<<<<<<<<<<<<<
 *                        int32_t dim, WriteBuffer elem_data,
 *                        encode_func_ex encoder, const void *encoder_arg):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__write_array_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, PyObject *__pyx_v_obj, int32_t __pyx_v_ndims, int32_t __pyx_v_dim, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_elem_data, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex __pyx_v_encoder, void const *__pyx_v_encoder_arg) {
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  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;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_array_data", 0);

  /* "asyncpg/protocol/codecs/array.pyx":89
 *                        int32_t dim, WriteBuffer elem_data,
 *                        encode_func_ex encoder, const void *encoder_arg):
 *     if dim < ndims - 1:             # <<<<<<<<<<<<<<
 *         for item in obj:
 *             _write_array_data(settings, item, ndims, dim + 1, elem_data,
 */
  __pyx_t_1 = ((__pyx_v_dim < (__pyx_v_ndims - 1)) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/array.pyx":90
 *                        encode_func_ex encoder, const void *encoder_arg):
 *     if dim < ndims - 1:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             _write_array_data(settings, item, ndims, dim + 1, elem_data,
 *                               encoder, encoder_arg)
 */
    if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
      __pyx_t_2 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 90, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 90, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 90, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        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(5, 90, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":91
 *     if dim < ndims - 1:
 *         for item in obj:
 *             _write_array_data(settings, item, ndims, dim + 1, elem_data,             # <<<<<<<<<<<<<<
 *                               encoder, encoder_arg)
 *     else:
 */
      __pyx_t_5 = __pyx_f_7asyncpg_8protocol_8protocol__write_array_data(__pyx_v_settings, __pyx_v_item, __pyx_v_ndims, (__pyx_v_dim + 1), __pyx_v_elem_data, __pyx_v_encoder, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":90
 *                        encode_func_ex encoder, const void *encoder_arg):
 *     if dim < ndims - 1:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             _write_array_data(settings, item, ndims, dim + 1, elem_data,
 *                               encoder, encoder_arg)
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":89
 *                        int32_t dim, WriteBuffer elem_data,
 *                        encode_func_ex encoder, const void *encoder_arg):
 *     if dim < ndims - 1:             # <<<<<<<<<<<<<<
 *         for item in obj:
 *             _write_array_data(settings, item, ndims, dim + 1, elem_data,
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/codecs/array.pyx":94
 *                               encoder, encoder_arg)
 *     else:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             if item is None:
 *                 elem_data.write_int32(-1)
 */
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
      __pyx_t_2 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 94, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 94, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 94, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 94, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 94, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        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(5, 94, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":95
 *     else:
 *         for item in obj:
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
      __pyx_t_1 = (__pyx_v_item == Py_None);
      __pyx_t_6 = (__pyx_t_1 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/array.pyx":96
 *         for item in obj:
 *             if item is None:
 *                 elem_data.write_int32(-1)             # <<<<<<<<<<<<<<
 *             else:
 *                 try:
 */
        __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_elem_data->__pyx_vtab)->write_int32(__pyx_v_elem_data, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":95
 *     else:
 *         for item in obj:
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
        goto __pyx_L8;
      }

      /* "asyncpg/protocol/codecs/array.pyx":98
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
      /*else*/ {
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          /*try:*/ {

            /* "asyncpg/protocol/codecs/array.pyx":99
 *             else:
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)             # <<<<<<<<<<<<<<
 *                 except TypeError as e:
 *                     raise ValueError(
 */
            __pyx_t_5 = __pyx_v_encoder(__pyx_v_settings, __pyx_v_elem_data, __pyx_v_item, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 99, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "asyncpg/protocol/codecs/array.pyx":98
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
          }
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L16_try_end;
          __pyx_L9_error:;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":100
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(e.args[0])) from None
 */
          __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
          if (__pyx_t_10) {
            __Pyx_AddTraceback("asyncpg.protocol.protocol._write_array_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_12) < 0) __PYX_ERR(5, 100, __pyx_L11_except_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_11);
            __pyx_v_e = __pyx_t_11;
            /*try:*/ {

              /* "asyncpg/protocol/codecs/array.pyx":102
 *                 except TypeError as e:
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 * 
 */
              __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_array_element, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 102, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_15)) __PYX_ERR(5, 102, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_15);
              __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_15, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 102, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_16);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              __pyx_t_15 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
                __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
                if (likely(__pyx_t_15)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                  __Pyx_INCREF(__pyx_t_15);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_14, function);
                }
              }
              __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_16);
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(5, 102, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":101
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'invalid array element: {}'.format(e.args[0])) from None
 * 
 */
              __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 101, __pyx_L22_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":102
 *                 except TypeError as e:
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 * 
 */
              __Pyx_Raise(__pyx_t_14, 0, 0, Py_None);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __PYX_ERR(5, 101, __pyx_L22_error)
            }

            /* "asyncpg/protocol/codecs/array.pyx":100
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(e.args[0])) from None
 */
            /*finally:*/ {
              __pyx_L22_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
                __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_19);
                __Pyx_XGOTREF(__pyx_t_20);
                __Pyx_XGOTREF(__pyx_t_21);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_23);
                __Pyx_XGOTREF(__pyx_t_24);
                __pyx_t_10 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
                {
                  __Pyx_DECREF(__pyx_v_e);
                  __pyx_v_e = NULL;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_22);
                  __Pyx_XGIVEREF(__pyx_t_23);
                  __Pyx_XGIVEREF(__pyx_t_24);
                  __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
                }
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
                __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
                __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
                goto __pyx_L11_except_error;
              }
            }
          }
          goto __pyx_L11_except_error;
          __pyx_L11_except_error:;

          /* "asyncpg/protocol/codecs/array.pyx":98
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          goto __pyx_L1_error;
          __pyx_L16_try_end:;
        }
      }
      __pyx_L8:;

      /* "asyncpg/protocol/codecs/array.pyx":94
 *                               encoder, encoder_arg)
 *     else:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             if item is None:
 *                 elem_data.write_int32(-1)
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/codecs/array.pyx":86
 * 
 * 
 * cdef _write_array_data(ConnectionSettings settings, object obj, int32_t ndims,             # <<<<<<<<<<<<<<
 *                        int32_t dim, WriteBuffer elem_data,
 *                        encode_func_ex encoder, const void *encoder_arg):
 */

  /* 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_5);
  __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_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._write_array_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":105
 * 
 * 
 * cdef inline array_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                          object obj, uint32_t elem_oid,
 *                          encode_func_ex encoder, const void *encoder_arg):
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_array_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, uint32_t __pyx_v_elem_oid, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex __pyx_v_encoder, void const *__pyx_v_encoder_arg) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_elem_data = 0;
  int32_t __pyx_v_dims[6];
  int32_t __pyx_v_ndims;
  int32_t __pyx_v_i;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_e = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  int32_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  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;
  int __pyx_t_20;
  char const *__pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  int32_t __pyx_t_28;
  int32_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_encode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":111
 *         WriteBuffer elem_data
 *         int32_t dims[ARRAY_MAXDIM]
 *         int32_t ndims = 1             # <<<<<<<<<<<<<<
 *         int32_t i
 * 
 */
  __pyx_v_ndims = 1;

  /* "asyncpg/protocol/codecs/array.pyx":114
 *         int32_t i
 * 
 *     if not _is_array_iterable(obj):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol__is_array_iterable(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 114, __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(5, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/codecs/array.pyx":116
 *     if not _is_array_iterable(obj):
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(             # <<<<<<<<<<<<<<
 *                 type(obj).__name__))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_a_sized_iterable_container_expec, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/codecs/array.pyx":117
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 *                 type(obj).__name__))             # <<<<<<<<<<<<<<
 * 
 *     _get_array_shape(obj, dims, &ndims)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_obj)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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_1 = (__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_1)) __PYX_ERR(5, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":115
 * 
 *     if not _is_array_iterable(obj):
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             'a sized iterable container expected (got type {!r})'.format(
 *                 type(obj).__name__))
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(5, 115, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":114
 *         int32_t i
 * 
 *     if not _is_array_iterable(obj):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":119
 *                 type(obj).__name__))
 * 
 *     _get_array_shape(obj, dims, &ndims)             # <<<<<<<<<<<<<<
 * 
 *     elem_data = WriteBuffer.new()
 */
  __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol__get_array_shape(__pyx_v_obj, __pyx_v_dims, (&__pyx_v_ndims)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":121
 *     _get_array_shape(obj, dims, &ndims)
 * 
 *     elem_data = WriteBuffer.new()             # <<<<<<<<<<<<<<
 * 
 *     if ndims > 1:
 */
  __pyx_t_4 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_elem_data = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":123
 *     elem_data = WriteBuffer.new()
 * 
 *     if ndims > 1:             # <<<<<<<<<<<<<<
 *         _write_array_data(settings, obj, ndims, 0, elem_data,
 *                           encoder, encoder_arg)
 */
  __pyx_t_3 = ((__pyx_v_ndims > 1) != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/codecs/array.pyx":124
 * 
 *     if ndims > 1:
 *         _write_array_data(settings, obj, ndims, 0, elem_data,             # <<<<<<<<<<<<<<
 *                           encoder, encoder_arg)
 *     else:
 */
    __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol__write_array_data(__pyx_v_settings, __pyx_v_obj, __pyx_v_ndims, 0, __pyx_v_elem_data, __pyx_v_encoder, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":123
 *     elem_data = WriteBuffer.new()
 * 
 *     if ndims > 1:             # <<<<<<<<<<<<<<
 *         _write_array_data(settings, obj, ndims, 0, elem_data,
 *                           encoder, encoder_arg)
 */
    goto __pyx_L4;
  }

  /* "asyncpg/protocol/codecs/array.pyx":127
 *                           encoder, encoder_arg)
 *     else:
 *         for i, item in enumerate(obj):             # <<<<<<<<<<<<<<
 *             if item is None:
 *                 elem_data.write_int32(-1)
 */
  /*else*/ {
    __pyx_t_7 = 0;
    if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
      __pyx_t_4 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 127, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(5, 127, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 127, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(5, 127, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 127, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(5, 127, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_v_i = __pyx_t_7;
      __pyx_t_7 = (__pyx_t_7 + 1);

      /* "asyncpg/protocol/codecs/array.pyx":128
 *     else:
 *         for i, item in enumerate(obj):
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
      __pyx_t_3 = (__pyx_v_item == Py_None);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":129
 *         for i, item in enumerate(obj):
 *             if item is None:
 *                 elem_data.write_int32(-1)             # <<<<<<<<<<<<<<
 *             else:
 *                 try:
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_elem_data->__pyx_vtab)->write_int32(__pyx_v_elem_data, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":128
 *     else:
 *         for i, item in enumerate(obj):
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 elem_data.write_int32(-1)
 *             else:
 */
        goto __pyx_L7;
      }

      /* "asyncpg/protocol/codecs/array.pyx":131
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
      /*else*/ {
        {
          __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:*/ {

            /* "asyncpg/protocol/codecs/array.pyx":132
 *             else:
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)             # <<<<<<<<<<<<<<
 *                 except TypeError as e:
 *                     raise ValueError(
 */
            __pyx_t_1 = __pyx_v_encoder(__pyx_v_settings, __pyx_v_elem_data, __pyx_v_item, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 132, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "asyncpg/protocol/codecs/array.pyx":131
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
          }
          __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_L15_try_end;
          __pyx_L8_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":133
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element at index {}: {}'.format(
 */
          __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
          if (__pyx_t_13) {
            __Pyx_AddTraceback("asyncpg.protocol.protocol.array_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(5, 133, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_5);
            __pyx_v_e = __pyx_t_5;
            /*try:*/ {

              /* "asyncpg/protocol/codecs/array.pyx":135
 *                 except TypeError as e:
 *                     raise ValueError(
 *                         'invalid array element at index {}: {}'.format(             # <<<<<<<<<<<<<<
 *                             i, e.args[0])) from None
 * 
 */
              __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_array_element_at_index, __pyx_n_s_format); if (unlikely(!__pyx_t_15)) __PYX_ERR(5, 135, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_15);

              /* "asyncpg/protocol/codecs/array.pyx":136
 *                     raise ValueError(
 *                         'invalid array element at index {}: {}'.format(
 *                             i, e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 *     buf.write_int32(12 + 8 * ndims + elem_data.len())
 */
              __pyx_t_16 = __Pyx_PyInt_From_int32_t(__pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 136, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 136, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_17);
              __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_17, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 136, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_18);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __pyx_t_17 = NULL;
              __pyx_t_13 = 0;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
                __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_15);
                if (likely(__pyx_t_17)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                  __Pyx_INCREF(__pyx_t_17);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_15, function);
                  __pyx_t_13 = 1;
                }
              }
              #if CYTHON_FAST_PYCALL
              if (PyFunction_Check(__pyx_t_15)) {
                PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_t_18};
                __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 135, __pyx_L21_error)
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              } else
              #endif
              #if CYTHON_FAST_PYCCALL
              if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
                PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_t_18};
                __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 135, __pyx_L21_error)
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              } else
              #endif
              {
                __pyx_t_19 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 135, __pyx_L21_error)
                __Pyx_GOTREF(__pyx_t_19);
                if (__pyx_t_17) {
                  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL;
                }
                __Pyx_GIVEREF(__pyx_t_16);
                PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_13, __pyx_t_16);
                __Pyx_GIVEREF(__pyx_t_18);
                PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_13, __pyx_t_18);
                __pyx_t_16 = 0;
                __pyx_t_18 = 0;
                __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_19, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 135, __pyx_L21_error)
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
              }
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":134
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'invalid array element at index {}: {}'.format(
 *                             i, e.args[0])) from None
 */
              __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(5, 134, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":136
 *                     raise ValueError(
 *                         'invalid array element at index {}: {}'.format(
 *                             i, e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 *     buf.write_int32(12 + 8 * ndims + elem_data.len())
 */
              __Pyx_Raise(__pyx_t_15, 0, 0, Py_None);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              __PYX_ERR(5, 134, __pyx_L21_error)
            }

            /* "asyncpg/protocol/codecs/array.pyx":133
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element at index {}: {}'.format(
 */
            /*finally:*/ {
              __pyx_L21_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
                __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
                __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
                __Pyx_XGOTREF(__pyx_t_22);
                __Pyx_XGOTREF(__pyx_t_23);
                __Pyx_XGOTREF(__pyx_t_24);
                __Pyx_XGOTREF(__pyx_t_25);
                __Pyx_XGOTREF(__pyx_t_26);
                __Pyx_XGOTREF(__pyx_t_27);
                __pyx_t_13 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
                {
                  __Pyx_DECREF(__pyx_v_e);
                  __pyx_v_e = NULL;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_25);
                  __Pyx_XGIVEREF(__pyx_t_26);
                  __Pyx_XGIVEREF(__pyx_t_27);
                  __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27);
                }
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_XGIVEREF(__pyx_t_23);
                __Pyx_XGIVEREF(__pyx_t_24);
                __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24);
                __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
                __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
                goto __pyx_L10_except_error;
              }
            }
          }
          goto __pyx_L10_except_error;
          __pyx_L10_except_error:;

          /* "asyncpg/protocol/codecs/array.pyx":131
 *                 elem_data.write_int32(-1)
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
          __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_L15_try_end:;
        }
      }
      __pyx_L7:;

      /* "asyncpg/protocol/codecs/array.pyx":127
 *                           encoder, encoder_arg)
 *     else:
 *         for i, item in enumerate(obj):             # <<<<<<<<<<<<<<
 *             if item is None:
 *                 elem_data.write_int32(-1)
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "asyncpg/protocol/codecs/array.pyx":138
 *                             i, e.args[0])) from None
 * 
 *     buf.write_int32(12 + 8 * ndims + elem_data.len())             # <<<<<<<<<<<<<<
 *     # Number of dimensions
 *     buf.write_int32(ndims)
 */
  __pyx_t_4 = __Pyx_PyInt_From_long((12 + (8 * __pyx_v_ndims))); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_elem_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_t_5); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":140
 *     buf.write_int32(12 + 8 * ndims + elem_data.len())
 *     # Number of dimensions
 *     buf.write_int32(ndims)             # <<<<<<<<<<<<<<
 *     # flags
 *     buf.write_int32(0)
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_v_ndims); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":142
 *     buf.write_int32(ndims)
 *     # flags
 *     buf.write_int32(0)             # <<<<<<<<<<<<<<
 *     # element type
 *     buf.write_int32(<int32_t>elem_oid)
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":144
 *     buf.write_int32(0)
 *     # element type
 *     buf.write_int32(<int32_t>elem_oid)             # <<<<<<<<<<<<<<
 *     # upper / lower bounds
 *     for i in range(ndims):
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, ((int32_t)__pyx_v_elem_oid)); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":146
 *     buf.write_int32(<int32_t>elem_oid)
 *     # upper / lower bounds
 *     for i in range(ndims):             # <<<<<<<<<<<<<<
 *         buf.write_int32(dims[i])
 *         buf.write_int32(1)
 */
  __pyx_t_7 = __pyx_v_ndims;
  __pyx_t_28 = __pyx_t_7;
  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
    __pyx_v_i = __pyx_t_29;

    /* "asyncpg/protocol/codecs/array.pyx":147
 *     # upper / lower bounds
 *     for i in range(ndims):
 *         buf.write_int32(dims[i])             # <<<<<<<<<<<<<<
 *         buf.write_int32(1)
 *     # element data
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, (__pyx_v_dims[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":148
 *     for i in range(ndims):
 *         buf.write_int32(dims[i])
 *         buf.write_int32(1)             # <<<<<<<<<<<<<<
 *     # element data
 *     buf.write_buffer(elem_data)
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "asyncpg/protocol/codecs/array.pyx":150
 *         buf.write_int32(1)
 *     # element data
 *     buf.write_buffer(elem_data)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, __pyx_v_elem_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":105
 * 
 * 
 * cdef inline array_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                          object obj, uint32_t elem_oid,
 *                          encode_func_ex encoder, const void *encoder_arg):
 */

  /* 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_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.array_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_data);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":153
 * 
 * 
 * cdef _write_textarray_data(ConnectionSettings settings, object obj,             # <<<<<<<<<<<<<<
 *                            int32_t ndims, int32_t dim, WriteBuffer array_data,
 *                            encode_func_ex encoder, const void *encoder_arg,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__write_textarray_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, PyObject *__pyx_v_obj, int32_t __pyx_v_ndims, int32_t __pyx_v_dim, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_array_data, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex __pyx_v_encoder, void const *__pyx_v_encoder_arg, Py_UCS4 __pyx_v_typdelim) {
  Py_ssize_t __pyx_v_i;
  int8_t __pyx_v_delim;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_elem_data = 0;
  Py_buffer __pyx_v_pybuf;
  char const *__pyx_v_elem_str;
  char __pyx_v_ch;
  Py_ssize_t __pyx_v_elem_len;
  Py_ssize_t __pyx_v_quoted_elem_len;
  int __pyx_v_need_quoting;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  char const *__pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write_textarray_data", 0);

  /* "asyncpg/protocol/codecs/array.pyx":158
 *                            Py_UCS4 typdelim):
 *     cdef:
 *         ssize_t i = 0             # <<<<<<<<<<<<<<
 *         int8_t delim = <int8_t>typdelim
 *         WriteBuffer elem_data
 */
  __pyx_v_i = 0;

  /* "asyncpg/protocol/codecs/array.pyx":159
 *     cdef:
 *         ssize_t i = 0
 *         int8_t delim = <int8_t>typdelim             # <<<<<<<<<<<<<<
 *         WriteBuffer elem_data
 *         Py_buffer pybuf
 */
  __pyx_v_delim = ((int8_t)__pyx_v_typdelim);

  /* "asyncpg/protocol/codecs/array.pyx":168
 *         bint need_quoting
 * 
 *     array_data.write_byte(b'{')             # <<<<<<<<<<<<<<
 * 
 *     if dim < ndims - 1:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '{'); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":170
 *     array_data.write_byte(b'{')
 * 
 *     if dim < ndims - 1:             # <<<<<<<<<<<<<<
 *         for item in obj:
 *             if i > 0:
 */
    __pyx_t_2 = ((__pyx_v_dim < (__pyx_v_ndims - 1)) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/array.pyx":171
 * 
 *     if dim < ndims - 1:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             if i > 0:
 *                 array_data.write_byte(delim)
 */
      if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
        __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
        __pyx_t_4 = NULL;
      } else {
        __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 171, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_4)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 171, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 171, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 171, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 171, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_4(__pyx_t_1);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(5, 171, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":172
 *     if dim < ndims - 1:
 *         for item in obj:
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')
 */
        __pyx_t_2 = ((__pyx_v_i > 0) != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/codecs/array.pyx":173
 *         for item in obj:
 *             if i > 0:
 *                 array_data.write_byte(delim)             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(b' ')
 *             _write_textarray_data(settings, item, ndims, dim + 1, array_data,
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, __pyx_v_delim); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 173, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":174
 *             if i > 0:
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')             # <<<<<<<<<<<<<<
 *             _write_textarray_data(settings, item, ndims, dim + 1, array_data,
 *                                   encoder, encoder_arg, typdelim)
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, ' '); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 174, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":172
 *     if dim < ndims - 1:
 *         for item in obj:
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":175
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')
 *             _write_textarray_data(settings, item, ndims, dim + 1, array_data,             # <<<<<<<<<<<<<<
 *                                   encoder, encoder_arg, typdelim)
 *             i += 1
 */
        __pyx_t_5 = __pyx_f_7asyncpg_8protocol_8protocol__write_textarray_data(__pyx_v_settings, __pyx_v_item, __pyx_v_ndims, (__pyx_v_dim + 1), __pyx_v_array_data, __pyx_v_encoder, __pyx_v_encoder_arg, __pyx_v_typdelim); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 175, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":177
 *             _write_textarray_data(settings, item, ndims, dim + 1, array_data,
 *                                   encoder, encoder_arg, typdelim)
 *             i += 1             # <<<<<<<<<<<<<<
 *     else:
 *         for item in obj:
 */
        __pyx_v_i = (__pyx_v_i + 1);

        /* "asyncpg/protocol/codecs/array.pyx":171
 * 
 *     if dim < ndims - 1:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             if i > 0:
 *                 array_data.write_byte(delim)
 */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":170
 *     array_data.write_byte(b'{')
 * 
 *     if dim < ndims - 1:             # <<<<<<<<<<<<<<
 *         for item in obj:
 *             if i > 0:
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/codecs/array.pyx":179
 *             i += 1
 *     else:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             elem_data = WriteBuffer.new()
 * 
 */
    /*else*/ {
      if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
        __pyx_t_1 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
        __pyx_t_4 = NULL;
      } else {
        __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 179, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_4)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 179, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 179, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(5, 179, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 179, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_4(__pyx_t_1);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(5, 179, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":180
 *     else:
 *         for item in obj:
 *             elem_data = WriteBuffer.new()             # <<<<<<<<<<<<<<
 * 
 *             if i > 0:
 */
        __pyx_t_5 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 180, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_elem_data, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":182
 *             elem_data = WriteBuffer.new()
 * 
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')
 */
        __pyx_t_2 = ((__pyx_v_i > 0) != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/codecs/array.pyx":183
 * 
 *             if i > 0:
 *                 array_data.write_byte(delim)             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(b' ')
 * 
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, __pyx_v_delim); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":184
 *             if i > 0:
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')             # <<<<<<<<<<<<<<
 * 
 *             if item is None:
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, ' '); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 184, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":182
 *             elem_data = WriteBuffer.new()
 * 
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 array_data.write_byte(delim)
 *                 array_data.write_byte(b' ')
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":186
 *                 array_data.write_byte(b' ')
 * 
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 array_data.write_bytes(b'NULL')
 *                 i += 1
 */
        __pyx_t_2 = (__pyx_v_item == Py_None);
        __pyx_t_6 = (__pyx_t_2 != 0);
        if (__pyx_t_6) {

          /* "asyncpg/protocol/codecs/array.pyx":187
 * 
 *             if item is None:
 *                 array_data.write_bytes(b'NULL')             # <<<<<<<<<<<<<<
 *                 i += 1
 *                 continue
 */
          __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_bytes(__pyx_v_array_data, __pyx_n_b_NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 187, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":188
 *             if item is None:
 *                 array_data.write_bytes(b'NULL')
 *                 i += 1             # <<<<<<<<<<<<<<
 *                 continue
 *             else:
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "asyncpg/protocol/codecs/array.pyx":189
 *                 array_data.write_bytes(b'NULL')
 *                 i += 1
 *                 continue             # <<<<<<<<<<<<<<
 *             else:
 *                 try:
 */
          goto __pyx_L7_continue;

          /* "asyncpg/protocol/codecs/array.pyx":186
 *                 array_data.write_byte(b' ')
 * 
 *             if item is None:             # <<<<<<<<<<<<<<
 *                 array_data.write_bytes(b'NULL')
 *                 i += 1
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":191
 *                 continue
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
        /*else*/ {
          {
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_7);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            /*try:*/ {

              /* "asyncpg/protocol/codecs/array.pyx":192
 *             else:
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)             # <<<<<<<<<<<<<<
 *                 except TypeError as e:
 *                     raise ValueError(
 */
              __pyx_t_5 = __pyx_v_encoder(__pyx_v_settings, __pyx_v_elem_data, __pyx_v_item, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 192, __pyx_L11_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":191
 *                 continue
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L18_try_end;
            __pyx_L11_error:;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "asyncpg/protocol/codecs/array.pyx":193
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(
 */
            __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
            if (__pyx_t_10) {
              __Pyx_AddTraceback("asyncpg.protocol.protocol._write_textarray_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_12) < 0) __PYX_ERR(5, 193, __pyx_L13_except_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_11);
              __pyx_v_e = __pyx_t_11;
              /*try:*/ {

                /* "asyncpg/protocol/codecs/array.pyx":195
 *                 except TypeError as e:
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(             # <<<<<<<<<<<<<<
 *                             e.args[0])) from None
 * 
 */
                __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_array_element, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 195, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_14);

                /* "asyncpg/protocol/codecs/array.pyx":196
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(
 *                             e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 *             # element string length (first four bytes are the encoded length.)
 */
                __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_15)) __PYX_ERR(5, 196, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_15);
                __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_15, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 196, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_16);
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __pyx_t_15 = NULL;
                if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
                  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
                  if (likely(__pyx_t_15)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                    __Pyx_INCREF(__pyx_t_15);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_14, function);
                  }
                }
                __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_16);
                __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                if (unlikely(!__pyx_t_13)) __PYX_ERR(5, 195, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

                /* "asyncpg/protocol/codecs/array.pyx":194
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'invalid array element: {}'.format(
 *                             e.args[0])) from None
 */
                __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 194, __pyx_L24_error)
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

                /* "asyncpg/protocol/codecs/array.pyx":196
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(
 *                             e.args[0])) from None             # <<<<<<<<<<<<<<
 * 
 *             # element string length (first four bytes are the encoded length.)
 */
                __Pyx_Raise(__pyx_t_14, 0, 0, Py_None);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __PYX_ERR(5, 194, __pyx_L24_error)
              }

              /* "asyncpg/protocol/codecs/array.pyx":193
 *                 try:
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'invalid array element: {}'.format(
 */
              /*finally:*/ {
                __pyx_L24_error:;
                /*exception exit:*/{
                  __Pyx_PyThreadState_declare
                  __Pyx_PyThreadState_assign
                  __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
                  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
                  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
                  __Pyx_XGOTREF(__pyx_t_19);
                  __Pyx_XGOTREF(__pyx_t_20);
                  __Pyx_XGOTREF(__pyx_t_21);
                  __Pyx_XGOTREF(__pyx_t_22);
                  __Pyx_XGOTREF(__pyx_t_23);
                  __Pyx_XGOTREF(__pyx_t_24);
                  __pyx_t_10 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
                  {
                    __Pyx_DECREF(__pyx_v_e);
                    __pyx_v_e = NULL;
                  }
                  if (PY_MAJOR_VERSION >= 3) {
                    __Pyx_XGIVEREF(__pyx_t_22);
                    __Pyx_XGIVEREF(__pyx_t_23);
                    __Pyx_XGIVEREF(__pyx_t_24);
                    __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
                  }
                  __Pyx_XGIVEREF(__pyx_t_19);
                  __Pyx_XGIVEREF(__pyx_t_20);
                  __Pyx_XGIVEREF(__pyx_t_21);
                  __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
                  __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0;
                  __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
                  goto __pyx_L13_except_error;
                }
              }
            }
            goto __pyx_L13_except_error;
            __pyx_L13_except_error:;

            /* "asyncpg/protocol/codecs/array.pyx":191
 *                 continue
 *             else:
 *                 try:             # <<<<<<<<<<<<<<
 *                     encoder(settings, elem_data, item, encoder_arg)
 *                 except TypeError as e:
 */
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            goto __pyx_L1_error;
            __pyx_L18_try_end:;
          }
        }

        /* "asyncpg/protocol/codecs/array.pyx":199
 * 
 *             # element string length (first four bytes are the encoded length.)
 *             elem_len = elem_data.len() - 4             # <<<<<<<<<<<<<<
 * 
 *             if elem_len == 0:
 */
        __pyx_t_12 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_elem_data); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = __Pyx_PyInt_SubtractObjC(__pyx_t_12, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_25 = PyInt_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_25 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(5, 199, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_v_elem_len = __pyx_t_25;

        /* "asyncpg/protocol/codecs/array.pyx":201
 *             elem_len = elem_data.len() - 4
 * 
 *             if elem_len == 0:             # <<<<<<<<<<<<<<
 *                 # Empty string
 *                 array_data.write_bytes(b'""')
 */
        __pyx_t_6 = ((__pyx_v_elem_len == 0) != 0);
        if (__pyx_t_6) {

          /* "asyncpg/protocol/codecs/array.pyx":203
 *             if elem_len == 0:
 *                 # Empty string
 *                 array_data.write_bytes(b'""')             # <<<<<<<<<<<<<<
 *             else:
 *                 cpython.PyObject_GetBuffer(
 */
          __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_bytes(__pyx_v_array_data, __pyx_kp_b__19); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":201
 *             elem_len = elem_data.len() - 4
 * 
 *             if elem_len == 0:             # <<<<<<<<<<<<<<
 *                 # Empty string
 *                 array_data.write_bytes(b'""')
 */
          goto __pyx_L30;
        }

        /* "asyncpg/protocol/codecs/array.pyx":205
 *                 array_data.write_bytes(b'""')
 *             else:
 *                 cpython.PyObject_GetBuffer(             # <<<<<<<<<<<<<<
 *                     elem_data, &pybuf, cpython.PyBUF_SIMPLE)
 * 
 */
        /*else*/ {

          /* "asyncpg/protocol/codecs/array.pyx":206
 *             else:
 *                 cpython.PyObject_GetBuffer(
 *                     elem_data, &pybuf, cpython.PyBUF_SIMPLE)             # <<<<<<<<<<<<<<
 * 
 *                 elem_str = <const char*>(pybuf.buf) + 4
 */
          __pyx_t_17 = PyObject_GetBuffer(((PyObject *)__pyx_v_elem_data), (&__pyx_v_pybuf), PyBUF_SIMPLE); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(5, 205, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":208
 *                     elem_data, &pybuf, cpython.PyBUF_SIMPLE)
 * 
 *                 elem_str = <const char*>(pybuf.buf) + 4             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
          __pyx_v_elem_str = (((char const *)__pyx_v_pybuf.buf) + 4);

          /* "asyncpg/protocol/codecs/array.pyx":210
 *                 elem_str = <const char*>(pybuf.buf) + 4
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     if not apg_strcasecmp_char(elem_str, b'NULL'):
 *                         array_data.write_byte(b'"')
 */
          /*try:*/ {

            /* "asyncpg/protocol/codecs/array.pyx":211
 * 
 *                 try:
 *                     if not apg_strcasecmp_char(elem_str, b'NULL'):             # <<<<<<<<<<<<<<
 *                         array_data.write_byte(b'"')
 *                         array_data.write_cstr(elem_str, 4)
 */
            __pyx_t_6 = ((!(__pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp_char(__pyx_v_elem_str, ((char const *)"NULL")) != 0)) != 0);
            if (__pyx_t_6) {

              /* "asyncpg/protocol/codecs/array.pyx":212
 *                 try:
 *                     if not apg_strcasecmp_char(elem_str, b'NULL'):
 *                         array_data.write_byte(b'"')             # <<<<<<<<<<<<<<
 *                         array_data.write_cstr(elem_str, 4)
 *                         array_data.write_byte(b'"')
 */
              __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '"'); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 212, __pyx_L34_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":213
 *                     if not apg_strcasecmp_char(elem_str, b'NULL'):
 *                         array_data.write_byte(b'"')
 *                         array_data.write_cstr(elem_str, 4)             # <<<<<<<<<<<<<<
 *                         array_data.write_byte(b'"')
 *                     else:
 */
              __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_cstr(__pyx_v_array_data, __pyx_v_elem_str, 4); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 213, __pyx_L34_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":214
 *                         array_data.write_byte(b'"')
 *                         array_data.write_cstr(elem_str, 4)
 *                         array_data.write_byte(b'"')             # <<<<<<<<<<<<<<
 *                     else:
 *                         quoted_elem_len = elem_len
 */
              __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '"'); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 214, __pyx_L34_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

              /* "asyncpg/protocol/codecs/array.pyx":211
 * 
 *                 try:
 *                     if not apg_strcasecmp_char(elem_str, b'NULL'):             # <<<<<<<<<<<<<<
 *                         array_data.write_byte(b'"')
 *                         array_data.write_cstr(elem_str, 4)
 */
              goto __pyx_L36;
            }

            /* "asyncpg/protocol/codecs/array.pyx":216
 *                         array_data.write_byte(b'"')
 *                     else:
 *                         quoted_elem_len = elem_len             # <<<<<<<<<<<<<<
 *                         need_quoting = False
 * 
 */
            /*else*/ {
              __pyx_v_quoted_elem_len = __pyx_v_elem_len;

              /* "asyncpg/protocol/codecs/array.pyx":217
 *                     else:
 *                         quoted_elem_len = elem_len
 *                         need_quoting = False             # <<<<<<<<<<<<<<
 * 
 *                         for i in range(elem_len):
 */
              __pyx_v_need_quoting = 0;

              /* "asyncpg/protocol/codecs/array.pyx":219
 *                         need_quoting = False
 * 
 *                         for i in range(elem_len):             # <<<<<<<<<<<<<<
 *                             ch = elem_str[i]
 *                             if ch == b'"' or ch == b'\\':
 */
              __pyx_t_25 = __pyx_v_elem_len;
              __pyx_t_26 = __pyx_t_25;
              for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
                __pyx_v_i = __pyx_t_27;

                /* "asyncpg/protocol/codecs/array.pyx":220
 * 
 *                         for i in range(elem_len):
 *                             ch = elem_str[i]             # <<<<<<<<<<<<<<
 *                             if ch == b'"' or ch == b'\\':
 *                                 # Quotes and backslashes need escaping.
 */
                __pyx_v_ch = (__pyx_v_elem_str[__pyx_v_i]);

                /* "asyncpg/protocol/codecs/array.pyx":221
 *                         for i in range(elem_len):
 *                             ch = elem_str[i]
 *                             if ch == b'"' or ch == b'\\':             # <<<<<<<<<<<<<<
 *                                 # Quotes and backslashes need escaping.
 *                                 quoted_elem_len += 1
 */
                switch (__pyx_v_ch) {
                  case '"':
                  case '\\':
                  __pyx_t_6 = 1;
                  break;
                  default:
                  __pyx_t_6 = 0;
                  break;
                }
                if (__pyx_t_6) {

                  /* "asyncpg/protocol/codecs/array.pyx":223
 *                             if ch == b'"' or ch == b'\\':
 *                                 # Quotes and backslashes need escaping.
 *                                 quoted_elem_len += 1             # <<<<<<<<<<<<<<
 *                                 need_quoting = True
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or
 */
                  __pyx_v_quoted_elem_len = (__pyx_v_quoted_elem_len + 1);

                  /* "asyncpg/protocol/codecs/array.pyx":224
 *                                 # Quotes and backslashes need escaping.
 *                                 quoted_elem_len += 1
 *                                 need_quoting = True             # <<<<<<<<<<<<<<
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or
 *                                     apg_ascii_isspace(<uint32_t>ch)):
 */
                  __pyx_v_need_quoting = 1;

                  /* "asyncpg/protocol/codecs/array.pyx":221
 *                         for i in range(elem_len):
 *                             ch = elem_str[i]
 *                             if ch == b'"' or ch == b'\\':             # <<<<<<<<<<<<<<
 *                                 # Quotes and backslashes need escaping.
 *                                 quoted_elem_len += 1
 */
                  goto __pyx_L39;
                }

                /* "asyncpg/protocol/codecs/array.pyx":225
 *                                 quoted_elem_len += 1
 *                                 need_quoting = True
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or             # <<<<<<<<<<<<<<
 *                                     apg_ascii_isspace(<uint32_t>ch)):
 *                                 need_quoting = True
 */
                __pyx_t_2 = ((__pyx_v_ch == '{') != 0);
                  if (!__pyx_t_2) {
                  } else {
                    __pyx_t_6 = __pyx_t_2;
                    goto __pyx_L40_bool_binop_done;
                  }
                __pyx_t_2 = ((__pyx_v_ch == '}') != 0);
                if (!__pyx_t_2) {
                } else {
                  __pyx_t_6 = __pyx_t_2;
                  goto __pyx_L40_bool_binop_done;
                }
                __pyx_t_2 = ((__pyx_v_ch == __pyx_v_delim) != 0);
                if (!__pyx_t_2) {
                } else {
                  __pyx_t_6 = __pyx_t_2;
                  goto __pyx_L40_bool_binop_done;
                }

                /* "asyncpg/protocol/codecs/array.pyx":226
 *                                 need_quoting = True
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or
 *                                     apg_ascii_isspace(<uint32_t>ch)):             # <<<<<<<<<<<<<<
 *                                 need_quoting = True
 * 
 */
                __pyx_t_2 = (__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace(((uint32_t)__pyx_v_ch)) != 0);
                __pyx_t_6 = __pyx_t_2;
                __pyx_L40_bool_binop_done:;

                /* "asyncpg/protocol/codecs/array.pyx":225
 *                                 quoted_elem_len += 1
 *                                 need_quoting = True
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or             # <<<<<<<<<<<<<<
 *                                     apg_ascii_isspace(<uint32_t>ch)):
 *                                 need_quoting = True
 */
                if (__pyx_t_6) {

                  /* "asyncpg/protocol/codecs/array.pyx":227
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or
 *                                     apg_ascii_isspace(<uint32_t>ch)):
 *                                 need_quoting = True             # <<<<<<<<<<<<<<
 * 
 *                         if need_quoting:
 */
                  __pyx_v_need_quoting = 1;

                  /* "asyncpg/protocol/codecs/array.pyx":225
 *                                 quoted_elem_len += 1
 *                                 need_quoting = True
 *                             elif (ch == b'{' or ch == b'}' or ch == delim or             # <<<<<<<<<<<<<<
 *                                     apg_ascii_isspace(<uint32_t>ch)):
 *                                 need_quoting = True
 */
                }
                __pyx_L39:;
              }

              /* "asyncpg/protocol/codecs/array.pyx":229
 *                                 need_quoting = True
 * 
 *                         if need_quoting:             # <<<<<<<<<<<<<<
 *                             array_data.write_byte(b'"')
 * 
 */
              __pyx_t_6 = (__pyx_v_need_quoting != 0);
              if (__pyx_t_6) {

                /* "asyncpg/protocol/codecs/array.pyx":230
 * 
 *                         if need_quoting:
 *                             array_data.write_byte(b'"')             # <<<<<<<<<<<<<<
 * 
 *                             if quoted_elem_len == elem_len:
 */
                __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '"'); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 230, __pyx_L34_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                /* "asyncpg/protocol/codecs/array.pyx":232
 *                             array_data.write_byte(b'"')
 * 
 *                             if quoted_elem_len == elem_len:             # <<<<<<<<<<<<<<
 *                                 array_data.write_cstr(elem_str, elem_len)
 *                             else:
 */
                __pyx_t_6 = ((__pyx_v_quoted_elem_len == __pyx_v_elem_len) != 0);
                if (__pyx_t_6) {

                  /* "asyncpg/protocol/codecs/array.pyx":233
 * 
 *                             if quoted_elem_len == elem_len:
 *                                 array_data.write_cstr(elem_str, elem_len)             # <<<<<<<<<<<<<<
 *                             else:
 *                                 # Escaping required.
 */
                  __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_cstr(__pyx_v_array_data, __pyx_v_elem_str, __pyx_v_elem_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 233, __pyx_L34_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                  /* "asyncpg/protocol/codecs/array.pyx":232
 *                             array_data.write_byte(b'"')
 * 
 *                             if quoted_elem_len == elem_len:             # <<<<<<<<<<<<<<
 *                                 array_data.write_cstr(elem_str, elem_len)
 *                             else:
 */
                  goto __pyx_L45;
                }

                /* "asyncpg/protocol/codecs/array.pyx":236
 *                             else:
 *                                 # Escaping required.
 *                                 for i in range(elem_len):             # <<<<<<<<<<<<<<
 *                                     ch = elem_str[i]
 *                                     if ch == b'"' or ch == b'\\':
 */
                /*else*/ {
                  __pyx_t_25 = __pyx_v_elem_len;
                  __pyx_t_26 = __pyx_t_25;
                  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
                    __pyx_v_i = __pyx_t_27;

                    /* "asyncpg/protocol/codecs/array.pyx":237
 *                                 # Escaping required.
 *                                 for i in range(elem_len):
 *                                     ch = elem_str[i]             # <<<<<<<<<<<<<<
 *                                     if ch == b'"' or ch == b'\\':
 *                                         array_data.write_byte(b'\\')
 */
                    __pyx_v_ch = (__pyx_v_elem_str[__pyx_v_i]);

                    /* "asyncpg/protocol/codecs/array.pyx":238
 *                                 for i in range(elem_len):
 *                                     ch = elem_str[i]
 *                                     if ch == b'"' or ch == b'\\':             # <<<<<<<<<<<<<<
 *                                         array_data.write_byte(b'\\')
 *                                     array_data.write_byte(ch)
 */
                    switch (__pyx_v_ch) {
                      case '"':
                      case '\\':

                      /* "asyncpg/protocol/codecs/array.pyx":239
 *                                     ch = elem_str[i]
 *                                     if ch == b'"' or ch == b'\\':
 *                                         array_data.write_byte(b'\\')             # <<<<<<<<<<<<<<
 *                                     array_data.write_byte(ch)
 * 
 */
                      __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '\\'); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 239, __pyx_L34_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                      /* "asyncpg/protocol/codecs/array.pyx":238
 *                                 for i in range(elem_len):
 *                                     ch = elem_str[i]
 *                                     if ch == b'"' or ch == b'\\':             # <<<<<<<<<<<<<<
 *                                         array_data.write_byte(b'\\')
 *                                     array_data.write_byte(ch)
 */
                      break;
                      default: break;
                    }

                    /* "asyncpg/protocol/codecs/array.pyx":240
 *                                     if ch == b'"' or ch == b'\\':
 *                                         array_data.write_byte(b'\\')
 *                                     array_data.write_byte(ch)             # <<<<<<<<<<<<<<
 * 
 *                             array_data.write_byte(b'"')
 */
                    __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, __pyx_v_ch); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 240, __pyx_L34_error)
                    __Pyx_GOTREF(__pyx_t_11);
                    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                  }
                }
                __pyx_L45:;

                /* "asyncpg/protocol/codecs/array.pyx":242
 *                                     array_data.write_byte(ch)
 * 
 *                             array_data.write_byte(b'"')             # <<<<<<<<<<<<<<
 *                         else:
 *                             array_data.write_cstr(elem_str, elem_len)
 */
                __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '"'); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 242, __pyx_L34_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                /* "asyncpg/protocol/codecs/array.pyx":229
 *                                 need_quoting = True
 * 
 *                         if need_quoting:             # <<<<<<<<<<<<<<
 *                             array_data.write_byte(b'"')
 * 
 */
                goto __pyx_L44;
              }

              /* "asyncpg/protocol/codecs/array.pyx":244
 *                             array_data.write_byte(b'"')
 *                         else:
 *                             array_data.write_cstr(elem_str, elem_len)             # <<<<<<<<<<<<<<
 *                 finally:
 *                     cpython.PyBuffer_Release(&pybuf)
 */
              /*else*/ {
                __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_cstr(__pyx_v_array_data, __pyx_v_elem_str, __pyx_v_elem_len); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 244, __pyx_L34_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              }
              __pyx_L44:;
            }
            __pyx_L36:;
          }

          /* "asyncpg/protocol/codecs/array.pyx":246
 *                             array_data.write_cstr(elem_str, elem_len)
 *                 finally:
 *                     cpython.PyBuffer_Release(&pybuf)             # <<<<<<<<<<<<<<
 * 
 *             i += 1
 */
          /*finally:*/ {
            /*normal exit:*/{
              PyBuffer_Release((&__pyx_v_pybuf));
              goto __pyx_L35;
            }
            __pyx_L34_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
              __Pyx_XGOTREF(__pyx_t_9);
              __Pyx_XGOTREF(__pyx_t_8);
              __Pyx_XGOTREF(__pyx_t_7);
              __Pyx_XGOTREF(__pyx_t_24);
              __Pyx_XGOTREF(__pyx_t_23);
              __Pyx_XGOTREF(__pyx_t_22);
              __pyx_t_17 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
              {
                PyBuffer_Release((&__pyx_v_pybuf));
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_24);
                __Pyx_XGIVEREF(__pyx_t_23);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
              }
              __Pyx_XGIVEREF(__pyx_t_9);
              __Pyx_XGIVEREF(__pyx_t_8);
              __Pyx_XGIVEREF(__pyx_t_7);
              __Pyx_ErrRestore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
              __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
              __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_28;
              goto __pyx_L1_error;
            }
            __pyx_L35:;
          }
        }
        __pyx_L30:;

        /* "asyncpg/protocol/codecs/array.pyx":248
 *                     cpython.PyBuffer_Release(&pybuf)
 * 
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *     array_data.write_byte(b'}')
 */
        __pyx_v_i = (__pyx_v_i + 1);

        /* "asyncpg/protocol/codecs/array.pyx":179
 *             i += 1
 *     else:
 *         for item in obj:             # <<<<<<<<<<<<<<
 *             elem_data = WriteBuffer.new()
 * 
 */
        __pyx_L7_continue:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L3:;

    /* "asyncpg/protocol/codecs/array.pyx":250
 *             i += 1
 * 
 *     array_data.write_byte(b'}')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_array_data->__pyx_vtab)->write_byte(__pyx_v_array_data, '}'); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":153
 * 
 * 
 * cdef _write_textarray_data(ConnectionSettings settings, object obj,             # <<<<<<<<<<<<<<
 *                            int32_t ndims, int32_t dim, WriteBuffer array_data,
 *                            encode_func_ex encoder, const void *encoder_arg,
 */

  /* 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_5);
  __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_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._write_textarray_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_data);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":253
 * 
 * 
 * cdef inline textarray_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                              object obj, encode_func_ex encoder,
 *                              const void *encoder_arg, Py_UCS4 typdelim):
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_textarray_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex __pyx_v_encoder, void const *__pyx_v_encoder_arg, Py_UCS4 __pyx_v_typdelim) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_array_data = 0;
  int32_t __pyx_v_dims[6];
  int32_t __pyx_v_ndims;
  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;
  PyObject *__pyx_t_6 = NULL;
  int32_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("textarray_encode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":259
 *         WriteBuffer array_data
 *         int32_t dims[ARRAY_MAXDIM]
 *         int32_t ndims = 1             # <<<<<<<<<<<<<<
 *         int32_t i
 * 
 */
  __pyx_v_ndims = 1;

  /* "asyncpg/protocol/codecs/array.pyx":262
 *         int32_t i
 * 
 *     if not _is_array_iterable(obj):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol__is_array_iterable(__pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 262, __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(5, 262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/codecs/array.pyx":264
 *     if not _is_array_iterable(obj):
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(             # <<<<<<<<<<<<<<
 *                 type(obj).__name__))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_a_sized_iterable_container_expec, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/codecs/array.pyx":265
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 *                 type(obj).__name__))             # <<<<<<<<<<<<<<
 * 
 *     _get_array_shape(obj, dims, &ndims)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_obj)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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_1 = (__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_1)) __PYX_ERR(5, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":263
 * 
 *     if not _is_array_iterable(obj):
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             'a sized iterable container expected (got type {!r})'.format(
 *                 type(obj).__name__))
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(5, 263, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":262
 *         int32_t i
 * 
 *     if not _is_array_iterable(obj):             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'a sized iterable container expected (got type {!r})'.format(
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":267
 *                 type(obj).__name__))
 * 
 *     _get_array_shape(obj, dims, &ndims)             # <<<<<<<<<<<<<<
 * 
 *     array_data = WriteBuffer.new()
 */
  __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol__get_array_shape(__pyx_v_obj, __pyx_v_dims, (&__pyx_v_ndims)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":269
 *     _get_array_shape(obj, dims, &ndims)
 * 
 *     array_data = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *     _write_textarray_data(settings, obj, ndims, 0, array_data,
 *                           encoder, encoder_arg, typdelim)
 */
  __pyx_t_4 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_array_data = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":270
 * 
 *     array_data = WriteBuffer.new()
 *     _write_textarray_data(settings, obj, ndims, 0, array_data,             # <<<<<<<<<<<<<<
 *                           encoder, encoder_arg, typdelim)
 *     buf.write_int32(array_data.len())
 */
  __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol__write_textarray_data(__pyx_v_settings, __pyx_v_obj, __pyx_v_ndims, 0, __pyx_v_array_data, __pyx_v_encoder, __pyx_v_encoder_arg, __pyx_v_typdelim); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":272
 *     _write_textarray_data(settings, obj, ndims, 0, array_data,
 *                           encoder, encoder_arg, typdelim)
 *     buf.write_int32(array_data.len())             # <<<<<<<<<<<<<<
 *     buf.write_buffer(array_data)
 * 
 */
  __pyx_t_4 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_array_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_t_4); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(5, 272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":273
 *                           encoder, encoder_arg, typdelim)
 *     buf.write_int32(array_data.len())
 *     buf.write_buffer(array_data)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, __pyx_v_array_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":253
 * 
 * 
 * cdef inline textarray_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                              object obj, encode_func_ex encoder,
 *                              const void *encoder_arg, Py_UCS4 typdelim):
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.textarray_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_array_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":276
 * 
 * 
 * cdef inline array_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                          decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_array_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex __pyx_v_decoder, void const *__pyx_v_decoder_arg) {
  int32_t __pyx_v_ndims;
  CYTHON_UNUSED int32_t __pyx_v_flags;
  CYTHON_UNUSED uint32_t __pyx_v_elem_oid;
  PyObject *__pyx_v_result = 0;
  int __pyx_v_i;
  int32_t __pyx_v_elem_len;
  int32_t __pyx_v_elem_count;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_elem_buf;
  int32_t __pyx_v_dims[6];
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__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;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int32_t __pyx_t_11;
  int32_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":279
 *                          decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 *         int32_t ndims = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         int32_t flags = hton.unpack_int32(frb_read(buf, 4))
 *         uint32_t elem_oid = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 279, __pyx_L1_error)
  __pyx_v_ndims = unpack_int32(__pyx_t_1);

  /* "asyncpg/protocol/codecs/array.pyx":280
 *     cdef:
 *         int32_t ndims = hton.unpack_int32(frb_read(buf, 4))
 *         int32_t flags = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         uint32_t elem_oid = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         list result
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 280, __pyx_L1_error)
  __pyx_v_flags = unpack_int32(__pyx_t_1);

  /* "asyncpg/protocol/codecs/array.pyx":281
 *         int32_t ndims = hton.unpack_int32(frb_read(buf, 4))
 *         int32_t flags = hton.unpack_int32(frb_read(buf, 4))
 *         uint32_t elem_oid = <uint32_t>hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         list result
 *         int i
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 281, __pyx_L1_error)
  __pyx_v_elem_oid = ((uint32_t)unpack_int32(__pyx_t_1));

  /* "asyncpg/protocol/codecs/array.pyx":285
 *         int i
 *         int32_t elem_len
 *         int32_t elem_count = 1             # <<<<<<<<<<<<<<
 *         FRBuffer elem_buf
 *         int32_t dims[ARRAY_MAXDIM]
 */
  __pyx_v_elem_count = 1;

  /* "asyncpg/protocol/codecs/array.pyx":290
 *         Codec elem_codec
 * 
 *     if ndims == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_2 = ((__pyx_v_ndims == 0) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/array.pyx":291
 * 
 *     if ndims == 0:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     if ndims > ARRAY_MAXDIM:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/array.pyx":290
 *         Codec elem_codec
 * 
 *     if ndims == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":293
 *         return []
 * 
 *     if ndims > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 */
  __pyx_t_2 = ((__pyx_v_ndims > 6) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/codecs/array.pyx":294
 * 
 *     if ndims > ARRAY_MAXDIM:
 *         raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *             format(ndims, ARRAY_MAXDIM))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":295
 *     if ndims > ARRAY_MAXDIM:
 *         raise exceptions.ProtocolError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.             # <<<<<<<<<<<<<<
 *             format(ndims, ARRAY_MAXDIM))
 *     elif ndims < 0:
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_number_of_array_dimensions_excee, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/codecs/array.pyx":296
 *         raise exceptions.ProtocolError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *             format(ndims, ARRAY_MAXDIM))             # <<<<<<<<<<<<<<
 *     elif ndims < 0:
 *         raise exceptions.ProtocolError(
 */
    __pyx_t_7 = __Pyx_PyInt_From_int32_t(__pyx_v_ndims); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_int_6};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 296, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_int_6};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 296, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_6);
      __Pyx_GIVEREF(__pyx_int_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_int_6);
      __pyx_t_7 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(5, 294, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":293
 *         return []
 * 
 *     if ndims > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":297
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *             format(ndims, ARRAY_MAXDIM))
 *     elif ndims < 0:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'unexpected array dimensions value: {}'.format(ndims))
 */
  __pyx_t_2 = ((__pyx_v_ndims < 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/codecs/array.pyx":298
 *             format(ndims, ARRAY_MAXDIM))
 *     elif ndims < 0:
 *         raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *             'unexpected array dimensions value: {}'.format(ndims))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":299
 *     elif ndims < 0:
 *         raise exceptions.ProtocolError(
 *             'unexpected array dimensions value: {}'.format(ndims))             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndims):
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_array_dimensions_valu, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyInt_From_int32_t(__pyx_v_ndims); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 299, __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_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(5, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(5, 298, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":297
 *             'number of array dimensions ({}) exceed the maximum expected ({})'.
 *             format(ndims, ARRAY_MAXDIM))
 *     elif ndims < 0:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'unexpected array dimensions value: {}'.format(ndims))
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":301
 *             'unexpected array dimensions value: {}'.format(ndims))
 * 
 *     for i in range(ndims):             # <<<<<<<<<<<<<<
 *         dims[i] = hton.unpack_int32(frb_read(buf, 4))
 *         if dims[i] < 0:
 */
  __pyx_t_11 = __pyx_v_ndims;
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_12; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "asyncpg/protocol/codecs/array.pyx":302
 * 
 *     for i in range(ndims):
 *         dims[i] = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         if dims[i] < 0:
 *             raise exceptions.ProtocolError(
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 302, __pyx_L1_error)
    (__pyx_v_dims[__pyx_v_i]) = unpack_int32(__pyx_t_1);

    /* "asyncpg/protocol/codecs/array.pyx":303
 *     for i in range(ndims):
 *         dims[i] = hton.unpack_int32(frb_read(buf, 4))
 *         if dims[i] < 0:             # <<<<<<<<<<<<<<
 *             raise exceptions.ProtocolError(
 *                 'unexpected array dimension size: {}'.format(dims[i]))
 */
    __pyx_t_2 = (((__pyx_v_dims[__pyx_v_i]) < 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/codecs/array.pyx":304
 *         dims[i] = hton.unpack_int32(frb_read(buf, 4))
 *         if dims[i] < 0:
 *             raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *                 'unexpected array dimension size: {}'.format(dims[i]))
 *         # Ignore the lower bound information
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":305
 *         if dims[i] < 0:
 *             raise exceptions.ProtocolError(
 *                 'unexpected array dimension size: {}'.format(dims[i]))             # <<<<<<<<<<<<<<
 *         # Ignore the lower bound information
 *         frb_read(buf, 4)
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_array_dimension_size, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = __Pyx_PyInt_From_int32_t((__pyx_v_dims[__pyx_v_i])); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(5, 304, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":303
 *     for i in range(ndims):
 *         dims[i] = hton.unpack_int32(frb_read(buf, 4))
 *         if dims[i] < 0:             # <<<<<<<<<<<<<<
 *             raise exceptions.ProtocolError(
 *                 'unexpected array dimension size: {}'.format(dims[i]))
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":307
 *                 'unexpected array dimension size: {}'.format(dims[i]))
 *         # Ignore the lower bound information
 *         frb_read(buf, 4)             # <<<<<<<<<<<<<<
 * 
 *     if ndims == 1:
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 307, __pyx_L1_error)
  }

  /* "asyncpg/protocol/codecs/array.pyx":309
 *         frb_read(buf, 4)
 * 
 *     if ndims == 1:             # <<<<<<<<<<<<<<
 *         # Fast path for flat arrays
 *         elem_count = dims[0]
 */
  __pyx_t_2 = ((__pyx_v_ndims == 1) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/array.pyx":311
 *     if ndims == 1:
 *         # Fast path for flat arrays
 *         elem_count = dims[0]             # <<<<<<<<<<<<<<
 *         result = cpython.PyList_New(elem_count)
 * 
 */
    __pyx_v_elem_count = (__pyx_v_dims[0]);

    /* "asyncpg/protocol/codecs/array.pyx":312
 *         # Fast path for flat arrays
 *         elem_count = dims[0]
 *         result = cpython.PyList_New(elem_count)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(elem_count):
 */
    __pyx_t_3 = PyList_New(__pyx_v_elem_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":314
 *         result = cpython.PyList_New(elem_count)
 * 
 *         for i in range(elem_count):             # <<<<<<<<<<<<<<
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:
 */
    __pyx_t_11 = __pyx_v_elem_count;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_12; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "asyncpg/protocol/codecs/array.pyx":315
 * 
 *         for i in range(elem_count):
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *             if elem_len == -1:
 *                 elem = None
 */
      __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 315, __pyx_L1_error)
      __pyx_v_elem_len = unpack_int32(__pyx_t_1);

      /* "asyncpg/protocol/codecs/array.pyx":316
 *         for i in range(elem_count):
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:             # <<<<<<<<<<<<<<
 *                 elem = None
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_elem_len == -1L) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":317
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:
 *                 elem = None             # <<<<<<<<<<<<<<
 *             else:
 *                 frb_slice_from(&elem_buf, buf, elem_len)
 */
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_elem, Py_None);

        /* "asyncpg/protocol/codecs/array.pyx":316
 *         for i in range(elem_count):
 *             elem_len = hton.unpack_int32(frb_read(buf, 4))
 *             if elem_len == -1:             # <<<<<<<<<<<<<<
 *                 elem = None
 *             else:
 */
        goto __pyx_L11;
      }

      /* "asyncpg/protocol/codecs/array.pyx":319
 *                 elem = None
 *             else:
 *                 frb_slice_from(&elem_buf, buf, elem_len)             # <<<<<<<<<<<<<<
 *                 elem = decoder(settings, &elem_buf, decoder_arg)
 * 
 */
      /*else*/ {
        (void)(__pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from((&__pyx_v_elem_buf), __pyx_v_buf, __pyx_v_elem_len));

        /* "asyncpg/protocol/codecs/array.pyx":320
 *             else:
 *                 frb_slice_from(&elem_buf, buf, elem_len)
 *                 elem = decoder(settings, &elem_buf, decoder_arg)             # <<<<<<<<<<<<<<
 * 
 *             cpython.Py_INCREF(elem)
 */
        __pyx_t_3 = __pyx_v_decoder(__pyx_v_settings, (&__pyx_v_elem_buf), __pyx_v_decoder_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L11:;

      /* "asyncpg/protocol/codecs/array.pyx":322
 *                 elem = decoder(settings, &elem_buf, decoder_arg)
 * 
 *             cpython.Py_INCREF(elem)             # <<<<<<<<<<<<<<
 *             cpython.PyList_SET_ITEM(result, i, elem)
 * 
 */
      Py_INCREF(__pyx_v_elem);

      /* "asyncpg/protocol/codecs/array.pyx":323
 * 
 *             cpython.Py_INCREF(elem)
 *             cpython.PyList_SET_ITEM(result, i, elem)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
      PyList_SET_ITEM(__pyx_v_result, __pyx_v_i, __pyx_v_elem);
    }

    /* "asyncpg/protocol/codecs/array.pyx":309
 *         frb_read(buf, 4)
 * 
 *     if ndims == 1:             # <<<<<<<<<<<<<<
 *         # Fast path for flat arrays
 *         elem_count = dims[0]
 */
    goto __pyx_L8;
  }

  /* "asyncpg/protocol/codecs/array.pyx":326
 * 
 *     else:
 *         result = _nested_array_decode(settings, buf,             # <<<<<<<<<<<<<<
 *                                       decoder, decoder_arg, ndims, dims,
 *                                       &elem_buf)
 */
  /*else*/ {

    /* "asyncpg/protocol/codecs/array.pyx":328
 *         result = _nested_array_decode(settings, buf,
 *                                       decoder, decoder_arg, ndims, dims,
 *                                       &elem_buf)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__nested_array_decode(__pyx_v_settings, __pyx_v_buf, __pyx_v_decoder, __pyx_v_decoder_arg, __pyx_v_ndims, __pyx_v_dims, (&__pyx_v_elem_buf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/codecs/array.pyx":326
 * 
 *     else:
 *         result = _nested_array_decode(settings, buf,             # <<<<<<<<<<<<<<
 *                                       decoder, decoder_arg, ndims, dims,
 *                                       &elem_buf)
 */
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(5, 326, __pyx_L1_error)
    __pyx_v_result = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L8:;

  /* "asyncpg/protocol/codecs/array.pyx":330
 *                                       &elem_buf)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":276
 * 
 * 
 * cdef inline array_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                          decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 */

  /* 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_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.array_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":333
 * 
 * 
 * cdef _nested_array_decode(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf,
 *                           decode_func_ex decoder,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__nested_array_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex __pyx_v_decoder, void const *__pyx_v_decoder_arg, int32_t __pyx_v_ndims, int32_t *__pyx_v_dims, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_elem_buf) {
  int32_t __pyx_v_elem_len;
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  int64_t __pyx_v_array_len;
  PyObject *__pyx_v_elem = 0;
  PyObject *__pyx_v_stride = 0;
  void *__pyx_v_strides[6];
  int32_t __pyx_v_indexes[6];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
  int64_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  char const *__pyx_t_10;
  int64_t __pyx_t_11;
  int64_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_nested_array_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":343
 *         int32_t elem_len
 *         int64_t i, j
 *         int64_t array_len = 1             # <<<<<<<<<<<<<<
 *         object elem, stride
 *         # An array of pointers to lists for each current array level.
 */
  __pyx_v_array_len = 1;

  /* "asyncpg/protocol/codecs/array.pyx":350
 *         int32_t indexes[ARRAY_MAXDIM]
 * 
 *     for i in range(ndims):             # <<<<<<<<<<<<<<
 *         array_len *= dims[i]
 *         indexes[i] = 0
 */
  __pyx_t_1 = __pyx_v_ndims;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "asyncpg/protocol/codecs/array.pyx":351
 * 
 *     for i in range(ndims):
 *         array_len *= dims[i]             # <<<<<<<<<<<<<<
 *         indexes[i] = 0
 *         strides[i] = NULL
 */
    __pyx_v_array_len = (__pyx_v_array_len * (__pyx_v_dims[__pyx_v_i]));

    /* "asyncpg/protocol/codecs/array.pyx":352
 *     for i in range(ndims):
 *         array_len *= dims[i]
 *         indexes[i] = 0             # <<<<<<<<<<<<<<
 *         strides[i] = NULL
 * 
 */
    (__pyx_v_indexes[__pyx_v_i]) = 0;

    /* "asyncpg/protocol/codecs/array.pyx":353
 *         array_len *= dims[i]
 *         indexes[i] = 0
 *         strides[i] = NULL             # <<<<<<<<<<<<<<
 * 
 *     if array_len == 0:
 */
    (__pyx_v_strides[__pyx_v_i]) = NULL;
  }

  /* "asyncpg/protocol/codecs/array.pyx":355
 *         strides[i] = NULL
 * 
 *     if array_len == 0:             # <<<<<<<<<<<<<<
 *         # A multidimensional array with a zero-sized dimension?
 *         return []
 */
  __pyx_t_4 = ((__pyx_v_array_len == 0) != 0);
  if (__pyx_t_4) {

    /* "asyncpg/protocol/codecs/array.pyx":357
 *     if array_len == 0:
 *         # A multidimensional array with a zero-sized dimension?
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     elif array_len < 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/array.pyx":355
 *         strides[i] = NULL
 * 
 *     if array_len == 0:             # <<<<<<<<<<<<<<
 *         # A multidimensional array with a zero-sized dimension?
 *         return []
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":359
 *         return []
 * 
 *     elif array_len < 0:             # <<<<<<<<<<<<<<
 *         # Array length overflow
 *         raise exceptions.ProtocolError('array length overflow')
 */
  __pyx_t_4 = ((__pyx_v_array_len < 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "asyncpg/protocol/codecs/array.pyx":361
 *     elif array_len < 0:
 *         # Array length overflow
 *         raise exceptions.ProtocolError('array length overflow')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(array_len):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_kp_u_array_length_overflow) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_u_array_length_overflow);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(5, 361, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/array.pyx":359
 *         return []
 * 
 *     elif array_len < 0:             # <<<<<<<<<<<<<<
 *         # Array length overflow
 *         raise exceptions.ProtocolError('array length overflow')
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":363
 *         raise exceptions.ProtocolError('array length overflow')
 * 
 *     for i in range(array_len):             # <<<<<<<<<<<<<<
 *         # Decode the element.
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 */
  __pyx_t_3 = __pyx_v_array_len;
  __pyx_t_8 = __pyx_t_3;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "asyncpg/protocol/codecs/array.pyx":365
 *     for i in range(array_len):
 *         # Decode the element.
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         if elem_len == -1:
 *             elem = None
 */
    __pyx_t_10 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_10 == ((char const *)NULL))) __PYX_ERR(5, 365, __pyx_L1_error)
    __pyx_v_elem_len = unpack_int32(__pyx_t_10);

    /* "asyncpg/protocol/codecs/array.pyx":366
 *         # Decode the element.
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 *         if elem_len == -1:             # <<<<<<<<<<<<<<
 *             elem = None
 *         else:
 */
    __pyx_t_4 = ((__pyx_v_elem_len == -1L) != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/codecs/array.pyx":367
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 *         if elem_len == -1:
 *             elem = None             # <<<<<<<<<<<<<<
 *         else:
 *             elem = decoder(settings,
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_elem, Py_None);

      /* "asyncpg/protocol/codecs/array.pyx":366
 *         # Decode the element.
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 *         if elem_len == -1:             # <<<<<<<<<<<<<<
 *             elem = None
 *         else:
 */
      goto __pyx_L8;
    }

    /* "asyncpg/protocol/codecs/array.pyx":369
 *             elem = None
 *         else:
 *             elem = decoder(settings,             # <<<<<<<<<<<<<<
 *                            frb_slice_from(elem_buf, buf, elem_len),
 *                            decoder_arg)
 */
    /*else*/ {

      /* "asyncpg/protocol/codecs/array.pyx":371
 *             elem = decoder(settings,
 *                            frb_slice_from(elem_buf, buf, elem_len),
 *                            decoder_arg)             # <<<<<<<<<<<<<<
 * 
 *         # Take an explicit reference for PyList_SET_ITEM in the below
 */
      __pyx_t_5 = __pyx_v_decoder(__pyx_v_settings, __pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from(__pyx_v_elem_buf, __pyx_v_buf, __pyx_v_elem_len), __pyx_v_decoder_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L8:;

    /* "asyncpg/protocol/codecs/array.pyx":375
 *         # Take an explicit reference for PyList_SET_ITEM in the below
 *         # loop expects this.
 *         cpython.Py_INCREF(elem)             # <<<<<<<<<<<<<<
 * 
 *         # Iterate over array dimentions and put the element in
 */
    Py_INCREF(__pyx_v_elem);

    /* "asyncpg/protocol/codecs/array.pyx":379
 *         # Iterate over array dimentions and put the element in
 *         # the correctly nested sublist.
 *         for j in reversed(range(ndims)):             # <<<<<<<<<<<<<<
 *             if indexes[j] == 0:
 *                 # Allocate the list for this array level.
 */
    for (__pyx_t_11 = __pyx_v_ndims-1; __pyx_t_11 >= 0; __pyx_t_11-=1) {
      __pyx_v_j = __pyx_t_11;

      /* "asyncpg/protocol/codecs/array.pyx":380
 *         # the correctly nested sublist.
 *         for j in reversed(range(ndims)):
 *             if indexes[j] == 0:             # <<<<<<<<<<<<<<
 *                 # Allocate the list for this array level.
 *                 stride = cpython.PyList_New(dims[j])
 */
      __pyx_t_4 = (((__pyx_v_indexes[__pyx_v_j]) == 0) != 0);
      if (__pyx_t_4) {

        /* "asyncpg/protocol/codecs/array.pyx":382
 *             if indexes[j] == 0:
 *                 # Allocate the list for this array level.
 *                 stride = cpython.PyList_New(dims[j])             # <<<<<<<<<<<<<<
 * 
 *                 strides[j] = <void*><cpython.PyObject>stride
 */
        __pyx_t_5 = PyList_New((__pyx_v_dims[__pyx_v_j])); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_stride, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":384
 *                 stride = cpython.PyList_New(dims[j])
 * 
 *                 strides[j] = <void*><cpython.PyObject>stride             # <<<<<<<<<<<<<<
 *                 # Take an explicit reference for PyList_SET_ITEM below
 *                 # expects this.
 */
        (__pyx_v_strides[__pyx_v_j]) = ((void *)__pyx_v_stride);

        /* "asyncpg/protocol/codecs/array.pyx":387
 *                 # Take an explicit reference for PyList_SET_ITEM below
 *                 # expects this.
 *                 cpython.Py_INCREF(stride)             # <<<<<<<<<<<<<<
 * 
 *             stride = <object><cpython.PyObject*>strides[j]
 */
        Py_INCREF(__pyx_v_stride);

        /* "asyncpg/protocol/codecs/array.pyx":380
 *         # the correctly nested sublist.
 *         for j in reversed(range(ndims)):
 *             if indexes[j] == 0:             # <<<<<<<<<<<<<<
 *                 # Allocate the list for this array level.
 *                 stride = cpython.PyList_New(dims[j])
 */
      }

      /* "asyncpg/protocol/codecs/array.pyx":389
 *                 cpython.Py_INCREF(stride)
 * 
 *             stride = <object><cpython.PyObject*>strides[j]             # <<<<<<<<<<<<<<
 *             cpython.PyList_SET_ITEM(stride, indexes[j], elem)
 *             indexes[j] += 1
 */
      __pyx_t_5 = ((PyObject *)((PyObject *)(__pyx_v_strides[__pyx_v_j])));
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_stride, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":390
 * 
 *             stride = <object><cpython.PyObject*>strides[j]
 *             cpython.PyList_SET_ITEM(stride, indexes[j], elem)             # <<<<<<<<<<<<<<
 *             indexes[j] += 1
 * 
 */
      PyList_SET_ITEM(__pyx_v_stride, (__pyx_v_indexes[__pyx_v_j]), __pyx_v_elem);

      /* "asyncpg/protocol/codecs/array.pyx":391
 *             stride = <object><cpython.PyObject*>strides[j]
 *             cpython.PyList_SET_ITEM(stride, indexes[j], elem)
 *             indexes[j] += 1             # <<<<<<<<<<<<<<
 * 
 *             if indexes[j] == dims[j] and j != 0:
 */
      __pyx_t_12 = __pyx_v_j;
      (__pyx_v_indexes[__pyx_t_12]) = ((__pyx_v_indexes[__pyx_t_12]) + 1);

      /* "asyncpg/protocol/codecs/array.pyx":393
 *             indexes[j] += 1
 * 
 *             if indexes[j] == dims[j] and j != 0:             # <<<<<<<<<<<<<<
 *                 # This array level is full, continue the
 *                 # ascent in the dimensions so that this level
 */
      __pyx_t_13 = (((__pyx_v_indexes[__pyx_v_j]) == (__pyx_v_dims[__pyx_v_j])) != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_4 = __pyx_t_13;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_13 = ((__pyx_v_j != 0) != 0);
      __pyx_t_4 = __pyx_t_13;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_4) {

        /* "asyncpg/protocol/codecs/array.pyx":397
 *                 # ascent in the dimensions so that this level
 *                 # sublist will be appened to the parent list.
 *                 elem = stride             # <<<<<<<<<<<<<<
 *                 # Reset the index, this will cause the
 *                 # new list to be allocated on the next
 */
        __Pyx_INCREF(__pyx_v_stride);
        __Pyx_DECREF_SET(__pyx_v_elem, __pyx_v_stride);

        /* "asyncpg/protocol/codecs/array.pyx":401
 *                 # new list to be allocated on the next
 *                 # iteration on this array axis.
 *                 indexes[j] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 break
 */
        (__pyx_v_indexes[__pyx_v_j]) = 0;

        /* "asyncpg/protocol/codecs/array.pyx":393
 *             indexes[j] += 1
 * 
 *             if indexes[j] == dims[j] and j != 0:             # <<<<<<<<<<<<<<
 *                 # This array level is full, continue the
 *                 # ascent in the dimensions so that this level
 */
        goto __pyx_L12;
      }

      /* "asyncpg/protocol/codecs/array.pyx":403
 *                 indexes[j] = 0
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *     stride = <object><cpython.PyObject*>strides[0]
 */
      /*else*/ {
        goto __pyx_L10_break;
      }
      __pyx_L12:;
    }
    __pyx_L10_break:;
  }

  /* "asyncpg/protocol/codecs/array.pyx":405
 *                 break
 * 
 *     stride = <object><cpython.PyObject*>strides[0]             # <<<<<<<<<<<<<<
 *     # Since each element in strides has a refcount of 1,
 *     # returning strides[0] will increment it to 2, so
 */
  __pyx_t_5 = ((PyObject *)((PyObject *)(__pyx_v_strides[0])));
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_XDECREF_SET(__pyx_v_stride, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":409
 *     # returning strides[0] will increment it to 2, so
 *     # balance that.
 *     cpython.Py_DECREF(stride)             # <<<<<<<<<<<<<<
 *     return stride
 * 
 */
  Py_DECREF(__pyx_v_stride);

  /* "asyncpg/protocol/codecs/array.pyx":410
 *     # balance that.
 *     cpython.Py_DECREF(stride)
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_stride);
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":333
 * 
 * 
 * cdef _nested_array_decode(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                           FRBuffer *buf,
 *                           decode_func_ex decoder,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._nested_array_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_stride);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":413
 * 
 * 
 * cdef textarray_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                       decode_func_ex decoder, const void *decoder_arg,
 *                       Py_UCS4 typdelim):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_textarray_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex __pyx_v_decoder, void const *__pyx_v_decoder_arg, Py_UCS4 __pyx_v_typdelim) {
  Py_UCS4 *__pyx_v_array_text;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_UCS4 *__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;
  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;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  char const *__pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("textarray_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":422
 *     # Make a copy of array data since we will be mutating it for
 *     # the purposes of element decoding.
 *     s = pgproto.text_decode(settings, buf)             # <<<<<<<<<<<<<<
 *     array_text = cpythonx.PyUnicode_AsUCS4Copy(s)
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_text_decode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(5, 422, __pyx_L1_error)
  __pyx_v_s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":423
 *     # the purposes of element decoding.
 *     s = pgproto.text_decode(settings, buf)
 *     array_text = cpythonx.PyUnicode_AsUCS4Copy(s)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __pyx_t_2 = PyUnicode_AsUCS4Copy(__pyx_v_s); if (unlikely(__pyx_t_2 == ((Py_UCS4 *)NULL))) __PYX_ERR(5, 423, __pyx_L1_error)
  __pyx_v_array_text = __pyx_t_2;

  /* "asyncpg/protocol/codecs/array.pyx":425
 *     array_text = cpythonx.PyUnicode_AsUCS4Copy(s)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/codecs/array.pyx":426
 * 
 *     try:
 *         return _textarray_decode(             # <<<<<<<<<<<<<<
 *             settings, array_text, decoder, decoder_arg, typdelim)
 *     except ValueError as e:
 */
        __Pyx_XDECREF(__pyx_r);

        /* "asyncpg/protocol/codecs/array.pyx":427
 *     try:
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)             # <<<<<<<<<<<<<<
 *     except ValueError as e:
 *         raise exceptions.ProtocolError(
 */
        __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol__textarray_decode(__pyx_v_settings, __pyx_v_array_text, __pyx_v_decoder, __pyx_v_decoder_arg, __pyx_v_typdelim); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 426, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L10_try_return;

        /* "asyncpg/protocol/codecs/array.pyx":425
 *     array_text = cpythonx.PyUnicode_AsUCS4Copy(s)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)
 */
      }
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":428
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)
 *     except ValueError as e:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'malformed array literal {!r}: {}'.format(s, e.args[0]))
 */
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_6) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.textarray_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(5, 428, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_v_e = __pyx_t_7;
        /*try:*/ {

          /* "asyncpg/protocol/codecs/array.pyx":429
 *             settings, array_text, decoder, decoder_arg, typdelim)
 *     except ValueError as e:
 *         raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *             'malformed array literal {!r}: {}'.format(s, e.args[0]))
 *     finally:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 429, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 429, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":430
 *     except ValueError as e:
 *         raise exceptions.ProtocolError(
 *             'malformed array literal {!r}: {}'.format(s, e.args[0]))             # <<<<<<<<<<<<<<
 *     finally:
 *         cpython.PyMem_Free(array_text)
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_malformed_array_literal_r, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 430, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_13)) __PYX_ERR(5, 430, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_13, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 430, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_12)) {
            PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_s, __pyx_t_14};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 430, __pyx_L17_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
            PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_s, __pyx_t_14};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 430, __pyx_L17_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          {
            __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(5, 430, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (__pyx_t_13) {
              __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
            }
            __Pyx_INCREF(__pyx_v_s);
            __Pyx_GIVEREF(__pyx_v_s);
            PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_s);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 430, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_9 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __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_9)) __PYX_ERR(5, 429, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(5, 429, __pyx_L17_error)
        }

        /* "asyncpg/protocol/codecs/array.pyx":428
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)
 *     except ValueError as e:             # <<<<<<<<<<<<<<
 *         raise exceptions.ProtocolError(
 *             'malformed array literal {!r}: {}'.format(s, e.args[0]))
 */
        /*finally:*/ {
          __pyx_L17_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 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_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_18);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_22);
            __Pyx_XGOTREF(__pyx_t_23);
            __pyx_t_6 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e);
              __pyx_v_e = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_22);
              __Pyx_XGIVEREF(__pyx_t_23);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
            }
            __Pyx_XGIVEREF(__pyx_t_18);
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
            __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
            goto __pyx_L8_except_error;
          }
        }
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;

      /* "asyncpg/protocol/codecs/array.pyx":425
 *     array_text = cpythonx.PyUnicode_AsUCS4Copy(s)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _textarray_decode(
 *             settings, array_text, decoder, decoder_arg, typdelim)
 */
      __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_L4_error;
      __pyx_L10_try_return:;
      __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_L3_return;
    }
  }

  /* "asyncpg/protocol/codecs/array.pyx":432
 *             'malformed array literal {!r}: {}'.format(s, e.args[0]))
 *     finally:
 *         cpython.PyMem_Free(array_text)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 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_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_21);
      __pyx_t_16 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_24 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_array_text);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0;
      __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_24;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_21 = __pyx_r;
      __pyx_r = 0;
      PyMem_Free(__pyx_v_array_text);
      __pyx_r = __pyx_t_21;
      __pyx_t_21 = 0;
      goto __pyx_L0;
    }
  }

  /* "asyncpg/protocol/codecs/array.pyx":413
 * 
 * 
 * cdef textarray_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                       decode_func_ex decoder, const void *decoder_arg,
 *                       Py_UCS4 typdelim):
 */

  /* 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_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.textarray_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":435
 * 
 * 
 * cdef _textarray_decode(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                        Py_UCS4 *array_text,
 *                        decode_func_ex decoder,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__textarray_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, Py_UCS4 *__pyx_v_array_text, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex __pyx_v_decoder, void const *__pyx_v_decoder_arg, Py_UCS4 __pyx_v_typdelim) {
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_v_new_stride = 0;
  Py_UCS4 *__pyx_v_ptr;
  int32_t __pyx_v_ndims;
  int32_t __pyx_v_ubound;
  int32_t __pyx_v_lbound;
  int32_t __pyx_v_dims[6];
  int32_t __pyx_v_inferred_dims[6];
  int32_t __pyx_v_inferred_ndims;
  void *__pyx_v_strides[6];
  int32_t __pyx_v_indexes[6];
  int32_t __pyx_v_nest_level;
  int32_t __pyx_v_item_level;
  int __pyx_v_end_of_array;
  int __pyx_v_end_of_item;
  int __pyx_v_has_quoting;
  int __pyx_v_strip_spaces;
  int __pyx_v_in_quotes;
  Py_UCS4 *__pyx_v_item_start;
  Py_UCS4 *__pyx_v_item_ptr;
  Py_UCS4 *__pyx_v_item_end;
  int __pyx_v_i;
  PyObject *__pyx_v_item = 0;
  PyObject *__pyx_v_item_text = 0;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_item_buf;
  char *__pyx_v_pg_item_str;
  Py_ssize_t __pyx_v_pg_item_len;
  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;
  int32_t __pyx_t_8;
  int32_t __pyx_t_9;
  PyObject *__pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_textarray_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":446
 *         list new_stride
 *         Py_UCS4 *ptr
 *         int32_t ndims = 0             # <<<<<<<<<<<<<<
 *         int32_t ubound = 0
 *         int32_t lbound = 0
 */
  __pyx_v_ndims = 0;

  /* "asyncpg/protocol/codecs/array.pyx":447
 *         Py_UCS4 *ptr
 *         int32_t ndims = 0
 *         int32_t ubound = 0             # <<<<<<<<<<<<<<
 *         int32_t lbound = 0
 *         int32_t dims[ARRAY_MAXDIM]
 */
  __pyx_v_ubound = 0;

  /* "asyncpg/protocol/codecs/array.pyx":448
 *         int32_t ndims = 0
 *         int32_t ubound = 0
 *         int32_t lbound = 0             # <<<<<<<<<<<<<<
 *         int32_t dims[ARRAY_MAXDIM]
 *         int32_t inferred_dims[ARRAY_MAXDIM]
 */
  __pyx_v_lbound = 0;

  /* "asyncpg/protocol/codecs/array.pyx":451
 *         int32_t dims[ARRAY_MAXDIM]
 *         int32_t inferred_dims[ARRAY_MAXDIM]
 *         int32_t inferred_ndims = 0             # <<<<<<<<<<<<<<
 *         void *strides[ARRAY_MAXDIM]
 *         int32_t indexes[ARRAY_MAXDIM]
 */
  __pyx_v_inferred_ndims = 0;

  /* "asyncpg/protocol/codecs/array.pyx":454
 *         void *strides[ARRAY_MAXDIM]
 *         int32_t indexes[ARRAY_MAXDIM]
 *         int32_t nest_level = 0             # <<<<<<<<<<<<<<
 *         int32_t item_level = 0
 *         bint end_of_array = False
 */
  __pyx_v_nest_level = 0;

  /* "asyncpg/protocol/codecs/array.pyx":455
 *         int32_t indexes[ARRAY_MAXDIM]
 *         int32_t nest_level = 0
 *         int32_t item_level = 0             # <<<<<<<<<<<<<<
 *         bint end_of_array = False
 * 
 */
  __pyx_v_item_level = 0;

  /* "asyncpg/protocol/codecs/array.pyx":456
 *         int32_t nest_level = 0
 *         int32_t item_level = 0
 *         bint end_of_array = False             # <<<<<<<<<<<<<<
 * 
 *         bint end_of_item = False
 */
  __pyx_v_end_of_array = 0;

  /* "asyncpg/protocol/codecs/array.pyx":458
 *         bint end_of_array = False
 * 
 *         bint end_of_item = False             # <<<<<<<<<<<<<<
 *         bint has_quoting = False
 *         bint strip_spaces = False
 */
  __pyx_v_end_of_item = 0;

  /* "asyncpg/protocol/codecs/array.pyx":459
 * 
 *         bint end_of_item = False
 *         bint has_quoting = False             # <<<<<<<<<<<<<<
 *         bint strip_spaces = False
 *         bint in_quotes = False
 */
  __pyx_v_has_quoting = 0;

  /* "asyncpg/protocol/codecs/array.pyx":460
 *         bint end_of_item = False
 *         bint has_quoting = False
 *         bint strip_spaces = False             # <<<<<<<<<<<<<<
 *         bint in_quotes = False
 *         Py_UCS4 *item_start
 */
  __pyx_v_strip_spaces = 0;

  /* "asyncpg/protocol/codecs/array.pyx":461
 *         bint has_quoting = False
 *         bint strip_spaces = False
 *         bint in_quotes = False             # <<<<<<<<<<<<<<
 *         Py_UCS4 *item_start
 *         Py_UCS4 *item_ptr
 */
  __pyx_v_in_quotes = 0;

  /* "asyncpg/protocol/codecs/array.pyx":473
 *         ssize_t pg_item_len
 * 
 *     ptr = array_text             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
  __pyx_v_ptr = __pyx_v_array_text;

  /* "asyncpg/protocol/codecs/array.pyx":475
 *     ptr = array_text
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         while apg_ascii_isspace(ptr[0]):
 *             ptr += 1
 */
  while (1) {

    /* "asyncpg/protocol/codecs/array.pyx":476
 * 
 *     while True:
 *         while apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *             ptr += 1
 * 
 */
    while (1) {
      __pyx_t_1 = (__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace((__pyx_v_ptr[0])) != 0);
      if (!__pyx_t_1) break;

      /* "asyncpg/protocol/codecs/array.pyx":477
 *     while True:
 *         while apg_ascii_isspace(ptr[0]):
 *             ptr += 1             # <<<<<<<<<<<<<<
 * 
 *         if ptr[0] != '[':
 */
      __pyx_v_ptr = (__pyx_v_ptr + 1);
    }

    /* "asyncpg/protocol/codecs/array.pyx":479
 *             ptr += 1
 * 
 *         if ptr[0] != '[':             # <<<<<<<<<<<<<<
 *             # Finished parsing dimensions spec.
 *             break
 */
    __pyx_t_1 = (((__pyx_v_ptr[0]) != 91) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/array.pyx":481
 *         if ptr[0] != '[':
 *             # Finished parsing dimensions spec.
 *             break             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1  # '['
 */
      goto __pyx_L4_break;

      /* "asyncpg/protocol/codecs/array.pyx":479
 *             ptr += 1
 * 
 *         if ptr[0] != '[':             # <<<<<<<<<<<<<<
 *             # Finished parsing dimensions spec.
 *             break
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":483
 *             break
 * 
 *         ptr += 1  # '['             # <<<<<<<<<<<<<<
 * 
 *         if ndims > ARRAY_MAXDIM:
 */
    __pyx_v_ptr = (__pyx_v_ptr + 1);

    /* "asyncpg/protocol/codecs/array.pyx":485
 *         ptr += 1  # '['
 * 
 *         if ndims > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'number of array dimensions ({}) exceed the '
 */
    __pyx_t_1 = ((__pyx_v_ndims > 6) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/codecs/array.pyx":488
 *             raise ValueError(
 *                 'number of array dimensions ({}) exceed the '
 *                 'maximum expected ({})'.format(ndims, ARRAY_MAXDIM))             # <<<<<<<<<<<<<<
 * 
 *         ptr = apg_parse_int32(ptr, &ubound)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_number_of_array_dimensions_excee, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_ndims); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 488, __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_4, __pyx_int_6};
        __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(5, 488, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_int_6};
        __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(5, 488, __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(5, 488, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
        __Pyx_INCREF(__pyx_int_6);
        __Pyx_GIVEREF(__pyx_int_6);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_int_6);
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 488, __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;

      /* "asyncpg/protocol/codecs/array.pyx":486
 * 
 *         if ndims > ARRAY_MAXDIM:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'number of array dimensions ({}) exceed the '
 *                 'maximum expected ({})'.format(ndims, ARRAY_MAXDIM))
 */
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 486, __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(5, 486, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":485
 *         ptr += 1  # '['
 * 
 *         if ndims > ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'number of array dimensions ({}) exceed the '
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":490
 *                 'maximum expected ({})'.format(ndims, ARRAY_MAXDIM))
 * 
 *         ptr = apg_parse_int32(ptr, &ubound)             # <<<<<<<<<<<<<<
 *         if ptr == NULL:
 *             raise ValueError('missing array dimension value')
 */
    __pyx_v_ptr = __pyx_f_7asyncpg_8protocol_8protocol_apg_parse_int32(__pyx_v_ptr, (&__pyx_v_ubound));

    /* "asyncpg/protocol/codecs/array.pyx":491
 * 
 *         ptr = apg_parse_int32(ptr, &ubound)
 *         if ptr == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('missing array dimension value')
 * 
 */
    __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/codecs/array.pyx":492
 *         ptr = apg_parse_int32(ptr, &ubound)
 *         if ptr == NULL:
 *             raise ValueError('missing array dimension value')             # <<<<<<<<<<<<<<
 * 
 *         if ptr[0] == ':':
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 492, __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(5, 492, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":491
 * 
 *         ptr = apg_parse_int32(ptr, &ubound)
 *         if ptr == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('missing array dimension value')
 * 
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":494
 *             raise ValueError('missing array dimension value')
 * 
 *         if ptr[0] == ':':             # <<<<<<<<<<<<<<
 *             ptr += 1
 *             lbound = ubound
 */
    __pyx_t_1 = (((__pyx_v_ptr[0]) == 58) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/array.pyx":495
 * 
 *         if ptr[0] == ':':
 *             ptr += 1             # <<<<<<<<<<<<<<
 *             lbound = ubound
 * 
 */
      __pyx_v_ptr = (__pyx_v_ptr + 1);

      /* "asyncpg/protocol/codecs/array.pyx":496
 *         if ptr[0] == ':':
 *             ptr += 1
 *             lbound = ubound             # <<<<<<<<<<<<<<
 * 
 *             # [lower:upper] spec.  We disregard the lbound for decoding.
 */
      __pyx_v_lbound = __pyx_v_ubound;

      /* "asyncpg/protocol/codecs/array.pyx":499
 * 
 *             # [lower:upper] spec.  We disregard the lbound for decoding.
 *             ptr = apg_parse_int32(ptr, &ubound)             # <<<<<<<<<<<<<<
 *             if ptr == NULL:
 *                 raise ValueError('missing array dimension value')
 */
      __pyx_v_ptr = __pyx_f_7asyncpg_8protocol_8protocol_apg_parse_int32(__pyx_v_ptr, (&__pyx_v_ubound));

      /* "asyncpg/protocol/codecs/array.pyx":500
 *             # [lower:upper] spec.  We disregard the lbound for decoding.
 *             ptr = apg_parse_int32(ptr, &ubound)
 *             if ptr == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('missing array dimension value')
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
      if (unlikely(__pyx_t_1)) {

        /* "asyncpg/protocol/codecs/array.pyx":501
 *             ptr = apg_parse_int32(ptr, &ubound)
 *             if ptr == NULL:
 *                 raise ValueError('missing array dimension value')             # <<<<<<<<<<<<<<
 *         else:
 *             lbound = 1
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 501, __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(5, 501, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/array.pyx":500
 *             # [lower:upper] spec.  We disregard the lbound for decoding.
 *             ptr = apg_parse_int32(ptr, &ubound)
 *             if ptr == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('missing array dimension value')
 *         else:
 */
      }

      /* "asyncpg/protocol/codecs/array.pyx":494
 *             raise ValueError('missing array dimension value')
 * 
 *         if ptr[0] == ':':             # <<<<<<<<<<<<<<
 *             ptr += 1
 *             lbound = ubound
 */
      goto __pyx_L10;
    }

    /* "asyncpg/protocol/codecs/array.pyx":503
 *                 raise ValueError('missing array dimension value')
 *         else:
 *             lbound = 1             # <<<<<<<<<<<<<<
 * 
 *         if ptr[0] != ']':
 */
    /*else*/ {
      __pyx_v_lbound = 1;
    }
    __pyx_L10:;

    /* "asyncpg/protocol/codecs/array.pyx":505
 *             lbound = 1
 * 
 *         if ptr[0] != ']':             # <<<<<<<<<<<<<<
 *             raise ValueError('missing \']\' after array dimensions')
 * 
 */
    __pyx_t_1 = (((__pyx_v_ptr[0]) != 93) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/codecs/array.pyx":506
 * 
 *         if ptr[0] != ']':
 *             raise ValueError('missing \']\' after array dimensions')             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1  # ']'
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 506, __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(5, 506, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":505
 *             lbound = 1
 * 
 *         if ptr[0] != ']':             # <<<<<<<<<<<<<<
 *             raise ValueError('missing \']\' after array dimensions')
 * 
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":508
 *             raise ValueError('missing \']\' after array dimensions')
 * 
 *         ptr += 1  # ']'             # <<<<<<<<<<<<<<
 * 
 *         dims[ndims] = ubound - lbound + 1
 */
    __pyx_v_ptr = (__pyx_v_ptr + 1);

    /* "asyncpg/protocol/codecs/array.pyx":510
 *         ptr += 1  # ']'
 * 
 *         dims[ndims] = ubound - lbound + 1             # <<<<<<<<<<<<<<
 *         ndims += 1
 * 
 */
    (__pyx_v_dims[__pyx_v_ndims]) = ((__pyx_v_ubound - __pyx_v_lbound) + 1);

    /* "asyncpg/protocol/codecs/array.pyx":511
 * 
 *         dims[ndims] = ubound - lbound + 1
 *         ndims += 1             # <<<<<<<<<<<<<<
 * 
 *     if ndims != 0:
 */
    __pyx_v_ndims = (__pyx_v_ndims + 1);
  }
  __pyx_L4_break:;

  /* "asyncpg/protocol/codecs/array.pyx":513
 *         ndims += 1
 * 
 *     if ndims != 0:             # <<<<<<<<<<<<<<
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':
 */
  __pyx_t_1 = ((__pyx_v_ndims != 0) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/array.pyx":515
 *     if ndims != 0:
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':             # <<<<<<<<<<<<<<
 *             raise ValueError('missing \'=\' after array dimensions')
 * 
 */
    __pyx_t_1 = (((__pyx_v_ptr[0]) != 61) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/codecs/array.pyx":516
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':
 *             raise ValueError('missing \'=\' after array dimensions')             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1  # '='
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 516, __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(5, 516, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":515
 *     if ndims != 0:
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':             # <<<<<<<<<<<<<<
 *             raise ValueError('missing \'=\' after array dimensions')
 * 
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":518
 *             raise ValueError('missing \'=\' after array dimensions')
 * 
 *         ptr += 1  # '='             # <<<<<<<<<<<<<<
 * 
 *         # Skip any whitespace after the '=', whitespace
 */
    __pyx_v_ptr = (__pyx_v_ptr + 1);

    /* "asyncpg/protocol/codecs/array.pyx":522
 *         # Skip any whitespace after the '=', whitespace
 *         # before was consumed in the above loop.
 *         while apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *             ptr += 1
 * 
 */
    while (1) {
      __pyx_t_1 = (__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace((__pyx_v_ptr[0])) != 0);
      if (!__pyx_t_1) break;

      /* "asyncpg/protocol/codecs/array.pyx":523
 *         # before was consumed in the above loop.
 *         while apg_ascii_isspace(ptr[0]):
 *             ptr += 1             # <<<<<<<<<<<<<<
 * 
 *         # Infer the dimensions from the brace structure in the
 */
      __pyx_v_ptr = (__pyx_v_ptr + 1);
    }

    /* "asyncpg/protocol/codecs/array.pyx":528
 *         # array literal body, and check that it matches the explicit
 *         # spec.  This also validates that the array literal is sane.
 *         _infer_array_dims(ptr, typdelim, inferred_dims, &inferred_ndims)             # <<<<<<<<<<<<<<
 * 
 *         if inferred_ndims != ndims:
 */
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__infer_array_dims(__pyx_v_ptr, __pyx_v_typdelim, __pyx_v_inferred_dims, (&__pyx_v_inferred_ndims)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/codecs/array.pyx":530
 *         _infer_array_dims(ptr, typdelim, inferred_dims, &inferred_ndims)
 * 
 *         if inferred_ndims != ndims:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'specified array dimensions do not match array content')
 */
    __pyx_t_1 = ((__pyx_v_inferred_ndims != __pyx_v_ndims) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/codecs/array.pyx":531
 * 
 *         if inferred_ndims != ndims:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'specified array dimensions do not match array content')
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 531, __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(5, 531, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":530
 *         _infer_array_dims(ptr, typdelim, inferred_dims, &inferred_ndims)
 * 
 *         if inferred_ndims != ndims:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'specified array dimensions do not match array content')
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":534
 *                 'specified array dimensions do not match array content')
 * 
 *         for i in range(ndims):             # <<<<<<<<<<<<<<
 *             if inferred_dims[i] != dims[i]:
 *                 raise ValueError(
 */
    __pyx_t_8 = __pyx_v_ndims;
    __pyx_t_9 = __pyx_t_8;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_9; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "asyncpg/protocol/codecs/array.pyx":535
 * 
 *         for i in range(ndims):
 *             if inferred_dims[i] != dims[i]:             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'specified array dimensions do not match array content')
 */
      __pyx_t_1 = (((__pyx_v_inferred_dims[__pyx_v_i]) != (__pyx_v_dims[__pyx_v_i])) != 0);
      if (unlikely(__pyx_t_1)) {

        /* "asyncpg/protocol/codecs/array.pyx":536
 *         for i in range(ndims):
 *             if inferred_dims[i] != dims[i]:
 *                 raise ValueError(             # <<<<<<<<<<<<<<
 *                     'specified array dimensions do not match array content')
 *     else:
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 536, __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(5, 536, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/array.pyx":535
 * 
 *         for i in range(ndims):
 *             if inferred_dims[i] != dims[i]:             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'specified array dimensions do not match array content')
 */
      }
    }

    /* "asyncpg/protocol/codecs/array.pyx":513
 *         ndims += 1
 * 
 *     if ndims != 0:             # <<<<<<<<<<<<<<
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':
 */
    goto __pyx_L13;
  }

  /* "asyncpg/protocol/codecs/array.pyx":541
 *         # Infer the dimensions from the brace structure in the array literal
 *         # body.  This also validates that the array literal is sane.
 *         _infer_array_dims(ptr, typdelim, dims, &ndims)             # <<<<<<<<<<<<<<
 * 
 *     while not end_of_array:
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__infer_array_dims(__pyx_v_ptr, __pyx_v_typdelim, __pyx_v_dims, (&__pyx_v_ndims)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L13:;

  /* "asyncpg/protocol/codecs/array.pyx":543
 *         _infer_array_dims(ptr, typdelim, dims, &ndims)
 * 
 *     while not end_of_array:             # <<<<<<<<<<<<<<
 *         # We iterate over the literal character by character
 *         # and modify the string in-place removing the array-specific
 */
  while (1) {
    __pyx_t_1 = ((!(__pyx_v_end_of_array != 0)) != 0);
    if (!__pyx_t_1) break;

    /* "asyncpg/protocol/codecs/array.pyx":547
 *         # and modify the string in-place removing the array-specific
 *         # quoting and determining the boundaries of each element.
 *         end_of_item = has_quoting = in_quotes = False             # <<<<<<<<<<<<<<
 *         strip_spaces = True
 * 
 */
    __pyx_v_end_of_item = 0;
    __pyx_v_has_quoting = 0;
    __pyx_v_in_quotes = 0;

    /* "asyncpg/protocol/codecs/array.pyx":548
 *         # quoting and determining the boundaries of each element.
 *         end_of_item = has_quoting = in_quotes = False
 *         strip_spaces = True             # <<<<<<<<<<<<<<
 * 
 *         # Pointers to array element start, end, and the current pointer
 */
    __pyx_v_strip_spaces = 1;

    /* "asyncpg/protocol/codecs/array.pyx":553
 *         # tracking the position where characters are written when
 *         # escaping is folded.
 *         item_start = item_end = item_ptr = ptr             # <<<<<<<<<<<<<<
 *         item_level = 0
 * 
 */
    __pyx_v_item_start = __pyx_v_ptr;
    __pyx_v_item_end = __pyx_v_ptr;
    __pyx_v_item_ptr = __pyx_v_ptr;

    /* "asyncpg/protocol/codecs/array.pyx":554
 *         # escaping is folded.
 *         item_start = item_end = item_ptr = ptr
 *         item_level = 0             # <<<<<<<<<<<<<<
 * 
 *         while not end_of_item:
 */
    __pyx_v_item_level = 0;

    /* "asyncpg/protocol/codecs/array.pyx":556
 *         item_level = 0
 * 
 *         while not end_of_item:             # <<<<<<<<<<<<<<
 *             if ptr[0] == '"':
 *                 in_quotes = not in_quotes
 */
    while (1) {
      __pyx_t_1 = ((!(__pyx_v_end_of_item != 0)) != 0);
      if (!__pyx_t_1) break;

      /* "asyncpg/protocol/codecs/array.pyx":557
 * 
 *         while not end_of_item:
 *             if ptr[0] == '"':             # <<<<<<<<<<<<<<
 *                 in_quotes = not in_quotes
 *                 if in_quotes:
 */
      __pyx_t_1 = (((__pyx_v_ptr[0]) == 34) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":558
 *         while not end_of_item:
 *             if ptr[0] == '"':
 *                 in_quotes = not in_quotes             # <<<<<<<<<<<<<<
 *                 if in_quotes:
 *                     strip_spaces = False
 */
        __pyx_v_in_quotes = (!(__pyx_v_in_quotes != 0));

        /* "asyncpg/protocol/codecs/array.pyx":559
 *             if ptr[0] == '"':
 *                 in_quotes = not in_quotes
 *                 if in_quotes:             # <<<<<<<<<<<<<<
 *                     strip_spaces = False
 *                 else:
 */
        __pyx_t_1 = (__pyx_v_in_quotes != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":560
 *                 in_quotes = not in_quotes
 *                 if in_quotes:
 *                     strip_spaces = False             # <<<<<<<<<<<<<<
 *                 else:
 *                     item_end = item_ptr
 */
          __pyx_v_strip_spaces = 0;

          /* "asyncpg/protocol/codecs/array.pyx":559
 *             if ptr[0] == '"':
 *                 in_quotes = not in_quotes
 *                 if in_quotes:             # <<<<<<<<<<<<<<
 *                     strip_spaces = False
 *                 else:
 */
          goto __pyx_L26;
        }

        /* "asyncpg/protocol/codecs/array.pyx":562
 *                     strip_spaces = False
 *                 else:
 *                     item_end = item_ptr             # <<<<<<<<<<<<<<
 *                 has_quoting = True
 * 
 */
        /*else*/ {
          __pyx_v_item_end = __pyx_v_item_ptr;
        }
        __pyx_L26:;

        /* "asyncpg/protocol/codecs/array.pyx":563
 *                 else:
 *                     item_end = item_ptr
 *                 has_quoting = True             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '\\':
 */
        __pyx_v_has_quoting = 1;

        /* "asyncpg/protocol/codecs/array.pyx":557
 * 
 *         while not end_of_item:
 *             if ptr[0] == '"':             # <<<<<<<<<<<<<<
 *                 in_quotes = not in_quotes
 *                 if in_quotes:
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":565
 *                 has_quoting = True
 * 
 *             elif ptr[0] == '\\':             # <<<<<<<<<<<<<<
 *                 # Quoted character, collapse the backslash.
 *                 ptr += 1
 */
      __pyx_t_1 = (((__pyx_v_ptr[0]) == 92) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":567
 *             elif ptr[0] == '\\':
 *                 # Quoted character, collapse the backslash.
 *                 ptr += 1             # <<<<<<<<<<<<<<
 *                 has_quoting = True
 *                 item_ptr[0] = ptr[0]
 */
        __pyx_v_ptr = (__pyx_v_ptr + 1);

        /* "asyncpg/protocol/codecs/array.pyx":568
 *                 # Quoted character, collapse the backslash.
 *                 ptr += 1
 *                 has_quoting = True             # <<<<<<<<<<<<<<
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1
 */
        __pyx_v_has_quoting = 1;

        /* "asyncpg/protocol/codecs/array.pyx":569
 *                 ptr += 1
 *                 has_quoting = True
 *                 item_ptr[0] = ptr[0]             # <<<<<<<<<<<<<<
 *                 item_ptr += 1
 *                 strip_spaces = False
 */
        (__pyx_v_item_ptr[0]) = (__pyx_v_ptr[0]);

        /* "asyncpg/protocol/codecs/array.pyx":570
 *                 has_quoting = True
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1             # <<<<<<<<<<<<<<
 *                 strip_spaces = False
 *                 item_end = item_ptr
 */
        __pyx_v_item_ptr = (__pyx_v_item_ptr + 1);

        /* "asyncpg/protocol/codecs/array.pyx":571
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1
 *                 strip_spaces = False             # <<<<<<<<<<<<<<
 *                 item_end = item_ptr
 * 
 */
        __pyx_v_strip_spaces = 0;

        /* "asyncpg/protocol/codecs/array.pyx":572
 *                 item_ptr += 1
 *                 strip_spaces = False
 *                 item_end = item_ptr             # <<<<<<<<<<<<<<
 * 
 *             elif in_quotes:
 */
        __pyx_v_item_end = __pyx_v_item_ptr;

        /* "asyncpg/protocol/codecs/array.pyx":565
 *                 has_quoting = True
 * 
 *             elif ptr[0] == '\\':             # <<<<<<<<<<<<<<
 *                 # Quoted character, collapse the backslash.
 *                 ptr += 1
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":574
 *                 item_end = item_ptr
 * 
 *             elif in_quotes:             # <<<<<<<<<<<<<<
 *                 # Consume the string until we see the closing quote.
 *                 item_ptr[0] = ptr[0]
 */
      __pyx_t_1 = (__pyx_v_in_quotes != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":576
 *             elif in_quotes:
 *                 # Consume the string until we see the closing quote.
 *                 item_ptr[0] = ptr[0]             # <<<<<<<<<<<<<<
 *                 item_ptr += 1
 * 
 */
        (__pyx_v_item_ptr[0]) = (__pyx_v_ptr[0]);

        /* "asyncpg/protocol/codecs/array.pyx":577
 *                 # Consume the string until we see the closing quote.
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '{':
 */
        __pyx_v_item_ptr = (__pyx_v_item_ptr + 1);

        /* "asyncpg/protocol/codecs/array.pyx":574
 *                 item_end = item_ptr
 * 
 *             elif in_quotes:             # <<<<<<<<<<<<<<
 *                 # Consume the string until we see the closing quote.
 *                 item_ptr[0] = ptr[0]
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":579
 *                 item_ptr += 1
 * 
 *             elif ptr[0] == '{':             # <<<<<<<<<<<<<<
 *                 # Nesting level increase.
 *                 nest_level += 1
 */
      __pyx_t_1 = (((__pyx_v_ptr[0]) == 0x7B) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":581
 *             elif ptr[0] == '{':
 *                 # Nesting level increase.
 *                 nest_level += 1             # <<<<<<<<<<<<<<
 * 
 *                 indexes[nest_level - 1] = 0
 */
        __pyx_v_nest_level = (__pyx_v_nest_level + 1);

        /* "asyncpg/protocol/codecs/array.pyx":583
 *                 nest_level += 1
 * 
 *                 indexes[nest_level - 1] = 0             # <<<<<<<<<<<<<<
 *                 new_stride = cpython.PyList_New(dims[nest_level - 1])
 *                 strides[nest_level - 1] = \
 */
        (__pyx_v_indexes[(__pyx_v_nest_level - 1)]) = 0;

        /* "asyncpg/protocol/codecs/array.pyx":584
 * 
 *                 indexes[nest_level - 1] = 0
 *                 new_stride = cpython.PyList_New(dims[nest_level - 1])             # <<<<<<<<<<<<<<
 *                 strides[nest_level - 1] = \
 *                     <void*>(<cpython.PyObject>new_stride)
 */
        __pyx_t_3 = PyList_New((__pyx_v_dims[(__pyx_v_nest_level - 1)])); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_new_stride, ((PyObject*)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "asyncpg/protocol/codecs/array.pyx":585
 *                 indexes[nest_level - 1] = 0
 *                 new_stride = cpython.PyList_New(dims[nest_level - 1])
 *                 strides[nest_level - 1] = \             # <<<<<<<<<<<<<<
 *                     <void*>(<cpython.PyObject>new_stride)
 * 
 */
        (__pyx_v_strides[(__pyx_v_nest_level - 1)]) = ((void *)__pyx_v_new_stride);

        /* "asyncpg/protocol/codecs/array.pyx":588
 *                     <void*>(<cpython.PyObject>new_stride)
 * 
 *                 if nest_level > 1:             # <<<<<<<<<<<<<<
 *                     cpython.Py_INCREF(new_stride)
 *                     cpython.PyList_SET_ITEM(
 */
        __pyx_t_1 = ((__pyx_v_nest_level > 1) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":589
 * 
 *                 if nest_level > 1:
 *                     cpython.Py_INCREF(new_stride)             # <<<<<<<<<<<<<<
 *                     cpython.PyList_SET_ITEM(
 *                         <object><cpython.PyObject*>strides[nest_level - 2],
 */
          Py_INCREF(__pyx_v_new_stride);

          /* "asyncpg/protocol/codecs/array.pyx":591
 *                     cpython.Py_INCREF(new_stride)
 *                     cpython.PyList_SET_ITEM(
 *                         <object><cpython.PyObject*>strides[nest_level - 2],             # <<<<<<<<<<<<<<
 *                         indexes[nest_level - 2],
 *                         new_stride)
 */
          __pyx_t_10 = ((PyObject *)(__pyx_v_strides[(__pyx_v_nest_level - 2)]));

          /* "asyncpg/protocol/codecs/array.pyx":590
 *                 if nest_level > 1:
 *                     cpython.Py_INCREF(new_stride)
 *                     cpython.PyList_SET_ITEM(             # <<<<<<<<<<<<<<
 *                         <object><cpython.PyObject*>strides[nest_level - 2],
 *                         indexes[nest_level - 2],
 */
          PyList_SET_ITEM(((PyObject *)__pyx_t_10), (__pyx_v_indexes[(__pyx_v_nest_level - 2)]), __pyx_v_new_stride);

          /* "asyncpg/protocol/codecs/array.pyx":588
 *                     <void*>(<cpython.PyObject>new_stride)
 * 
 *                 if nest_level > 1:             # <<<<<<<<<<<<<<
 *                     cpython.Py_INCREF(new_stride)
 *                     cpython.PyList_SET_ITEM(
 */
          goto __pyx_L27;
        }

        /* "asyncpg/protocol/codecs/array.pyx":595
 *                         new_stride)
 *                 else:
 *                     result = new_stride             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '}':
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_v_new_stride);
          __Pyx_XDECREF_SET(__pyx_v_result, __pyx_v_new_stride);
        }
        __pyx_L27:;

        /* "asyncpg/protocol/codecs/array.pyx":579
 *                 item_ptr += 1
 * 
 *             elif ptr[0] == '{':             # <<<<<<<<<<<<<<
 *                 # Nesting level increase.
 *                 nest_level += 1
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":597
 *                     result = new_stride
 * 
 *             elif ptr[0] == '}':             # <<<<<<<<<<<<<<
 *                 if item_level == 0:
 *                     # Make sure we keep track of which nesting
 */
      __pyx_t_1 = (((__pyx_v_ptr[0]) == 0x7D) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":598
 * 
 *             elif ptr[0] == '}':
 *                 if item_level == 0:             # <<<<<<<<<<<<<<
 *                     # Make sure we keep track of which nesting
 *                     # level the item belongs to, as the loop
 */
        __pyx_t_1 = ((__pyx_v_item_level == 0) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":603
 *                     # will continue to consume closing braces
 *                     # until the delimiter or the end of input.
 *                     item_level = nest_level             # <<<<<<<<<<<<<<
 * 
 *                 nest_level -= 1
 */
          __pyx_v_item_level = __pyx_v_nest_level;

          /* "asyncpg/protocol/codecs/array.pyx":598
 * 
 *             elif ptr[0] == '}':
 *                 if item_level == 0:             # <<<<<<<<<<<<<<
 *                     # Make sure we keep track of which nesting
 *                     # level the item belongs to, as the loop
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":605
 *                     item_level = nest_level
 * 
 *                 nest_level -= 1             # <<<<<<<<<<<<<<
 * 
 *                 if nest_level == 0:
 */
        __pyx_v_nest_level = (__pyx_v_nest_level - 1);

        /* "asyncpg/protocol/codecs/array.pyx":607
 *                 nest_level -= 1
 * 
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     end_of_array = end_of_item = True
 * 
 */
        __pyx_t_1 = ((__pyx_v_nest_level == 0) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":608
 * 
 *                 if nest_level == 0:
 *                     end_of_array = end_of_item = True             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == typdelim:
 */
          __pyx_v_end_of_array = 1;
          __pyx_v_end_of_item = 1;

          /* "asyncpg/protocol/codecs/array.pyx":607
 *                 nest_level -= 1
 * 
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     end_of_array = end_of_item = True
 * 
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":597
 *                     result = new_stride
 * 
 *             elif ptr[0] == '}':             # <<<<<<<<<<<<<<
 *                 if item_level == 0:
 *                     # Make sure we keep track of which nesting
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":610
 *                     end_of_array = end_of_item = True
 * 
 *             elif ptr[0] == typdelim:             # <<<<<<<<<<<<<<
 *                 # Array element delimiter,
 *                 end_of_item = True
 */
      __pyx_t_1 = (((__pyx_v_ptr[0]) == __pyx_v_typdelim) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":612
 *             elif ptr[0] == typdelim:
 *                 # Array element delimiter,
 *                 end_of_item = True             # <<<<<<<<<<<<<<
 *                 if item_level == 0:
 *                     item_level = nest_level
 */
        __pyx_v_end_of_item = 1;

        /* "asyncpg/protocol/codecs/array.pyx":613
 *                 # Array element delimiter,
 *                 end_of_item = True
 *                 if item_level == 0:             # <<<<<<<<<<<<<<
 *                     item_level = nest_level
 * 
 */
        __pyx_t_1 = ((__pyx_v_item_level == 0) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":614
 *                 end_of_item = True
 *                 if item_level == 0:
 *                     item_level = nest_level             # <<<<<<<<<<<<<<
 * 
 *             elif apg_ascii_isspace(ptr[0]):
 */
          __pyx_v_item_level = __pyx_v_nest_level;

          /* "asyncpg/protocol/codecs/array.pyx":613
 *                 # Array element delimiter,
 *                 end_of_item = True
 *                 if item_level == 0:             # <<<<<<<<<<<<<<
 *                     item_level = nest_level
 * 
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":610
 *                     end_of_array = end_of_item = True
 * 
 *             elif ptr[0] == typdelim:             # <<<<<<<<<<<<<<
 *                 # Array element delimiter,
 *                 end_of_item = True
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":616
 *                     item_level = nest_level
 * 
 *             elif apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *                 if not strip_spaces:
 *                     item_ptr[0] = ptr[0]
 */
      __pyx_t_1 = (__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace((__pyx_v_ptr[0])) != 0);
      if (__pyx_t_1) {

        /* "asyncpg/protocol/codecs/array.pyx":617
 * 
 *             elif apg_ascii_isspace(ptr[0]):
 *                 if not strip_spaces:             # <<<<<<<<<<<<<<
 *                     item_ptr[0] = ptr[0]
 *                     item_ptr += 1
 */
        __pyx_t_1 = ((!(__pyx_v_strip_spaces != 0)) != 0);
        if (__pyx_t_1) {

          /* "asyncpg/protocol/codecs/array.pyx":618
 *             elif apg_ascii_isspace(ptr[0]):
 *                 if not strip_spaces:
 *                     item_ptr[0] = ptr[0]             # <<<<<<<<<<<<<<
 *                     item_ptr += 1
 *                 # Ignore the leading literal whitespace.
 */
          (__pyx_v_item_ptr[0]) = (__pyx_v_ptr[0]);

          /* "asyncpg/protocol/codecs/array.pyx":619
 *                 if not strip_spaces:
 *                     item_ptr[0] = ptr[0]
 *                     item_ptr += 1             # <<<<<<<<<<<<<<
 *                 # Ignore the leading literal whitespace.
 * 
 */
          __pyx_v_item_ptr = (__pyx_v_item_ptr + 1);

          /* "asyncpg/protocol/codecs/array.pyx":617
 * 
 *             elif apg_ascii_isspace(ptr[0]):
 *                 if not strip_spaces:             # <<<<<<<<<<<<<<
 *                     item_ptr[0] = ptr[0]
 *                     item_ptr += 1
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":616
 *                     item_level = nest_level
 * 
 *             elif apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *                 if not strip_spaces:
 *                     item_ptr[0] = ptr[0]
 */
        goto __pyx_L25;
      }

      /* "asyncpg/protocol/codecs/array.pyx":623
 * 
 *             else:
 *                 item_ptr[0] = ptr[0]             # <<<<<<<<<<<<<<
 *                 item_ptr += 1
 *                 strip_spaces = False
 */
      /*else*/ {
        (__pyx_v_item_ptr[0]) = (__pyx_v_ptr[0]);

        /* "asyncpg/protocol/codecs/array.pyx":624
 *             else:
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1             # <<<<<<<<<<<<<<
 *                 strip_spaces = False
 *                 item_end = item_ptr
 */
        __pyx_v_item_ptr = (__pyx_v_item_ptr + 1);

        /* "asyncpg/protocol/codecs/array.pyx":625
 *                 item_ptr[0] = ptr[0]
 *                 item_ptr += 1
 *                 strip_spaces = False             # <<<<<<<<<<<<<<
 *                 item_end = item_ptr
 * 
 */
        __pyx_v_strip_spaces = 0;

        /* "asyncpg/protocol/codecs/array.pyx":626
 *                 item_ptr += 1
 *                 strip_spaces = False
 *                 item_end = item_ptr             # <<<<<<<<<<<<<<
 * 
 *             ptr += 1
 */
        __pyx_v_item_end = __pyx_v_item_ptr;
      }
      __pyx_L25:;

      /* "asyncpg/protocol/codecs/array.pyx":628
 *                 item_end = item_ptr
 * 
 *             ptr += 1             # <<<<<<<<<<<<<<
 * 
 *         # end while not end_of_item
 */
      __pyx_v_ptr = (__pyx_v_ptr + 1);
    }

    /* "asyncpg/protocol/codecs/array.pyx":632
 *         # end while not end_of_item
 * 
 *         if item_end == item_start:             # <<<<<<<<<<<<<<
 *             # Empty array
 *             continue
 */
    __pyx_t_1 = ((__pyx_v_item_end == __pyx_v_item_start) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/array.pyx":634
 *         if item_end == item_start:
 *             # Empty array
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         item_end[0] = '\0'
 */
      goto __pyx_L21_continue;

      /* "asyncpg/protocol/codecs/array.pyx":632
 *         # end while not end_of_item
 * 
 *         if item_end == item_start:             # <<<<<<<<<<<<<<
 *             # Empty array
 *             continue
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":636
 *             continue
 * 
 *         item_end[0] = '\0'             # <<<<<<<<<<<<<<
 * 
 *         if not has_quoting and apg_strcasecmp(item_start, APG_NULL) == 0:
 */
    (__pyx_v_item_end[0]) = 0;

    /* "asyncpg/protocol/codecs/array.pyx":638
 *         item_end[0] = '\0'
 * 
 *         if not has_quoting and apg_strcasecmp(item_start, APG_NULL) == 0:             # <<<<<<<<<<<<<<
 *             # NULL element.
 *             item = None
 */
    __pyx_t_11 = ((!(__pyx_v_has_quoting != 0)) != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L34_bool_binop_done;
    }
    __pyx_t_11 = ((__pyx_f_7asyncpg_8protocol_8protocol_apg_strcasecmp(__pyx_v_item_start, __pyx_v_7asyncpg_8protocol_8protocol_APG_NULL) == 0) != 0);
    __pyx_t_1 = __pyx_t_11;
    __pyx_L34_bool_binop_done:;
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/array.pyx":640
 *         if not has_quoting and apg_strcasecmp(item_start, APG_NULL) == 0:
 *             # NULL element.
 *             item = None             # <<<<<<<<<<<<<<
 *         else:
 *             # XXX: find a way to avoid the redundant encode/decode
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_item, Py_None);

      /* "asyncpg/protocol/codecs/array.pyx":638
 *         item_end[0] = '\0'
 * 
 *         if not has_quoting and apg_strcasecmp(item_start, APG_NULL) == 0:             # <<<<<<<<<<<<<<
 *             # NULL element.
 *             item = None
 */
      goto __pyx_L33;
    }

    /* "asyncpg/protocol/codecs/array.pyx":644
 *             # XXX: find a way to avoid the redundant encode/decode
 *             # cycle here.
 *             item_text = cpythonx.PyUnicode_FromKindAndData(             # <<<<<<<<<<<<<<
 *                 cpythonx.PyUnicode_4BYTE_KIND,
 *                 <void *>item_start,
 */
    /*else*/ {

      /* "asyncpg/protocol/codecs/array.pyx":647
 *                 cpythonx.PyUnicode_4BYTE_KIND,
 *                 <void *>item_start,
 *                 item_end - item_start)             # <<<<<<<<<<<<<<
 * 
 *             # Prepare the element buffer and call the text decoder
 */
      __pyx_t_3 = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ((void *)__pyx_v_item_start), (__pyx_v_item_end - __pyx_v_item_start)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "asyncpg/protocol/codecs/array.pyx":644
 *             # XXX: find a way to avoid the redundant encode/decode
 *             # cycle here.
 *             item_text = cpythonx.PyUnicode_FromKindAndData(             # <<<<<<<<<<<<<<
 *                 cpythonx.PyUnicode_4BYTE_KIND,
 *                 <void *>item_start,
 */
      if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(5, 644, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_item_text, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":651
 *             # Prepare the element buffer and call the text decoder
 *             # for the element type.
 *             pgproto.as_pg_string_and_size(             # <<<<<<<<<<<<<<
 *                 settings, item_text, &pg_item_str, &pg_item_len)
 *             frb_init(&item_buf, pg_item_str, pg_item_len)
 */
      __pyx_t_3 = __pyx_f_7asyncpg_7pgproto_7pgproto_as_pg_string_and_size(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_item_text, (&__pyx_v_pg_item_str), (&__pyx_v_pg_item_len)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/codecs/array.pyx":653
 *             pgproto.as_pg_string_and_size(
 *                 settings, item_text, &pg_item_str, &pg_item_len)
 *             frb_init(&item_buf, pg_item_str, pg_item_len)             # <<<<<<<<<<<<<<
 *             item = decoder(settings, &item_buf, decoder_arg)
 * 
 */
      __pyx_f_7asyncpg_7pgproto_7pgproto_frb_init((&__pyx_v_item_buf), __pyx_v_pg_item_str, __pyx_v_pg_item_len);

      /* "asyncpg/protocol/codecs/array.pyx":654
 *                 settings, item_text, &pg_item_str, &pg_item_len)
 *             frb_init(&item_buf, pg_item_str, pg_item_len)
 *             item = decoder(settings, &item_buf, decoder_arg)             # <<<<<<<<<<<<<<
 * 
 *         # Place the decoded element in the array.
 */
      __pyx_t_3 = __pyx_v_decoder(__pyx_v_settings, (&__pyx_v_item_buf), __pyx_v_decoder_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 654, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L33:;

    /* "asyncpg/protocol/codecs/array.pyx":657
 * 
 *         # Place the decoded element in the array.
 *         cpython.Py_INCREF(item)             # <<<<<<<<<<<<<<
 *         cpython.PyList_SET_ITEM(
 *             <object><cpython.PyObject*>strides[item_level - 1],
 */
    Py_INCREF(__pyx_v_item);

    /* "asyncpg/protocol/codecs/array.pyx":659
 *         cpython.Py_INCREF(item)
 *         cpython.PyList_SET_ITEM(
 *             <object><cpython.PyObject*>strides[item_level - 1],             # <<<<<<<<<<<<<<
 *             indexes[item_level - 1],
 *             item)
 */
    __pyx_t_10 = ((PyObject *)(__pyx_v_strides[(__pyx_v_item_level - 1)]));

    /* "asyncpg/protocol/codecs/array.pyx":658
 *         # Place the decoded element in the array.
 *         cpython.Py_INCREF(item)
 *         cpython.PyList_SET_ITEM(             # <<<<<<<<<<<<<<
 *             <object><cpython.PyObject*>strides[item_level - 1],
 *             indexes[item_level - 1],
 */
    PyList_SET_ITEM(((PyObject *)__pyx_t_10), (__pyx_v_indexes[(__pyx_v_item_level - 1)]), __pyx_v_item);

    /* "asyncpg/protocol/codecs/array.pyx":663
 *             item)
 * 
 *         if nest_level > 0:             # <<<<<<<<<<<<<<
 *             indexes[nest_level - 1] += 1
 * 
 */
    __pyx_t_1 = ((__pyx_v_nest_level > 0) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/codecs/array.pyx":664
 * 
 *         if nest_level > 0:
 *             indexes[nest_level - 1] += 1             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_12 = (__pyx_v_nest_level - 1);
      (__pyx_v_indexes[__pyx_t_12]) = ((__pyx_v_indexes[__pyx_t_12]) + 1);

      /* "asyncpg/protocol/codecs/array.pyx":663
 *             item)
 * 
 *         if nest_level > 0:             # <<<<<<<<<<<<<<
 *             indexes[nest_level - 1] += 1
 * 
 */
    }
    __pyx_L21_continue:;
  }

  /* "asyncpg/protocol/codecs/array.pyx":666
 *             indexes[nest_level - 1] += 1
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_result)) { __Pyx_RaiseUnboundLocalError("result"); __PYX_ERR(5, 666, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":435
 * 
 * 
 * cdef _textarray_decode(ConnectionSettings settings,             # <<<<<<<<<<<<<<
 *                        Py_UCS4 *array_text,
 *                        decode_func_ex decoder,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._textarray_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_new_stride);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_item_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":678
 * 
 * 
 * cdef _UnexpectedCharacter(const Py_UCS4 *array_text, const Py_UCS4 *ptr):             # <<<<<<<<<<<<<<
 *     return ValueError('unexpected character {!r} at position {}'.format(
 *         cpython.PyUnicode_FromOrdinal(<int>ptr[0]), ptr - array_text + 1))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(Py_UCS4 const *__pyx_v_array_text, Py_UCS4 const *__pyx_v_ptr) {
  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("_UnexpectedCharacter", 0);

  /* "asyncpg/protocol/codecs/array.pyx":679
 * 
 * cdef _UnexpectedCharacter(const Py_UCS4 *array_text, const Py_UCS4 *ptr):
 *     return ValueError('unexpected character {!r} at position {}'.format(             # <<<<<<<<<<<<<<
 *         cpython.PyUnicode_FromOrdinal(<int>ptr[0]), ptr - array_text + 1))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_character_r_at_positi, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asyncpg/protocol/codecs/array.pyx":680
 * cdef _UnexpectedCharacter(const Py_UCS4 *array_text, const Py_UCS4 *ptr):
 *     return ValueError('unexpected character {!r} at position {}'.format(
 *         cpython.PyUnicode_FromOrdinal(<int>ptr[0]), ptr - array_text + 1))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyUnicode_FromOrdinal(((int)(__pyx_v_ptr[0]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_ptrdiff_t(((__pyx_v_ptr - __pyx_v_array_text) + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 679, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 679, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":679
 * 
 * cdef _UnexpectedCharacter(const Py_UCS4 *array_text, const Py_UCS4 *ptr):
 *     return ValueError('unexpected character {!r} at position {}'.format(             # <<<<<<<<<<<<<<
 *         cpython.PyUnicode_FromOrdinal(<int>ptr[0]), ptr - array_text + 1))
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":678
 * 
 * 
 * cdef _UnexpectedCharacter(const Py_UCS4 *array_text, const Py_UCS4 *ptr):             # <<<<<<<<<<<<<<
 *     return ValueError('unexpected character {!r} at position {}'.format(
 *         cpython.PyUnicode_FromOrdinal(<int>ptr[0]), ptr - array_text + 1))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._UnexpectedCharacter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":683
 * 
 * 
 * cdef _infer_array_dims(const Py_UCS4 *array_text,             # <<<<<<<<<<<<<<
 *                        Py_UCS4 typdelim,
 *                        int32_t *dims,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__infer_array_dims(Py_UCS4 const *__pyx_v_array_text, Py_UCS4 __pyx_v_typdelim, int32_t *__pyx_v_dims, int32_t *__pyx_v_ndims) {
  Py_UCS4 const *__pyx_v_ptr;
  int __pyx_v_i;
  int __pyx_v_nest_level;
  int __pyx_v_end_of_array;
  int __pyx_v_end_of_item;
  int __pyx_v_in_quotes;
  int __pyx_v_array_is_empty;
  int __pyx_v_stride_len[6];
  int __pyx_v_prev_stride_len[6];
  enum __pyx_t_7asyncpg_8protocol_8protocol__ArrayParseState __pyx_v_parse_state;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  long __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_infer_array_dims", 0);

  /* "asyncpg/protocol/codecs/array.pyx":688
 *                        int32_t *ndims):
 *     cdef:
 *         const Py_UCS4 *ptr = array_text             # <<<<<<<<<<<<<<
 *         int i
 *         int nest_level = 0
 */
  __pyx_v_ptr = __pyx_v_array_text;

  /* "asyncpg/protocol/codecs/array.pyx":690
 *         const Py_UCS4 *ptr = array_text
 *         int i
 *         int nest_level = 0             # <<<<<<<<<<<<<<
 *         bint end_of_array = False
 *         bint end_of_item = False
 */
  __pyx_v_nest_level = 0;

  /* "asyncpg/protocol/codecs/array.pyx":691
 *         int i
 *         int nest_level = 0
 *         bint end_of_array = False             # <<<<<<<<<<<<<<
 *         bint end_of_item = False
 *         bint in_quotes = False
 */
  __pyx_v_end_of_array = 0;

  /* "asyncpg/protocol/codecs/array.pyx":692
 *         int nest_level = 0
 *         bint end_of_array = False
 *         bint end_of_item = False             # <<<<<<<<<<<<<<
 *         bint in_quotes = False
 *         bint array_is_empty = True
 */
  __pyx_v_end_of_item = 0;

  /* "asyncpg/protocol/codecs/array.pyx":693
 *         bint end_of_array = False
 *         bint end_of_item = False
 *         bint in_quotes = False             # <<<<<<<<<<<<<<
 *         bint array_is_empty = True
 *         int stride_len[ARRAY_MAXDIM]
 */
  __pyx_v_in_quotes = 0;

  /* "asyncpg/protocol/codecs/array.pyx":694
 *         bint end_of_item = False
 *         bint in_quotes = False
 *         bint array_is_empty = True             # <<<<<<<<<<<<<<
 *         int stride_len[ARRAY_MAXDIM]
 *         int prev_stride_len[ARRAY_MAXDIM]
 */
  __pyx_v_array_is_empty = 1;

  /* "asyncpg/protocol/codecs/array.pyx":697
 *         int stride_len[ARRAY_MAXDIM]
 *         int prev_stride_len[ARRAY_MAXDIM]
 *         _ArrayParseState parse_state = APS_START             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ARRAY_MAXDIM):
 */
  __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_START;

  /* "asyncpg/protocol/codecs/array.pyx":699
 *         _ArrayParseState parse_state = APS_START
 * 
 *     for i in range(ARRAY_MAXDIM):             # <<<<<<<<<<<<<<
 *         dims[i] = prev_stride_len[i] = 0
 *         stride_len[i] = 1
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "asyncpg/protocol/codecs/array.pyx":700
 * 
 *     for i in range(ARRAY_MAXDIM):
 *         dims[i] = prev_stride_len[i] = 0             # <<<<<<<<<<<<<<
 *         stride_len[i] = 1
 * 
 */
    (__pyx_v_dims[__pyx_v_i]) = 0;
    (__pyx_v_prev_stride_len[__pyx_v_i]) = 0;

    /* "asyncpg/protocol/codecs/array.pyx":701
 *     for i in range(ARRAY_MAXDIM):
 *         dims[i] = prev_stride_len[i] = 0
 *         stride_len[i] = 1             # <<<<<<<<<<<<<<
 * 
 *     while not end_of_array:
 */
    (__pyx_v_stride_len[__pyx_v_i]) = 1;
  }

  /* "asyncpg/protocol/codecs/array.pyx":703
 *         stride_len[i] = 1
 * 
 *     while not end_of_array:             # <<<<<<<<<<<<<<
 *         end_of_item = False
 * 
 */
  while (1) {
    __pyx_t_2 = ((!(__pyx_v_end_of_array != 0)) != 0);
    if (!__pyx_t_2) break;

    /* "asyncpg/protocol/codecs/array.pyx":704
 * 
 *     while not end_of_array:
 *         end_of_item = False             # <<<<<<<<<<<<<<
 * 
 *         while not end_of_item:
 */
    __pyx_v_end_of_item = 0;

    /* "asyncpg/protocol/codecs/array.pyx":706
 *         end_of_item = False
 * 
 *         while not end_of_item:             # <<<<<<<<<<<<<<
 *             if ptr[0] == '\0':
 *                 raise ValueError('unexpected end of string')
 */
    while (1) {
      __pyx_t_2 = ((!(__pyx_v_end_of_item != 0)) != 0);
      if (!__pyx_t_2) break;

      /* "asyncpg/protocol/codecs/array.pyx":707
 * 
 *         while not end_of_item:
 *             if ptr[0] == '\0':             # <<<<<<<<<<<<<<
 *                 raise ValueError('unexpected end of string')
 * 
 */
      __pyx_t_2 = (((__pyx_v_ptr[0]) == 0) != 0);
      if (unlikely(__pyx_t_2)) {

        /* "asyncpg/protocol/codecs/array.pyx":708
 *         while not end_of_item:
 *             if ptr[0] == '\0':
 *                 raise ValueError('unexpected end of string')             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '"':
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 708, __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(5, 708, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/array.pyx":707
 * 
 *         while not end_of_item:
 *             if ptr[0] == '\0':             # <<<<<<<<<<<<<<
 *                 raise ValueError('unexpected end of string')
 * 
 */
      }

      /* "asyncpg/protocol/codecs/array.pyx":710
 *                 raise ValueError('unexpected end of string')
 * 
 *             elif ptr[0] == '"':             # <<<<<<<<<<<<<<
 *                 if (parse_state not in (APS_STRIDE_STARTED,
 *                                         APS_ELEM_DELIMITED) and
 */
      __pyx_t_2 = (((__pyx_v_ptr[0]) == 34) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":711
 * 
 *             elif ptr[0] == '"':
 *                 if (parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_DELIMITED:

          /* "asyncpg/protocol/codecs/array.pyx":712
 *             elif ptr[0] == '"':
 *                 if (parse_state not in (APS_STRIDE_STARTED,
 *                                         APS_ELEM_DELIMITED) and             # <<<<<<<<<<<<<<
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
          __pyx_t_4 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":711
 * 
 *             elif ptr[0] == '"':
 *                 if (parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 */
          break;
          default:
          __pyx_t_4 = 1;
          break;
        }
        __pyx_t_5 = (__pyx_t_4 != 0);
        if (__pyx_t_5) {
        } else {
          __pyx_t_2 = __pyx_t_5;
          goto __pyx_L11_bool_binop_done;
        }

        /* "asyncpg/protocol/codecs/array.pyx":713
 *                 if (parse_state not in (APS_STRIDE_STARTED,
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        __pyx_t_4 = ((__pyx_v_parse_state == __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED) != 0);
        if (__pyx_t_4) {
        } else {
          __pyx_t_5 = __pyx_t_4;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_4 = (__pyx_v_in_quotes != 0);
        __pyx_t_5 = __pyx_t_4;
        __pyx_L13_bool_binop_done:;
        __pyx_t_4 = ((!__pyx_t_5) != 0);
        __pyx_t_2 = __pyx_t_4;
        __pyx_L11_bool_binop_done:;

        /* "asyncpg/protocol/codecs/array.pyx":711
 * 
 *             elif ptr[0] == '"':
 *                 if (parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 */
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":714
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 in_quotes = not in_quotes
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 714, __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(5, 714, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":711
 * 
 *             elif ptr[0] == '"':
 *                 if (parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                         APS_ELEM_DELIMITED) and
 *                         not (parse_state == APS_ELEM_STARTED and in_quotes)):
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":716
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 in_quotes = not in_quotes             # <<<<<<<<<<<<<<
 *                 if in_quotes:
 *                     parse_state = APS_ELEM_STARTED
 */
        __pyx_v_in_quotes = (!(__pyx_v_in_quotes != 0));

        /* "asyncpg/protocol/codecs/array.pyx":717
 * 
 *                 in_quotes = not in_quotes
 *                 if in_quotes:             # <<<<<<<<<<<<<<
 *                     parse_state = APS_ELEM_STARTED
 *                     array_is_empty = False
 */
        __pyx_t_2 = (__pyx_v_in_quotes != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/codecs/array.pyx":718
 *                 in_quotes = not in_quotes
 *                 if in_quotes:
 *                     parse_state = APS_ELEM_STARTED             # <<<<<<<<<<<<<<
 *                     array_is_empty = False
 * 
 */
          __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED;

          /* "asyncpg/protocol/codecs/array.pyx":719
 *                 if in_quotes:
 *                     parse_state = APS_ELEM_STARTED
 *                     array_is_empty = False             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '\\':
 */
          __pyx_v_array_is_empty = 0;

          /* "asyncpg/protocol/codecs/array.pyx":717
 * 
 *                 in_quotes = not in_quotes
 *                 if in_quotes:             # <<<<<<<<<<<<<<
 *                     parse_state = APS_ELEM_STARTED
 *                     array_is_empty = False
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":710
 *                 raise ValueError('unexpected end of string')
 * 
 *             elif ptr[0] == '"':             # <<<<<<<<<<<<<<
 *                 if (parse_state not in (APS_STRIDE_STARTED,
 *                                         APS_ELEM_DELIMITED) and
 */
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":721
 *                     array_is_empty = False
 * 
 *             elif ptr[0] == '\\':             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,
 */
      __pyx_t_2 = (((__pyx_v_ptr[0]) == 92) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":722
 * 
 *             elif ptr[0] == '\\':
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED:

          /* "asyncpg/protocol/codecs/array.pyx":723
 *             elif ptr[0] == '\\':
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_DELIMITED:

          /* "asyncpg/protocol/codecs/array.pyx":722
 * 
 *             elif ptr[0] == '\\':
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
          __pyx_t_2 = 0;
          break;
          default:
          __pyx_t_2 = 1;
          break;
        }
        __pyx_t_4 = (__pyx_t_2 != 0);
        if (unlikely(__pyx_t_4)) {

          /* "asyncpg/protocol/codecs/array.pyx":725
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 parse_state = APS_ELEM_STARTED
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 725, __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(5, 725, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":722
 * 
 *             elif ptr[0] == '\\':
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":727
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 parse_state = APS_ELEM_STARTED             # <<<<<<<<<<<<<<
 *                 array_is_empty = False
 * 
 */
        __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED;

        /* "asyncpg/protocol/codecs/array.pyx":728
 * 
 *                 parse_state = APS_ELEM_STARTED
 *                 array_is_empty = False             # <<<<<<<<<<<<<<
 * 
 *                 if ptr[1] != '\0':
 */
        __pyx_v_array_is_empty = 0;

        /* "asyncpg/protocol/codecs/array.pyx":730
 *                 array_is_empty = False
 * 
 *                 if ptr[1] != '\0':             # <<<<<<<<<<<<<<
 *                     ptr += 1
 *                 else:
 */
        __pyx_t_4 = (((__pyx_v_ptr[1]) != 0) != 0);
        if (likely(__pyx_t_4)) {

          /* "asyncpg/protocol/codecs/array.pyx":731
 * 
 *                 if ptr[1] != '\0':
 *                     ptr += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError('unexpected end of string')
 */
          __pyx_v_ptr = (__pyx_v_ptr + 1);

          /* "asyncpg/protocol/codecs/array.pyx":730
 *                 array_is_empty = False
 * 
 *                 if ptr[1] != '\0':             # <<<<<<<<<<<<<<
 *                     ptr += 1
 *                 else:
 */
          goto __pyx_L17;
        }

        /* "asyncpg/protocol/codecs/array.pyx":733
 *                     ptr += 1
 *                 else:
 *                     raise ValueError('unexpected end of string')             # <<<<<<<<<<<<<<
 * 
 *             elif in_quotes:
 */
        /*else*/ {
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 733, __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(5, 733, __pyx_L1_error)
        }
        __pyx_L17:;

        /* "asyncpg/protocol/codecs/array.pyx":721
 *                     array_is_empty = False
 * 
 *             elif ptr[0] == '\\':             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,
 */
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":735
 *                     raise ValueError('unexpected end of string')
 * 
 *             elif in_quotes:             # <<<<<<<<<<<<<<
 *                 # Ignore everything inside the quotes.
 *                 pass
 */
      __pyx_t_4 = (__pyx_v_in_quotes != 0);
      if (__pyx_t_4) {
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":739
 *                 pass
 * 
 *             elif ptr[0] == '{':             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_START,
 *                                        APS_STRIDE_STARTED,
 */
      __pyx_t_4 = (((__pyx_v_ptr[0]) == 0x7B) != 0);
      if (__pyx_t_4) {

        /* "asyncpg/protocol/codecs/array.pyx":740
 * 
 *             elif ptr[0] == '{':
 *                 if parse_state not in (APS_START,             # <<<<<<<<<<<<<<
 *                                        APS_STRIDE_STARTED,
 *                                        APS_STRIDE_DELIMITED):
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_START:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED:

          /* "asyncpg/protocol/codecs/array.pyx":741
 *             elif ptr[0] == '{':
 *                 if parse_state not in (APS_START,
 *                                        APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_STRIDE_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DELIMITED:

          /* "asyncpg/protocol/codecs/array.pyx":740
 * 
 *             elif ptr[0] == '{':
 *                 if parse_state not in (APS_START,             # <<<<<<<<<<<<<<
 *                                        APS_STRIDE_STARTED,
 *                                        APS_STRIDE_DELIMITED):
 */
          __pyx_t_4 = 0;
          break;
          default:
          __pyx_t_4 = 1;
          break;
        }
        __pyx_t_2 = (__pyx_t_4 != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":743
 *                                        APS_STRIDE_STARTED,
 *                                        APS_STRIDE_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 parse_state = APS_STRIDE_STARTED
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 743, __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(5, 743, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":740
 * 
 *             elif ptr[0] == '{':
 *                 if parse_state not in (APS_START,             # <<<<<<<<<<<<<<
 *                                        APS_STRIDE_STARTED,
 *                                        APS_STRIDE_DELIMITED):
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":745
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 parse_state = APS_STRIDE_STARTED             # <<<<<<<<<<<<<<
 *                 if nest_level >= ARRAY_MAXDIM:
 *                     raise ValueError(
 */
        __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED;

        /* "asyncpg/protocol/codecs/array.pyx":746
 * 
 *                 parse_state = APS_STRIDE_STARTED
 *                 if nest_level >= ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'number of array dimensions ({}) exceed the '
 */
        __pyx_t_2 = ((__pyx_v_nest_level >= 6) != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":749
 *                     raise ValueError(
 *                         'number of array dimensions ({}) exceed the '
 *                         'maximum expected ({})'.format(             # <<<<<<<<<<<<<<
 *                             nest_level, ARRAY_MAXDIM))
 * 
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_number_of_array_dimensions_excee, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 749, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);

          /* "asyncpg/protocol/codecs/array.pyx":750
 *                         'number of array dimensions ({}) exceed the '
 *                         'maximum expected ({})'.format(
 *                             nest_level, ARRAY_MAXDIM))             # <<<<<<<<<<<<<<
 * 
 *                 dims[nest_level] = 0
 */
          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nest_level); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 750, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = NULL;
          __pyx_t_1 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_1 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_int_6};
            __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 749, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_int_6};
            __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 749, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 749, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            if (__pyx_t_8) {
              __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_1, __pyx_t_7);
            __Pyx_INCREF(__pyx_int_6);
            __Pyx_GIVEREF(__pyx_int_6);
            PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_1, __pyx_int_6);
            __pyx_t_7 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 749, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":747
 *                 parse_state = APS_STRIDE_STARTED
 *                 if nest_level >= ARRAY_MAXDIM:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'number of array dimensions ({}) exceed the '
 *                         'maximum expected ({})'.format(
 */
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 747, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_Raise(__pyx_t_6, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __PYX_ERR(5, 747, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":746
 * 
 *                 parse_state = APS_STRIDE_STARTED
 *                 if nest_level >= ARRAY_MAXDIM:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'number of array dimensions ({}) exceed the '
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":752
 *                             nest_level, ARRAY_MAXDIM))
 * 
 *                 dims[nest_level] = 0             # <<<<<<<<<<<<<<
 *                 nest_level += 1
 *                 if ndims[0] < nest_level:
 */
        (__pyx_v_dims[__pyx_v_nest_level]) = 0;

        /* "asyncpg/protocol/codecs/array.pyx":753
 * 
 *                 dims[nest_level] = 0
 *                 nest_level += 1             # <<<<<<<<<<<<<<
 *                 if ndims[0] < nest_level:
 *                     ndims[0] = nest_level
 */
        __pyx_v_nest_level = (__pyx_v_nest_level + 1);

        /* "asyncpg/protocol/codecs/array.pyx":754
 *                 dims[nest_level] = 0
 *                 nest_level += 1
 *                 if ndims[0] < nest_level:             # <<<<<<<<<<<<<<
 *                     ndims[0] = nest_level
 * 
 */
        __pyx_t_2 = (((__pyx_v_ndims[0]) < __pyx_v_nest_level) != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/codecs/array.pyx":755
 *                 nest_level += 1
 *                 if ndims[0] < nest_level:
 *                     ndims[0] = nest_level             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '}':
 */
          (__pyx_v_ndims[0]) = __pyx_v_nest_level;

          /* "asyncpg/protocol/codecs/array.pyx":754
 *                 dims[nest_level] = 0
 *                 nest_level += 1
 *                 if ndims[0] < nest_level:             # <<<<<<<<<<<<<<
 *                     ndims[0] = nest_level
 * 
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":739
 *                 pass
 * 
 *             elif ptr[0] == '{':             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_START,
 *                                        APS_STRIDE_STARTED,
 */
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":757
 *                     ndims[0] = nest_level
 * 
 *             elif ptr[0] == '}':             # <<<<<<<<<<<<<<
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and
 *                         not (nest_level == 1 and
 */
      __pyx_t_2 = (((__pyx_v_ptr[0]) == 0x7D) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":758
 * 
 *             elif ptr[0] == '}':
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and             # <<<<<<<<<<<<<<
 *                         not (nest_level == 1 and
 *                              parse_state == APS_STRIDE_STARTED)):
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DONE:
          __pyx_t_4 = 0;
          break;
          default:
          __pyx_t_4 = 1;
          break;
        }
        __pyx_t_5 = (__pyx_t_4 != 0);
        if (__pyx_t_5) {
        } else {
          __pyx_t_2 = __pyx_t_5;
          goto __pyx_L22_bool_binop_done;
        }

        /* "asyncpg/protocol/codecs/array.pyx":759
 *             elif ptr[0] == '}':
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and
 *                         not (nest_level == 1 and             # <<<<<<<<<<<<<<
 *                              parse_state == APS_STRIDE_STARTED)):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
        __pyx_t_4 = ((__pyx_v_nest_level == 1) != 0);
        if (__pyx_t_4) {
        } else {
          __pyx_t_5 = __pyx_t_4;
          goto __pyx_L24_bool_binop_done;
        }

        /* "asyncpg/protocol/codecs/array.pyx":760
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and
 *                         not (nest_level == 1 and
 *                              parse_state == APS_STRIDE_STARTED)):             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        __pyx_t_4 = ((__pyx_v_parse_state == __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED) != 0);
        __pyx_t_5 = __pyx_t_4;
        __pyx_L24_bool_binop_done:;

        /* "asyncpg/protocol/codecs/array.pyx":759
 *             elif ptr[0] == '}':
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and
 *                         not (nest_level == 1 and             # <<<<<<<<<<<<<<
 *                              parse_state == APS_STRIDE_STARTED)):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
        __pyx_t_4 = ((!__pyx_t_5) != 0);
        __pyx_t_2 = __pyx_t_4;
        __pyx_L22_bool_binop_done:;

        /* "asyncpg/protocol/codecs/array.pyx":758
 * 
 *             elif ptr[0] == '}':
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and             # <<<<<<<<<<<<<<
 *                         not (nest_level == 1 and
 *                              parse_state == APS_STRIDE_STARTED)):
 */
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":761
 *                         not (nest_level == 1 and
 *                              parse_state == APS_STRIDE_STARTED)):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 parse_state = APS_STRIDE_DONE
 */
          __pyx_t_6 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 761, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_Raise(__pyx_t_6, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __PYX_ERR(5, 761, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":758
 * 
 *             elif ptr[0] == '}':
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and             # <<<<<<<<<<<<<<
 *                         not (nest_level == 1 and
 *                              parse_state == APS_STRIDE_STARTED)):
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":763
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 parse_state = APS_STRIDE_DONE             # <<<<<<<<<<<<<<
 * 
 *                 if nest_level == 0:
 */
        __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DONE;

        /* "asyncpg/protocol/codecs/array.pyx":765
 *                 parse_state = APS_STRIDE_DONE
 * 
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        __pyx_t_2 = ((__pyx_v_nest_level == 0) != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":766
 * 
 *                 if nest_level == 0:
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 nest_level -= 1
 */
          __pyx_t_6 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 766, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_Raise(__pyx_t_6, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __PYX_ERR(5, 766, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":765
 *                 parse_state = APS_STRIDE_DONE
 * 
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":768
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 nest_level -= 1             # <<<<<<<<<<<<<<
 * 
 *                 if (prev_stride_len[nest_level] != 0 and
 */
        __pyx_v_nest_level = (__pyx_v_nest_level - 1);

        /* "asyncpg/protocol/codecs/array.pyx":770
 *                 nest_level -= 1
 * 
 *                 if (prev_stride_len[nest_level] != 0 and             # <<<<<<<<<<<<<<
 *                         stride_len[nest_level] != prev_stride_len[nest_level]):
 *                     raise ValueError(
 */
        __pyx_t_4 = (((__pyx_v_prev_stride_len[__pyx_v_nest_level]) != 0) != 0);
        if (__pyx_t_4) {
        } else {
          __pyx_t_2 = __pyx_t_4;
          goto __pyx_L28_bool_binop_done;
        }

        /* "asyncpg/protocol/codecs/array.pyx":771
 * 
 *                 if (prev_stride_len[nest_level] != 0 and
 *                         stride_len[nest_level] != prev_stride_len[nest_level]):             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         'inconsistent sub-array dimensions'
 */
        __pyx_t_4 = (((__pyx_v_stride_len[__pyx_v_nest_level]) != (__pyx_v_prev_stride_len[__pyx_v_nest_level])) != 0);
        __pyx_t_2 = __pyx_t_4;
        __pyx_L28_bool_binop_done:;

        /* "asyncpg/protocol/codecs/array.pyx":770
 *                 nest_level -= 1
 * 
 *                 if (prev_stride_len[nest_level] != 0 and             # <<<<<<<<<<<<<<
 *                         stride_len[nest_level] != prev_stride_len[nest_level]):
 *                     raise ValueError(
 */
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":774
 *                     raise ValueError(
 *                         'inconsistent sub-array dimensions'
 *                         ' at position {}'.format(             # <<<<<<<<<<<<<<
 *                             ptr - array_text + 1))
 * 
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_inconsistent_sub_array_dimension, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 774, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);

          /* "asyncpg/protocol/codecs/array.pyx":775
 *                         'inconsistent sub-array dimensions'
 *                         ' at position {}'.format(
 *                             ptr - array_text + 1))             # <<<<<<<<<<<<<<
 * 
 *                 prev_stride_len[nest_level] = stride_len[nest_level]
 */
          __pyx_t_9 = __Pyx_PyInt_From_ptrdiff_t(((__pyx_v_ptr - __pyx_v_array_text) + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 775, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __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_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 774, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "asyncpg/protocol/codecs/array.pyx":772
 *                 if (prev_stride_len[nest_level] != 0 and
 *                         stride_len[nest_level] != prev_stride_len[nest_level]):
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         'inconsistent sub-array dimensions'
 *                         ' at position {}'.format(
 */
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 772, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(5, 772, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":770
 *                 nest_level -= 1
 * 
 *                 if (prev_stride_len[nest_level] != 0 and             # <<<<<<<<<<<<<<
 *                         stride_len[nest_level] != prev_stride_len[nest_level]):
 *                     raise ValueError(
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":777
 *                             ptr - array_text + 1))
 * 
 *                 prev_stride_len[nest_level] = stride_len[nest_level]             # <<<<<<<<<<<<<<
 *                 stride_len[nest_level] = 1
 *                 if nest_level == 0:
 */
        (__pyx_v_prev_stride_len[__pyx_v_nest_level]) = (__pyx_v_stride_len[__pyx_v_nest_level]);

        /* "asyncpg/protocol/codecs/array.pyx":778
 * 
 *                 prev_stride_len[nest_level] = stride_len[nest_level]
 *                 stride_len[nest_level] = 1             # <<<<<<<<<<<<<<
 *                 if nest_level == 0:
 *                     end_of_array = end_of_item = True
 */
        (__pyx_v_stride_len[__pyx_v_nest_level]) = 1;

        /* "asyncpg/protocol/codecs/array.pyx":779
 *                 prev_stride_len[nest_level] = stride_len[nest_level]
 *                 stride_len[nest_level] = 1
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     end_of_array = end_of_item = True
 *                 else:
 */
        __pyx_t_2 = ((__pyx_v_nest_level == 0) != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/codecs/array.pyx":780
 *                 stride_len[nest_level] = 1
 *                 if nest_level == 0:
 *                     end_of_array = end_of_item = True             # <<<<<<<<<<<<<<
 *                 else:
 *                     dims[nest_level - 1] += 1
 */
          __pyx_v_end_of_array = 1;
          __pyx_v_end_of_item = 1;

          /* "asyncpg/protocol/codecs/array.pyx":779
 *                 prev_stride_len[nest_level] = stride_len[nest_level]
 *                 stride_len[nest_level] = 1
 *                 if nest_level == 0:             # <<<<<<<<<<<<<<
 *                     end_of_array = end_of_item = True
 *                 else:
 */
          goto __pyx_L30;
        }

        /* "asyncpg/protocol/codecs/array.pyx":782
 *                     end_of_array = end_of_item = True
 *                 else:
 *                     dims[nest_level - 1] += 1             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == typdelim:
 */
        /*else*/ {
          __pyx_t_10 = (__pyx_v_nest_level - 1);
          (__pyx_v_dims[__pyx_t_10]) = ((__pyx_v_dims[__pyx_t_10]) + 1);
        }
        __pyx_L30:;

        /* "asyncpg/protocol/codecs/array.pyx":757
 *                     ndims[0] = nest_level
 * 
 *             elif ptr[0] == '}':             # <<<<<<<<<<<<<<
 *                 if (parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE) and
 *                         not (nest_level == 1 and
 */
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":784
 *                     dims[nest_level - 1] += 1
 * 
 *             elif ptr[0] == typdelim:             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
      __pyx_t_2 = (((__pyx_v_ptr[0]) == __pyx_v_typdelim) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":785
 * 
 *             elif ptr[0] == typdelim:
 *                 if parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE):             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DONE:
          __pyx_t_2 = 0;
          break;
          default:
          __pyx_t_2 = 1;
          break;
        }
        __pyx_t_4 = (__pyx_t_2 != 0);
        if (unlikely(__pyx_t_4)) {

          /* "asyncpg/protocol/codecs/array.pyx":786
 *             elif ptr[0] == typdelim:
 *                 if parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 if parse_state == APS_STRIDE_DONE:
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 786, __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(5, 786, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":785
 * 
 *             elif ptr[0] == typdelim:
 *                 if parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE):             # <<<<<<<<<<<<<<
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":788
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 if parse_state == APS_STRIDE_DONE:             # <<<<<<<<<<<<<<
 *                     parse_state = APS_STRIDE_DELIMITED
 *                 else:
 */
        __pyx_t_4 = ((__pyx_v_parse_state == __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DONE) != 0);
        if (__pyx_t_4) {

          /* "asyncpg/protocol/codecs/array.pyx":789
 * 
 *                 if parse_state == APS_STRIDE_DONE:
 *                     parse_state = APS_STRIDE_DELIMITED             # <<<<<<<<<<<<<<
 *                 else:
 *                     parse_state = APS_ELEM_DELIMITED
 */
          __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_DELIMITED;

          /* "asyncpg/protocol/codecs/array.pyx":788
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 if parse_state == APS_STRIDE_DONE:             # <<<<<<<<<<<<<<
 *                     parse_state = APS_STRIDE_DELIMITED
 *                 else:
 */
          goto __pyx_L32;
        }

        /* "asyncpg/protocol/codecs/array.pyx":791
 *                     parse_state = APS_STRIDE_DELIMITED
 *                 else:
 *                     parse_state = APS_ELEM_DELIMITED             # <<<<<<<<<<<<<<
 *                 end_of_item = True
 *                 stride_len[nest_level - 1] += 1
 */
        /*else*/ {
          __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_DELIMITED;
        }
        __pyx_L32:;

        /* "asyncpg/protocol/codecs/array.pyx":792
 *                 else:
 *                     parse_state = APS_ELEM_DELIMITED
 *                 end_of_item = True             # <<<<<<<<<<<<<<
 *                 stride_len[nest_level - 1] += 1
 * 
 */
        __pyx_v_end_of_item = 1;

        /* "asyncpg/protocol/codecs/array.pyx":793
 *                     parse_state = APS_ELEM_DELIMITED
 *                 end_of_item = True
 *                 stride_len[nest_level - 1] += 1             # <<<<<<<<<<<<<<
 * 
 *             elif not apg_ascii_isspace(ptr[0]):
 */
        __pyx_t_10 = (__pyx_v_nest_level - 1);
        (__pyx_v_stride_len[__pyx_t_10]) = ((__pyx_v_stride_len[__pyx_t_10]) + 1);

        /* "asyncpg/protocol/codecs/array.pyx":784
 *                     dims[nest_level - 1] += 1
 * 
 *             elif ptr[0] == typdelim:             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_ELEM_STARTED, APS_STRIDE_DONE):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
        goto __pyx_L9;
      }

      /* "asyncpg/protocol/codecs/array.pyx":795
 *                 stride_len[nest_level - 1] += 1
 * 
 *             elif not apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,
 */
      __pyx_t_4 = ((!(__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace((__pyx_v_ptr[0])) != 0)) != 0);
      if (__pyx_t_4) {

        /* "asyncpg/protocol/codecs/array.pyx":796
 * 
 *             elif not apg_ascii_isspace(ptr[0]):
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
        switch (__pyx_v_parse_state) {
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_STRIDE_STARTED:
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED:

          /* "asyncpg/protocol/codecs/array.pyx":797
 *             elif not apg_ascii_isspace(ptr[0]):
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)
 */
          case __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_DELIMITED:

          /* "asyncpg/protocol/codecs/array.pyx":796
 * 
 *             elif not apg_ascii_isspace(ptr[0]):
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
          __pyx_t_4 = 0;
          break;
          default:
          __pyx_t_4 = 1;
          break;
        }
        __pyx_t_2 = (__pyx_t_4 != 0);
        if (unlikely(__pyx_t_2)) {

          /* "asyncpg/protocol/codecs/array.pyx":799
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 *                     raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *                 parse_state = APS_ELEM_STARTED
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 799, __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(5, 799, __pyx_L1_error)

          /* "asyncpg/protocol/codecs/array.pyx":796
 * 
 *             elif not apg_ascii_isspace(ptr[0]):
 *                 if parse_state not in (APS_STRIDE_STARTED,             # <<<<<<<<<<<<<<
 *                                        APS_ELEM_STARTED,
 *                                        APS_ELEM_DELIMITED):
 */
        }

        /* "asyncpg/protocol/codecs/array.pyx":801
 *                     raise _UnexpectedCharacter(array_text, ptr)
 * 
 *                 parse_state = APS_ELEM_STARTED             # <<<<<<<<<<<<<<
 *                 array_is_empty = False
 * 
 */
        __pyx_v_parse_state = __pyx_e_7asyncpg_8protocol_8protocol_APS_ELEM_STARTED;

        /* "asyncpg/protocol/codecs/array.pyx":802
 * 
 *                 parse_state = APS_ELEM_STARTED
 *                 array_is_empty = False             # <<<<<<<<<<<<<<
 * 
 *             if not end_of_item:
 */
        __pyx_v_array_is_empty = 0;

        /* "asyncpg/protocol/codecs/array.pyx":795
 *                 stride_len[nest_level - 1] += 1
 * 
 *             elif not apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *                 if parse_state not in (APS_STRIDE_STARTED,
 *                                        APS_ELEM_STARTED,
 */
      }
      __pyx_L9:;

      /* "asyncpg/protocol/codecs/array.pyx":804
 *                 array_is_empty = False
 * 
 *             if not end_of_item:             # <<<<<<<<<<<<<<
 *                 ptr += 1
 * 
 */
      __pyx_t_2 = ((!(__pyx_v_end_of_item != 0)) != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/codecs/array.pyx":805
 * 
 *             if not end_of_item:
 *                 ptr += 1             # <<<<<<<<<<<<<<
 * 
 *         if not array_is_empty:
 */
        __pyx_v_ptr = (__pyx_v_ptr + 1);

        /* "asyncpg/protocol/codecs/array.pyx":804
 *                 array_is_empty = False
 * 
 *             if not end_of_item:             # <<<<<<<<<<<<<<
 *                 ptr += 1
 * 
 */
      }
    }

    /* "asyncpg/protocol/codecs/array.pyx":807
 *                 ptr += 1
 * 
 *         if not array_is_empty:             # <<<<<<<<<<<<<<
 *             dims[ndims[0] - 1] += 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_array_is_empty != 0)) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/array.pyx":808
 * 
 *         if not array_is_empty:
 *             dims[ndims[0] - 1] += 1             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1
 */
      __pyx_t_10 = ((__pyx_v_ndims[0]) - 1);
      (__pyx_v_dims[__pyx_t_10]) = ((__pyx_v_dims[__pyx_t_10]) + 1);

      /* "asyncpg/protocol/codecs/array.pyx":807
 *                 ptr += 1
 * 
 *         if not array_is_empty:             # <<<<<<<<<<<<<<
 *             dims[ndims[0] - 1] += 1
 * 
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":810
 *             dims[ndims[0] - 1] += 1
 * 
 *         ptr += 1             # <<<<<<<<<<<<<<
 * 
 *     # only whitespace is allowed after the closing brace
 */
    __pyx_v_ptr = (__pyx_v_ptr + 1);
  }

  /* "asyncpg/protocol/codecs/array.pyx":813
 * 
 *     # only whitespace is allowed after the closing brace
 *     while ptr[0] != '\0':             # <<<<<<<<<<<<<<
 *         if not apg_ascii_isspace(ptr[0]):
 *             raise _UnexpectedCharacter(array_text, ptr)
 */
  while (1) {
    __pyx_t_2 = (((__pyx_v_ptr[0]) != 0) != 0);
    if (!__pyx_t_2) break;

    /* "asyncpg/protocol/codecs/array.pyx":814
 *     # only whitespace is allowed after the closing brace
 *     while ptr[0] != '\0':
 *         if not apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *             raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
    __pyx_t_2 = ((!(__pyx_f_7asyncpg_8protocol_8protocol_apg_ascii_isspace((__pyx_v_ptr[0])) != 0)) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/codecs/array.pyx":815
 *     while ptr[0] != '\0':
 *         if not apg_ascii_isspace(ptr[0]):
 *             raise _UnexpectedCharacter(array_text, ptr)             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1
 */
      __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol__UnexpectedCharacter(__pyx_v_array_text, __pyx_v_ptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 815, __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(5, 815, __pyx_L1_error)

      /* "asyncpg/protocol/codecs/array.pyx":814
 *     # only whitespace is allowed after the closing brace
 *     while ptr[0] != '\0':
 *         if not apg_ascii_isspace(ptr[0]):             # <<<<<<<<<<<<<<
 *             raise _UnexpectedCharacter(array_text, ptr)
 * 
 */
    }

    /* "asyncpg/protocol/codecs/array.pyx":817
 *             raise _UnexpectedCharacter(array_text, ptr)
 * 
 *         ptr += 1             # <<<<<<<<<<<<<<
 * 
 *     if array_is_empty:
 */
    __pyx_v_ptr = (__pyx_v_ptr + 1);
  }

  /* "asyncpg/protocol/codecs/array.pyx":819
 *         ptr += 1
 * 
 *     if array_is_empty:             # <<<<<<<<<<<<<<
 *         ndims[0] = 0
 * 
 */
  __pyx_t_2 = (__pyx_v_array_is_empty != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/array.pyx":820
 * 
 *     if array_is_empty:
 *         ndims[0] = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_ndims[0]) = 0;

    /* "asyncpg/protocol/codecs/array.pyx":819
 *         ptr += 1
 * 
 *     if array_is_empty:             # <<<<<<<<<<<<<<
 *         ndims[0] = 0
 * 
 */
  }

  /* "asyncpg/protocol/codecs/array.pyx":683
 * 
 * 
 * cdef _infer_array_dims(const Py_UCS4 *array_text,             # <<<<<<<<<<<<<<
 *                        Py_UCS4 typdelim,
 *                        int32_t *dims,
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._infer_array_dims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":823
 * 
 * 
 * cdef uint4_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,             # <<<<<<<<<<<<<<
 *                      const void *arg):
 *     return pgproto.uint4_encode(settings, buf, obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_uint4_encode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, CYTHON_UNUSED void const *__pyx_v_arg) {
  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("uint4_encode_ex", 0);

  /* "asyncpg/protocol/codecs/array.pyx":825
 * cdef uint4_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,
 *                      const void *arg):
 *     return pgproto.uint4_encode(settings, buf, obj)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_uint4_encode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf, __pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":823
 * 
 * 
 * cdef uint4_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,             # <<<<<<<<<<<<<<
 *                      const void *arg):
 *     return pgproto.uint4_encode(settings, buf, obj)
 */

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

/* "asyncpg/protocol/codecs/array.pyx":828
 * 
 * 
 * cdef uint4_decode_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                      const void *arg):
 *     return pgproto.uint4_decode(settings, buf)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_uint4_decode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, CYTHON_UNUSED void const *__pyx_v_arg) {
  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("uint4_decode_ex", 0);

  /* "asyncpg/protocol/codecs/array.pyx":830
 * cdef uint4_decode_ex(ConnectionSettings settings, FRBuffer *buf,
 *                      const void *arg):
 *     return pgproto.uint4_decode(settings, buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_uint4_decode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":828
 * 
 * 
 * cdef uint4_decode_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                      const void *arg):
 *     return pgproto.uint4_decode(settings, buf)
 */

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

/* "asyncpg/protocol/codecs/array.pyx":833
 * 
 * 
 * cdef arrayoid_encode(ConnectionSettings settings, WriteBuffer buf, items):             # <<<<<<<<<<<<<<
 *     array_encode(settings, buf, items, OIDOID,
 *                  <encode_func_ex>&uint4_encode_ex, NULL)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_items) {
  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("arrayoid_encode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":834
 * 
 * cdef arrayoid_encode(ConnectionSettings settings, WriteBuffer buf, items):
 *     array_encode(settings, buf, items, OIDOID,             # <<<<<<<<<<<<<<
 *                  <encode_func_ex>&uint4_encode_ex, NULL)
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_encode(__pyx_v_settings, __pyx_v_buf, __pyx_v_items, 26, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex)(&__pyx_f_7asyncpg_8protocol_8protocol_uint4_encode_ex)), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":833
 * 
 * 
 * cdef arrayoid_encode(ConnectionSettings settings, WriteBuffer buf, items):             # <<<<<<<<<<<<<<
 *     array_encode(settings, buf, items, OIDOID,
 *                  <encode_func_ex>&uint4_encode_ex, NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.arrayoid_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":838
 * 
 * 
 * cdef arrayoid_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     return array_decode(settings, buf, <decode_func_ex>&uint4_decode_ex, NULL)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("arrayoid_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":839
 * 
 * cdef arrayoid_decode(ConnectionSettings settings, FRBuffer *buf):
 *     return array_decode(settings, buf, <decode_func_ex>&uint4_decode_ex, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_decode(__pyx_v_settings, __pyx_v_buf, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex)(&__pyx_f_7asyncpg_8protocol_8protocol_uint4_decode_ex)), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":838
 * 
 * 
 * cdef arrayoid_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     return array_decode(settings, buf, <decode_func_ex>&uint4_decode_ex, NULL)
 * 
 */

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

/* "asyncpg/protocol/codecs/array.pyx":842
 * 
 * 
 * cdef text_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,             # <<<<<<<<<<<<<<
 *                     const void *arg):
 *     return pgproto.text_encode(settings, buf, obj)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_text_encode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, CYTHON_UNUSED void const *__pyx_v_arg) {
  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("text_encode_ex", 0);

  /* "asyncpg/protocol/codecs/array.pyx":844
 * cdef text_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,
 *                     const void *arg):
 *     return pgproto.text_encode(settings, buf, obj)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_text_encode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf, __pyx_v_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":842
 * 
 * 
 * cdef text_encode_ex(ConnectionSettings settings, WriteBuffer buf, object obj,             # <<<<<<<<<<<<<<
 *                     const void *arg):
 *     return pgproto.text_encode(settings, buf, obj)
 */

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

/* "asyncpg/protocol/codecs/array.pyx":847
 * 
 * 
 * cdef text_decode_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                     const void *arg):
 *     return pgproto.text_decode(settings, buf)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_text_decode_ex(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, CYTHON_UNUSED void const *__pyx_v_arg) {
  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("text_decode_ex", 0);

  /* "asyncpg/protocol/codecs/array.pyx":849
 * cdef text_decode_ex(ConnectionSettings settings, FRBuffer *buf,
 *                     const void *arg):
 *     return pgproto.text_decode(settings, buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_text_decode(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *)__pyx_v_settings), __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":847
 * 
 * 
 * cdef text_decode_ex(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                     const void *arg):
 *     return pgproto.text_decode(settings, buf)
 */

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

/* "asyncpg/protocol/codecs/array.pyx":852
 * 
 * 
 * cdef arraytext_encode(ConnectionSettings settings, WriteBuffer buf, items):             # <<<<<<<<<<<<<<
 *     array_encode(settings, buf, items, TEXTOID,
 *                  <encode_func_ex>&text_encode_ex, NULL)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arraytext_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_items) {
  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("arraytext_encode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":853
 * 
 * cdef arraytext_encode(ConnectionSettings settings, WriteBuffer buf, items):
 *     array_encode(settings, buf, items, TEXTOID,             # <<<<<<<<<<<<<<
 *                  <encode_func_ex>&text_encode_ex, NULL)
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_encode(__pyx_v_settings, __pyx_v_buf, __pyx_v_items, 25, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex)(&__pyx_f_7asyncpg_8protocol_8protocol_text_encode_ex)), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":852
 * 
 * 
 * cdef arraytext_encode(ConnectionSettings settings, WriteBuffer buf, items):             # <<<<<<<<<<<<<<
 *     array_encode(settings, buf, items, TEXTOID,
 *                  <encode_func_ex>&text_encode_ex, NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.arraytext_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":857
 * 
 * 
 * cdef arraytext_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     return array_decode(settings, buf, <decode_func_ex>&text_decode_ex, NULL)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_arraytext_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("arraytext_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":858
 * 
 * cdef arraytext_decode(ConnectionSettings settings, FRBuffer *buf):
 *     return array_decode(settings, buf, <decode_func_ex>&text_decode_ex, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_array_decode(__pyx_v_settings, __pyx_v_buf, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex)(&__pyx_f_7asyncpg_8protocol_8protocol_text_decode_ex)), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/array.pyx":857
 * 
 * 
 * cdef arraytext_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     return array_decode(settings, buf, <decode_func_ex>&text_decode_ex, NULL)
 * 
 */

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

/* "asyncpg/protocol/codecs/array.pyx":861
 * 
 * 
 * cdef anyarray_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     # Instances of anyarray (or any other polymorphic pseudotype) are
 *     # never supposed to be returned from actual queries.
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anyarray_decode(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, CYTHON_UNUSED struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  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("anyarray_decode", 0);

  /* "asyncpg/protocol/codecs/array.pyx":864
 *     # Instances of anyarray (or any other polymorphic pseudotype) are
 *     # never supposed to be returned from actual queries.
 *     raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *         'unexpected instance of \'anyarray\' type')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 864, __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_kp_u_unexpected_instance_of_anyarray) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_unexpected_instance_of_anyarray);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(5, 864, __pyx_L1_error)

  /* "asyncpg/protocol/codecs/array.pyx":861
 * 
 * 
 * cdef anyarray_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     # Instances of anyarray (or any other polymorphic pseudotype) are
 *     # never supposed to be returned from actual queries.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.anyarray_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/array.pyx":868
 * 
 * 
 * cdef init_array_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(ANYARRAYOID,
 *                         NULL,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_array_codecs(void) {
  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_array_codecs", 0);

  /* "asyncpg/protocol/codecs/array.pyx":869
 * 
 * cdef init_array_codecs():
 *     register_core_codec(ANYARRAYOID,             # <<<<<<<<<<<<<<
 *                         NULL,
 *                         <decode_func>&anyarray_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x8E5, NULL, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_anyarray_decode)), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":877
 *     # to make type introspection query work
 *     #
 *     register_core_codec(_OIDOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>&arrayoid_encode,
 *                         <decode_func>&arrayoid_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x404, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_encode)), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_arrayoid_decode)), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":882
 *                         PG_FORMAT_BINARY)
 * 
 *     register_core_codec(_TEXTOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>&arraytext_encode,
 *                         <decode_func>&arraytext_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x3F1, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_arraytext_encode)), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)(&__pyx_f_7asyncpg_8protocol_8protocol_arraytext_decode)), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":868
 * 
 * 
 * cdef init_array_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(ANYARRAYOID,
 *                         NULL,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_array_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/range.pyx":24
 * 
 * 
 * cdef inline bint _range_has_lbound(uint8_t flags):             # <<<<<<<<<<<<<<
 *     return not (flags & (RANGE_EMPTY | RANGE_LB_INF))
 * 
 */

static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__range_has_lbound(uint8_t __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_range_has_lbound", 0);

  /* "asyncpg/protocol/codecs/range.pyx":25
 * 
 * cdef inline bint _range_has_lbound(uint8_t flags):
 *     return not (flags & (RANGE_EMPTY | RANGE_LB_INF))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (!((__pyx_v_flags & 9) != 0));
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/range.pyx":24
 * 
 * 
 * cdef inline bint _range_has_lbound(uint8_t flags):             # <<<<<<<<<<<<<<
 *     return not (flags & (RANGE_EMPTY | RANGE_LB_INF))
 * 
 */

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

/* "asyncpg/protocol/codecs/range.pyx":28
 * 
 * 
 * cdef inline bint _range_has_ubound(uint8_t flags):             # <<<<<<<<<<<<<<
 *     return not (flags & (RANGE_EMPTY | RANGE_UB_INF))
 * 
 */

static CYTHON_INLINE int __pyx_f_7asyncpg_8protocol_8protocol__range_has_ubound(uint8_t __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_range_has_ubound", 0);

  /* "asyncpg/protocol/codecs/range.pyx":29
 * 
 * cdef inline bint _range_has_ubound(uint8_t flags):
 *     return not (flags & (RANGE_EMPTY | RANGE_UB_INF))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (!((__pyx_v_flags & 17) != 0));
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/range.pyx":28
 * 
 * 
 * cdef inline bint _range_has_ubound(uint8_t flags):             # <<<<<<<<<<<<<<
 *     return not (flags & (RANGE_EMPTY | RANGE_UB_INF))
 * 
 */

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

/* "asyncpg/protocol/codecs/range.pyx":32
 * 
 * 
 * cdef inline _RangeArgumentType _range_type(object obj):             # <<<<<<<<<<<<<<
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):
 *         return _RANGE_ARGUMENT_TUPLE
 */

static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType __pyx_f_7asyncpg_8protocol_8protocol__range_type(PyObject *__pyx_v_obj) {
  enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType __pyx_r;
  __Pyx_RefNannyDeclarations
  int __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("_range_type", 0);

  /* "asyncpg/protocol/codecs/range.pyx":33
 * 
 * cdef inline _RangeArgumentType _range_type(object obj):
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):             # <<<<<<<<<<<<<<
 *         return _RANGE_ARGUMENT_TUPLE
 *     elif isinstance(obj, apg_types.Range):
 */
  __pyx_t_2 = (PyTuple_Check(__pyx_v_obj) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (PyList_Check(__pyx_v_obj) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/codecs/range.pyx":34
 * cdef inline _RangeArgumentType _range_type(object obj):
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):
 *         return _RANGE_ARGUMENT_TUPLE             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, apg_types.Range):
 *         return _RANGE_ARGUMENT_RANGE
 */
    __pyx_r = __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_TUPLE;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/range.pyx":33
 * 
 * cdef inline _RangeArgumentType _range_type(object obj):
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):             # <<<<<<<<<<<<<<
 *         return _RANGE_ARGUMENT_TUPLE
 *     elif isinstance(obj, apg_types.Range):
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":35
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):
 *         return _RANGE_ARGUMENT_TUPLE
 *     elif isinstance(obj, apg_types.Range):             # <<<<<<<<<<<<<<
 *         return _RANGE_ARGUMENT_RANGE
 *     else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Range); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_4); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(10, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/range.pyx":36
 *         return _RANGE_ARGUMENT_TUPLE
 *     elif isinstance(obj, apg_types.Range):
 *         return _RANGE_ARGUMENT_RANGE             # <<<<<<<<<<<<<<
 *     else:
 *         return _RANGE_ARGUMENT_INVALID
 */
    __pyx_r = __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_RANGE;
    goto __pyx_L0;

    /* "asyncpg/protocol/codecs/range.pyx":35
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):
 *         return _RANGE_ARGUMENT_TUPLE
 *     elif isinstance(obj, apg_types.Range):             # <<<<<<<<<<<<<<
 *         return _RANGE_ARGUMENT_RANGE
 *     else:
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":38
 *         return _RANGE_ARGUMENT_RANGE
 *     else:
 *         return _RANGE_ARGUMENT_INVALID             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_r = __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_INVALID;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/codecs/range.pyx":32
 * 
 * 
 * cdef inline _RangeArgumentType _range_type(object obj):             # <<<<<<<<<<<<<<
 *     if cpython.PyTuple_Check(obj) or cpython.PyList_Check(obj):
 *         return _RANGE_ARGUMENT_TUPLE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("asyncpg.protocol.protocol._range_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/range.pyx":41
 * 
 * 
 * cdef range_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                   object obj, uint32_t elem_oid,
 *                   encode_func_ex encoder, const void *encoder_arg):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_range_encode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, PyObject *__pyx_v_obj, CYTHON_UNUSED uint32_t __pyx_v_elem_oid, __pyx_t_7asyncpg_8protocol_8protocol_encode_func_ex __pyx_v_encoder, void const *__pyx_v_encoder_arg) {
  Py_ssize_t __pyx_v_obj_len;
  uint8_t __pyx_v_flags;
  PyObject *__pyx_v_lower = 0;
  PyObject *__pyx_v_upper = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bounds_data = 0;
  enum __pyx_t_7asyncpg_8protocol_8protocol__RangeArgumentType __pyx_v_arg_type;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("range_encode", 0);

  /* "asyncpg/protocol/codecs/range.pyx":46
 *     cdef:
 *         ssize_t obj_len
 *         uint8_t flags = 0             # <<<<<<<<<<<<<<
 *         object lower = None
 *         object upper = None
 */
  __pyx_v_flags = 0;

  /* "asyncpg/protocol/codecs/range.pyx":47
 *         ssize_t obj_len
 *         uint8_t flags = 0
 *         object lower = None             # <<<<<<<<<<<<<<
 *         object upper = None
 *         WriteBuffer bounds_data = WriteBuffer.new()
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_lower = Py_None;

  /* "asyncpg/protocol/codecs/range.pyx":48
 *         uint8_t flags = 0
 *         object lower = None
 *         object upper = None             # <<<<<<<<<<<<<<
 *         WriteBuffer bounds_data = WriteBuffer.new()
 *         _RangeArgumentType arg_type = _range_type(obj)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_upper = Py_None;

  /* "asyncpg/protocol/codecs/range.pyx":49
 *         object lower = None
 *         object upper = None
 *         WriteBuffer bounds_data = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *         _RangeArgumentType arg_type = _range_type(obj)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bounds_data = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":50
 *         object upper = None
 *         WriteBuffer bounds_data = WriteBuffer.new()
 *         _RangeArgumentType arg_type = _range_type(obj)             # <<<<<<<<<<<<<<
 * 
 *     if arg_type == _RANGE_ARGUMENT_INVALID:
 */
  __pyx_v_arg_type = __pyx_f_7asyncpg_8protocol_8protocol__range_type(__pyx_v_obj);

  /* "asyncpg/protocol/codecs/range.pyx":52
 *         _RangeArgumentType arg_type = _range_type(obj)
 * 
 *     if arg_type == _RANGE_ARGUMENT_INVALID:             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'list, tuple or Range object expected (got type {})'.format(
 */
  switch (__pyx_v_arg_type) {
    case __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_INVALID:

    /* "asyncpg/protocol/codecs/range.pyx":54
 *     if arg_type == _RANGE_ARGUMENT_INVALID:
 *         raise TypeError(
 *             'list, tuple or Range object expected (got type {})'.format(             # <<<<<<<<<<<<<<
 *                 type(obj)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_list_tuple_or_Range_object_expec, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "asyncpg/protocol/codecs/range.pyx":55
 *         raise TypeError(
 *             'list, tuple or Range object expected (got type {})'.format(
 *                 type(obj)))             # <<<<<<<<<<<<<<
 * 
 *     elif arg_type == _RANGE_ARGUMENT_TUPLE:
 */
    __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, ((PyObject *)Py_TYPE(__pyx_v_obj))) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_obj)));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/codecs/range.pyx":53
 * 
 *     if arg_type == _RANGE_ARGUMENT_INVALID:
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             'list, tuple or Range object expected (got type {})'.format(
 *                 type(obj)))
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 53, __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(10, 53, __pyx_L1_error)

    /* "asyncpg/protocol/codecs/range.pyx":52
 *         _RangeArgumentType arg_type = _range_type(obj)
 * 
 *     if arg_type == _RANGE_ARGUMENT_INVALID:             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             'list, tuple or Range object expected (got type {})'.format(
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol__RANGE_ARGUMENT_TUPLE:

    /* "asyncpg/protocol/codecs/range.pyx":58
 * 
 *     elif arg_type == _RANGE_ARGUMENT_TUPLE:
 *         obj_len = len(obj)             # <<<<<<<<<<<<<<
 *         if obj_len == 2:
 *             lower = obj[0]
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(10, 58, __pyx_L1_error)
    __pyx_v_obj_len = __pyx_t_4;

    /* "asyncpg/protocol/codecs/range.pyx":59
 *     elif arg_type == _RANGE_ARGUMENT_TUPLE:
 *         obj_len = len(obj)
 *         if obj_len == 2:             # <<<<<<<<<<<<<<
 *             lower = obj[0]
 *             upper = obj[1]
 */
    switch (__pyx_v_obj_len) {
      case 2:

      /* "asyncpg/protocol/codecs/range.pyx":60
 *         obj_len = len(obj)
 *         if obj_len == 2:
 *             lower = obj[0]             # <<<<<<<<<<<<<<
 *             upper = obj[1]
 * 
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":61
 *         if obj_len == 2:
 *             lower = obj[0]
 *             upper = obj[1]             # <<<<<<<<<<<<<<
 * 
 *             if lower is None:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_obj, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_upper, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":63
 *             upper = obj[1]
 * 
 *             if lower is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INF
 * 
 */
      __pyx_t_5 = (__pyx_v_lower == Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/range.pyx":64
 * 
 *             if lower is None:
 *                 flags |= RANGE_LB_INF             # <<<<<<<<<<<<<<
 * 
 *             if upper is None:
 */
        __pyx_v_flags = (__pyx_v_flags | 8);

        /* "asyncpg/protocol/codecs/range.pyx":63
 *             upper = obj[1]
 * 
 *             if lower is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INF
 * 
 */
      }

      /* "asyncpg/protocol/codecs/range.pyx":66
 *                 flags |= RANGE_LB_INF
 * 
 *             if upper is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INF
 * 
 */
      __pyx_t_6 = (__pyx_v_upper == Py_None);
      __pyx_t_5 = (__pyx_t_6 != 0);
      if (__pyx_t_5) {

        /* "asyncpg/protocol/codecs/range.pyx":67
 * 
 *             if upper is None:
 *                 flags |= RANGE_UB_INF             # <<<<<<<<<<<<<<
 * 
 *             flags |= RANGE_LB_INC | RANGE_UB_INC
 */
        __pyx_v_flags = (__pyx_v_flags | 16);

        /* "asyncpg/protocol/codecs/range.pyx":66
 *                 flags |= RANGE_LB_INF
 * 
 *             if upper is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INF
 * 
 */
      }

      /* "asyncpg/protocol/codecs/range.pyx":69
 *                 flags |= RANGE_UB_INF
 * 
 *             flags |= RANGE_LB_INC | RANGE_UB_INC             # <<<<<<<<<<<<<<
 * 
 *         elif obj_len == 1:
 */
      __pyx_v_flags = (__pyx_v_flags | 6);

      /* "asyncpg/protocol/codecs/range.pyx":59
 *     elif arg_type == _RANGE_ARGUMENT_TUPLE:
 *         obj_len = len(obj)
 *         if obj_len == 2:             # <<<<<<<<<<<<<<
 *             lower = obj[0]
 *             upper = obj[1]
 */
      break;
      case 1:

      /* "asyncpg/protocol/codecs/range.pyx":72
 * 
 *         elif obj_len == 1:
 *             lower = obj[0]             # <<<<<<<<<<<<<<
 *             flags |= RANGE_LB_INC | RANGE_UB_INF
 * 
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":73
 *         elif obj_len == 1:
 *             lower = obj[0]
 *             flags |= RANGE_LB_INC | RANGE_UB_INF             # <<<<<<<<<<<<<<
 * 
 *         elif obj_len == 0:
 */
      __pyx_v_flags = (__pyx_v_flags | 18);

      /* "asyncpg/protocol/codecs/range.pyx":71
 *             flags |= RANGE_LB_INC | RANGE_UB_INC
 * 
 *         elif obj_len == 1:             # <<<<<<<<<<<<<<
 *             lower = obj[0]
 *             flags |= RANGE_LB_INC | RANGE_UB_INF
 */
      break;
      case 0:

      /* "asyncpg/protocol/codecs/range.pyx":76
 * 
 *         elif obj_len == 0:
 *             flags |= RANGE_EMPTY             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_v_flags = (__pyx_v_flags | 1);

      /* "asyncpg/protocol/codecs/range.pyx":75
 *             flags |= RANGE_LB_INC | RANGE_UB_INF
 * 
 *         elif obj_len == 0:             # <<<<<<<<<<<<<<
 *             flags |= RANGE_EMPTY
 * 
 */
      break;
      default:

      /* "asyncpg/protocol/codecs/range.pyx":80
 *         else:
 *             raise ValueError(
 *                 'expected 0, 1 or 2 elements in range (got {})'.format(             # <<<<<<<<<<<<<<
 *                     obj_len))
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_expected_0_1_or_2_elements_in_ra, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "asyncpg/protocol/codecs/range.pyx":81
 *             raise ValueError(
 *                 'expected 0, 1 or 2 elements in range (got {})'.format(
 *                     obj_len))             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_obj_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 81, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __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_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":79
 * 
 *         else:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'expected 0, 1 or 2 elements in range (got {})'.format(
 *                     obj_len))
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(10, 79, __pyx_L1_error)
      break;
    }

    /* "asyncpg/protocol/codecs/range.pyx":57
 *                 type(obj)))
 * 
 *     elif arg_type == _RANGE_ARGUMENT_TUPLE:             # <<<<<<<<<<<<<<
 *         obj_len = len(obj)
 *         if obj_len == 2:
 */
    break;
    default:

    /* "asyncpg/protocol/codecs/range.pyx":84
 * 
 *     else:
 *         if obj.isempty:             # <<<<<<<<<<<<<<
 *             flags |= RANGE_EMPTY
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_isempty); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(10, 84, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "asyncpg/protocol/codecs/range.pyx":85
 *     else:
 *         if obj.isempty:
 *             flags |= RANGE_EMPTY             # <<<<<<<<<<<<<<
 *         else:
 *             lower = obj.lower
 */
      __pyx_v_flags = (__pyx_v_flags | 1);

      /* "asyncpg/protocol/codecs/range.pyx":84
 * 
 *     else:
 *         if obj.isempty:             # <<<<<<<<<<<<<<
 *             flags |= RANGE_EMPTY
 *         else:
 */
      goto __pyx_L5;
    }

    /* "asyncpg/protocol/codecs/range.pyx":87
 *             flags |= RANGE_EMPTY
 *         else:
 *             lower = obj.lower             # <<<<<<<<<<<<<<
 *             upper = obj.upper
 * 
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":88
 *         else:
 *             lower = obj.lower
 *             upper = obj.upper             # <<<<<<<<<<<<<<
 * 
 *             if obj.lower_inc:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_upper); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_upper, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/codecs/range.pyx":90
 *             upper = obj.upper
 * 
 *             if obj.lower_inc:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INC
 *             elif lower is None:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_lower_inc); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(10, 90, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {

        /* "asyncpg/protocol/codecs/range.pyx":91
 * 
 *             if obj.lower_inc:
 *                 flags |= RANGE_LB_INC             # <<<<<<<<<<<<<<
 *             elif lower is None:
 *                 flags |= RANGE_LB_INF
 */
        __pyx_v_flags = (__pyx_v_flags | 2);

        /* "asyncpg/protocol/codecs/range.pyx":90
 *             upper = obj.upper
 * 
 *             if obj.lower_inc:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INC
 *             elif lower is None:
 */
        goto __pyx_L6;
      }

      /* "asyncpg/protocol/codecs/range.pyx":92
 *             if obj.lower_inc:
 *                 flags |= RANGE_LB_INC
 *             elif lower is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INF
 * 
 */
      __pyx_t_5 = (__pyx_v_lower == Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/range.pyx":93
 *                 flags |= RANGE_LB_INC
 *             elif lower is None:
 *                 flags |= RANGE_LB_INF             # <<<<<<<<<<<<<<
 * 
 *             if obj.upper_inc:
 */
        __pyx_v_flags = (__pyx_v_flags | 8);

        /* "asyncpg/protocol/codecs/range.pyx":92
 *             if obj.lower_inc:
 *                 flags |= RANGE_LB_INC
 *             elif lower is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_LB_INF
 * 
 */
      }
      __pyx_L6:;

      /* "asyncpg/protocol/codecs/range.pyx":95
 *                 flags |= RANGE_LB_INF
 * 
 *             if obj.upper_inc:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INC
 *             elif upper is None:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_upper_inc); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(10, 95, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_6) {

        /* "asyncpg/protocol/codecs/range.pyx":96
 * 
 *             if obj.upper_inc:
 *                 flags |= RANGE_UB_INC             # <<<<<<<<<<<<<<
 *             elif upper is None:
 *                 flags |= RANGE_UB_INF
 */
        __pyx_v_flags = (__pyx_v_flags | 4);

        /* "asyncpg/protocol/codecs/range.pyx":95
 *                 flags |= RANGE_LB_INF
 * 
 *             if obj.upper_inc:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INC
 *             elif upper is None:
 */
        goto __pyx_L7;
      }

      /* "asyncpg/protocol/codecs/range.pyx":97
 *             if obj.upper_inc:
 *                 flags |= RANGE_UB_INC
 *             elif upper is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INF
 * 
 */
      __pyx_t_6 = (__pyx_v_upper == Py_None);
      __pyx_t_5 = (__pyx_t_6 != 0);
      if (__pyx_t_5) {

        /* "asyncpg/protocol/codecs/range.pyx":98
 *                 flags |= RANGE_UB_INC
 *             elif upper is None:
 *                 flags |= RANGE_UB_INF             # <<<<<<<<<<<<<<
 * 
 *     if _range_has_lbound(flags):
 */
        __pyx_v_flags = (__pyx_v_flags | 16);

        /* "asyncpg/protocol/codecs/range.pyx":97
 *             if obj.upper_inc:
 *                 flags |= RANGE_UB_INC
 *             elif upper is None:             # <<<<<<<<<<<<<<
 *                 flags |= RANGE_UB_INF
 * 
 */
      }
      __pyx_L7:;
    }
    __pyx_L5:;
    break;
  }

  /* "asyncpg/protocol/codecs/range.pyx":100
 *                 flags |= RANGE_UB_INF
 * 
 *     if _range_has_lbound(flags):             # <<<<<<<<<<<<<<
 *         encoder(settings, bounds_data, lower, encoder_arg)
 * 
 */
  __pyx_t_5 = (__pyx_f_7asyncpg_8protocol_8protocol__range_has_lbound(__pyx_v_flags) != 0);
  if (__pyx_t_5) {

    /* "asyncpg/protocol/codecs/range.pyx":101
 * 
 *     if _range_has_lbound(flags):
 *         encoder(settings, bounds_data, lower, encoder_arg)             # <<<<<<<<<<<<<<
 * 
 *     if _range_has_ubound(flags):
 */
    __pyx_t_1 = __pyx_v_encoder(__pyx_v_settings, __pyx_v_bounds_data, __pyx_v_lower, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/range.pyx":100
 *                 flags |= RANGE_UB_INF
 * 
 *     if _range_has_lbound(flags):             # <<<<<<<<<<<<<<
 *         encoder(settings, bounds_data, lower, encoder_arg)
 * 
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":103
 *         encoder(settings, bounds_data, lower, encoder_arg)
 * 
 *     if _range_has_ubound(flags):             # <<<<<<<<<<<<<<
 *         encoder(settings, bounds_data, upper, encoder_arg)
 * 
 */
  __pyx_t_5 = (__pyx_f_7asyncpg_8protocol_8protocol__range_has_ubound(__pyx_v_flags) != 0);
  if (__pyx_t_5) {

    /* "asyncpg/protocol/codecs/range.pyx":104
 * 
 *     if _range_has_ubound(flags):
 *         encoder(settings, bounds_data, upper, encoder_arg)             # <<<<<<<<<<<<<<
 * 
 *     buf.write_int32(1 + bounds_data.len())
 */
    __pyx_t_1 = __pyx_v_encoder(__pyx_v_settings, __pyx_v_bounds_data, __pyx_v_upper, __pyx_v_encoder_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/codecs/range.pyx":103
 *         encoder(settings, bounds_data, lower, encoder_arg)
 * 
 *     if _range_has_ubound(flags):             # <<<<<<<<<<<<<<
 *         encoder(settings, bounds_data, upper, encoder_arg)
 * 
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":106
 *         encoder(settings, bounds_data, upper, encoder_arg)
 * 
 *     buf.write_int32(1 + bounds_data.len())             # <<<<<<<<<<<<<<
 *     buf.write_byte(<int8_t>flags)
 *     buf.write_buffer(bounds_data)
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_bounds_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":107
 * 
 *     buf.write_int32(1 + bounds_data.len())
 *     buf.write_byte(<int8_t>flags)             # <<<<<<<<<<<<<<
 *     buf.write_buffer(bounds_data)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_byte(__pyx_v_buf, ((int8_t)__pyx_v_flags)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":108
 *     buf.write_int32(1 + bounds_data.len())
 *     buf.write_byte(<int8_t>flags)
 *     buf.write_buffer(bounds_data)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, __pyx_v_bounds_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":41
 * 
 * 
 * cdef range_encode(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                   object obj, uint32_t elem_oid,
 *                   encode_func_ex encoder, const void *encoder_arg):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.range_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XDECREF((PyObject *)__pyx_v_bounds_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/range.pyx":111
 * 
 * 
 * cdef range_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                   decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_range_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf, __pyx_t_7asyncpg_8protocol_8protocol_decode_func_ex __pyx_v_decoder, void const *__pyx_v_decoder_arg) {
  uint8_t __pyx_v_flags;
  int32_t __pyx_v_bound_len;
  PyObject *__pyx_v_lower = 0;
  PyObject *__pyx_v_upper = 0;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_bound_buf;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("range_decode", 0);

  /* "asyncpg/protocol/codecs/range.pyx":114
 *                   decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 *         uint8_t flags = <uint8_t>frb_read(buf, 1)[0]             # <<<<<<<<<<<<<<
 *         int32_t bound_len
 *         object lower = None
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 1); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(10, 114, __pyx_L1_error)
  __pyx_v_flags = ((uint8_t)(__pyx_t_1[0]));

  /* "asyncpg/protocol/codecs/range.pyx":116
 *         uint8_t flags = <uint8_t>frb_read(buf, 1)[0]
 *         int32_t bound_len
 *         object lower = None             # <<<<<<<<<<<<<<
 *         object upper = None
 *         FRBuffer bound_buf
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_lower = Py_None;

  /* "asyncpg/protocol/codecs/range.pyx":117
 *         int32_t bound_len
 *         object lower = None
 *         object upper = None             # <<<<<<<<<<<<<<
 *         FRBuffer bound_buf
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_upper = Py_None;

  /* "asyncpg/protocol/codecs/range.pyx":120
 *         FRBuffer bound_buf
 * 
 *     if _range_has_lbound(flags):             # <<<<<<<<<<<<<<
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 */
  __pyx_t_2 = (__pyx_f_7asyncpg_8protocol_8protocol__range_has_lbound(__pyx_v_flags) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/range.pyx":121
 * 
 *     if _range_has_lbound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         if bound_len == -1:
 *             lower = None
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(10, 121, __pyx_L1_error)
    __pyx_v_bound_len = unpack_int32(__pyx_t_1);

    /* "asyncpg/protocol/codecs/range.pyx":122
 *     if _range_has_lbound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:             # <<<<<<<<<<<<<<
 *             lower = None
 *         else:
 */
    __pyx_t_2 = ((__pyx_v_bound_len == -1L) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/range.pyx":123
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 *             lower = None             # <<<<<<<<<<<<<<
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_lower, Py_None);

      /* "asyncpg/protocol/codecs/range.pyx":122
 *     if _range_has_lbound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:             # <<<<<<<<<<<<<<
 *             lower = None
 *         else:
 */
      goto __pyx_L4;
    }

    /* "asyncpg/protocol/codecs/range.pyx":125
 *             lower = None
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)             # <<<<<<<<<<<<<<
 *             lower = decoder(settings, &bound_buf, decoder_arg)
 * 
 */
    /*else*/ {
      (void)(__pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from((&__pyx_v_bound_buf), __pyx_v_buf, __pyx_v_bound_len));

      /* "asyncpg/protocol/codecs/range.pyx":126
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)
 *             lower = decoder(settings, &bound_buf, decoder_arg)             # <<<<<<<<<<<<<<
 * 
 *     if _range_has_ubound(flags):
 */
      __pyx_t_3 = __pyx_v_decoder(__pyx_v_settings, (&__pyx_v_bound_buf), __pyx_v_decoder_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_lower, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L4:;

    /* "asyncpg/protocol/codecs/range.pyx":120
 *         FRBuffer bound_buf
 * 
 *     if _range_has_lbound(flags):             # <<<<<<<<<<<<<<
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":128
 *             lower = decoder(settings, &bound_buf, decoder_arg)
 * 
 *     if _range_has_ubound(flags):             # <<<<<<<<<<<<<<
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 */
  __pyx_t_2 = (__pyx_f_7asyncpg_8protocol_8protocol__range_has_ubound(__pyx_v_flags) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/codecs/range.pyx":129
 * 
 *     if _range_has_ubound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         if bound_len == -1:
 *             upper = None
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(10, 129, __pyx_L1_error)
    __pyx_v_bound_len = unpack_int32(__pyx_t_1);

    /* "asyncpg/protocol/codecs/range.pyx":130
 *     if _range_has_ubound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:             # <<<<<<<<<<<<<<
 *             upper = None
 *         else:
 */
    __pyx_t_2 = ((__pyx_v_bound_len == -1L) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/codecs/range.pyx":131
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 *             upper = None             # <<<<<<<<<<<<<<
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_upper, Py_None);

      /* "asyncpg/protocol/codecs/range.pyx":130
 *     if _range_has_ubound(flags):
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:             # <<<<<<<<<<<<<<
 *             upper = None
 *         else:
 */
      goto __pyx_L6;
    }

    /* "asyncpg/protocol/codecs/range.pyx":133
 *             upper = None
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)             # <<<<<<<<<<<<<<
 *             upper = decoder(settings, &bound_buf, decoder_arg)
 * 
 */
    /*else*/ {
      (void)(__pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from((&__pyx_v_bound_buf), __pyx_v_buf, __pyx_v_bound_len));

      /* "asyncpg/protocol/codecs/range.pyx":134
 *         else:
 *             frb_slice_from(&bound_buf, buf, bound_len)
 *             upper = decoder(settings, &bound_buf, decoder_arg)             # <<<<<<<<<<<<<<
 * 
 *     return apg_types.Range(lower=lower, upper=upper,
 */
      __pyx_t_3 = __pyx_v_decoder(__pyx_v_settings, (&__pyx_v_bound_buf), __pyx_v_decoder_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_upper, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L6:;

    /* "asyncpg/protocol/codecs/range.pyx":128
 *             lower = decoder(settings, &bound_buf, decoder_arg)
 * 
 *     if _range_has_ubound(flags):             # <<<<<<<<<<<<<<
 *         bound_len = hton.unpack_int32(frb_read(buf, 4))
 *         if bound_len == -1:
 */
  }

  /* "asyncpg/protocol/codecs/range.pyx":136
 *             upper = decoder(settings, &bound_buf, decoder_arg)
 * 
 *     return apg_types.Range(lower=lower, upper=upper,             # <<<<<<<<<<<<<<
 *                            lower_inc=(flags & RANGE_LB_INC) != 0,
 *                            upper_inc=(flags & RANGE_UB_INC) != 0,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Range); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_lower, __pyx_v_lower) < 0) __PYX_ERR(10, 136, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_upper, __pyx_v_upper) < 0) __PYX_ERR(10, 136, __pyx_L1_error)

  /* "asyncpg/protocol/codecs/range.pyx":137
 * 
 *     return apg_types.Range(lower=lower, upper=upper,
 *                            lower_inc=(flags & RANGE_LB_INC) != 0,             # <<<<<<<<<<<<<<
 *                            upper_inc=(flags & RANGE_UB_INC) != 0,
 *                            empty=(flags & RANGE_EMPTY) != 0)
 */
  __pyx_t_5 = __Pyx_PyBool_FromLong(((__pyx_v_flags & 2) != 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_lower_inc, __pyx_t_5) < 0) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":138
 *     return apg_types.Range(lower=lower, upper=upper,
 *                            lower_inc=(flags & RANGE_LB_INC) != 0,
 *                            upper_inc=(flags & RANGE_UB_INC) != 0,             # <<<<<<<<<<<<<<
 *                            empty=(flags & RANGE_EMPTY) != 0)
 * 
 */
  __pyx_t_5 = __Pyx_PyBool_FromLong(((__pyx_v_flags & 4) != 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_upper_inc, __pyx_t_5) < 0) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":139
 *                            lower_inc=(flags & RANGE_LB_INC) != 0,
 *                            upper_inc=(flags & RANGE_UB_INC) != 0,
 *                            empty=(flags & RANGE_EMPTY) != 0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyBool_FromLong(((__pyx_v_flags & 1) != 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_empty, __pyx_t_5) < 0) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":136
 *             upper = decoder(settings, &bound_buf, decoder_arg)
 * 
 *     return apg_types.Range(lower=lower, upper=upper,             # <<<<<<<<<<<<<<
 *                            lower_inc=(flags & RANGE_LB_INC) != 0,
 *                            upper_inc=(flags & RANGE_UB_INC) != 0,
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/range.pyx":111
 * 
 * 
 * cdef range_decode(ConnectionSettings settings, FRBuffer *buf,             # <<<<<<<<<<<<<<
 *                   decode_func_ex decoder, const void *decoder_arg):
 *     cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.range_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/range.pyx":142
 * 
 * 
 * cdef init_range_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(ANYRANGEOID,
 *                         NULL,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_range_codecs(void) {
  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_range_codecs", 0);

  /* "asyncpg/protocol/codecs/range.pyx":143
 * 
 * cdef init_range_codecs():
 *     register_core_codec(ANYRANGEOID,             # <<<<<<<<<<<<<<
 *                         NULL,
 *                         <decode_func>pgproto.text_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0xEF7, NULL, ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_TEXT, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":142
 * 
 * 
 * cdef init_range_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(ANYRANGEOID,
 *                         NULL,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_range_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/record.pyx":11
 * 
 * 
 * cdef inline record_encode_frame(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                                 WriteBuffer elem_data, int32_t elem_count):
 *     buf.write_int32(4 + elem_data.len())
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_record_encode_frame(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_elem_data, int32_t __pyx_v_elem_count) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int32_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("record_encode_frame", 0);

  /* "asyncpg/protocol/codecs/record.pyx":13
 * cdef inline record_encode_frame(ConnectionSettings settings, WriteBuffer buf,
 *                                 WriteBuffer elem_data, int32_t elem_count):
 *     buf.write_int32(4 + elem_data.len())             # <<<<<<<<<<<<<<
 *     # attribute count
 *     buf.write_int32(elem_count)
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_elem_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AddCObj(__pyx_int_4, __pyx_t_1, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(11, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":15
 *     buf.write_int32(4 + elem_data.len())
 *     # attribute count
 *     buf.write_int32(elem_count)             # <<<<<<<<<<<<<<
 *     # encoded attribute data
 *     buf.write_buffer(elem_data)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_v_elem_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":17
 *     buf.write_int32(elem_count)
 *     # encoded attribute data
 *     buf.write_buffer(elem_data)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, __pyx_v_elem_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":11
 * 
 * 
 * cdef inline record_encode_frame(ConnectionSettings settings, WriteBuffer buf,             # <<<<<<<<<<<<<<
 *                                 WriteBuffer elem_data, int32_t elem_count):
 *     buf.write_int32(4 + elem_data.len())
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.record_encode_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/record.pyx":20
 * 
 * 
 * cdef anonymous_record_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     cdef:
 *         tuple result
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_decode(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_buf) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_elem_count;
  Py_ssize_t __pyx_v_i;
  int32_t __pyx_v_elem_len;
  uint32_t __pyx_v_elem_typ;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_elem_codec = 0;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_elem_buf;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  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_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("anonymous_record_decode", 0);

  /* "asyncpg/protocol/codecs/record.pyx":30
 *         FRBuffer elem_buf
 * 
 *     elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *     result = cpython.PyTuple_New(elem_count)
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(11, 30, __pyx_L1_error)
  __pyx_v_elem_count = ((Py_ssize_t)((uint32_t)unpack_int32(__pyx_t_1)));

  /* "asyncpg/protocol/codecs/record.pyx":31
 * 
 *     elem_count = <ssize_t><uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *     result = cpython.PyTuple_New(elem_count)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(elem_count):
 */
  __pyx_t_2 = PyTuple_New(__pyx_v_elem_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":33
 *     result = cpython.PyTuple_New(elem_count)
 * 
 *     for i in range(elem_count):             # <<<<<<<<<<<<<<
 *         elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 */
  __pyx_t_3 = __pyx_v_elem_count;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "asyncpg/protocol/codecs/record.pyx":34
 * 
 *     for i in range(elem_count):
 *         elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 * 
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(11, 34, __pyx_L1_error)
    __pyx_v_elem_typ = ((uint32_t)unpack_int32(__pyx_t_1));

    /* "asyncpg/protocol/codecs/record.pyx":35
 *     for i in range(elem_count):
 *         elem_typ = <uint32_t>hton.unpack_int32(frb_read(buf, 4))
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))             # <<<<<<<<<<<<<<
 * 
 *         if elem_len == -1:
 */
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(11, 35, __pyx_L1_error)
    __pyx_v_elem_len = unpack_int32(__pyx_t_1);

    /* "asyncpg/protocol/codecs/record.pyx":37
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 * 
 *         if elem_len == -1:             # <<<<<<<<<<<<<<
 *             elem = None
 *         else:
 */
    __pyx_t_6 = ((__pyx_v_elem_len == -1L) != 0);
    if (__pyx_t_6) {

      /* "asyncpg/protocol/codecs/record.pyx":38
 * 
 *         if elem_len == -1:
 *             elem = None             # <<<<<<<<<<<<<<
 *         else:
 *             elem_codec = settings.get_data_codec(elem_typ)
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_elem, Py_None);

      /* "asyncpg/protocol/codecs/record.pyx":37
 *         elem_len = hton.unpack_int32(frb_read(buf, 4))
 * 
 *         if elem_len == -1:             # <<<<<<<<<<<<<<
 *             elem = None
 *         else:
 */
      goto __pyx_L5;
    }

    /* "asyncpg/protocol/codecs/record.pyx":40
 *             elem = None
 *         else:
 *             elem_codec = settings.get_data_codec(elem_typ)             # <<<<<<<<<<<<<<
 *             if elem_codec is None or not elem_codec.has_decoder():
 *                 raise exceptions.InternalClientError(
 */
    /*else*/ {
      __pyx_t_2 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(__pyx_v_settings, __pyx_v_elem_typ, 0, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_elem_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/codecs/record.pyx":41
 *         else:
 *             elem_codec = settings.get_data_codec(elem_typ)
 *             if elem_codec is None or not elem_codec.has_decoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for composite type element in '
 */
      __pyx_t_7 = (((PyObject *)__pyx_v_elem_codec) == Py_None);
      __pyx_t_8 = (__pyx_t_7 != 0);
      if (!__pyx_t_8) {
      } else {
        __pyx_t_6 = __pyx_t_8;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(__pyx_v_elem_codec); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(11, 41, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = ((!__pyx_t_8) != 0);
      __pyx_t_6 = __pyx_t_7;
      __pyx_L7_bool_binop_done:;
      if (unlikely(__pyx_t_6)) {

        /* "asyncpg/protocol/codecs/record.pyx":42
 *             elem_codec = settings.get_data_codec(elem_typ)
 *             if elem_codec is None or not elem_codec.has_decoder():
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'no decoder for composite type element in '
 *                     'position {} of type OID {}'.format(i, elem_typ))
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 42, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 42, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "asyncpg/protocol/codecs/record.pyx":44
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for composite type element in '
 *                     'position {} of type OID {}'.format(i, elem_typ))             # <<<<<<<<<<<<<<
 *             elem = elem_codec.decode(settings,
 *                                      frb_slice_from(&elem_buf, buf, elem_len))
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_no_decoder_for_composite_type_el, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(11, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(11, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyInt_From_uint32_t(__pyx_v_elem_typ); if (unlikely(!__pyx_t_13)) __PYX_ERR(11, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = NULL;
        __pyx_t_15 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_15 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_12, __pyx_t_13};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 44, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_12, __pyx_t_13};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 44, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(11, 44, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__pyx_t_14) {
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_t_13);
          __pyx_t_12 = 0;
          __pyx_t_13 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_16, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 44, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 42, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(11, 42, __pyx_L1_error)

        /* "asyncpg/protocol/codecs/record.pyx":41
 *         else:
 *             elem_codec = settings.get_data_codec(elem_typ)
 *             if elem_codec is None or not elem_codec.has_decoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for composite type element in '
 */
      }

      /* "asyncpg/protocol/codecs/record.pyx":45
 *                     'no decoder for composite type element in '
 *                     'position {} of type OID {}'.format(i, elem_typ))
 *             elem = elem_codec.decode(settings,             # <<<<<<<<<<<<<<
 *                                      frb_slice_from(&elem_buf, buf, elem_len))
 * 
 */
      __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(__pyx_v_elem_codec, __pyx_v_settings, __pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from((&__pyx_v_elem_buf), __pyx_v_buf, __pyx_v_elem_len)); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L5:;

    /* "asyncpg/protocol/codecs/record.pyx":48
 *                                      frb_slice_from(&elem_buf, buf, elem_len))
 * 
 *         cpython.Py_INCREF(elem)             # <<<<<<<<<<<<<<
 *         cpython.PyTuple_SET_ITEM(result, i, elem)
 * 
 */
    Py_INCREF(__pyx_v_elem);

    /* "asyncpg/protocol/codecs/record.pyx":49
 * 
 *         cpython.Py_INCREF(elem)
 *         cpython.PyTuple_SET_ITEM(result, i, elem)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    PyTuple_SET_ITEM(__pyx_v_result, __pyx_v_i, __pyx_v_elem);
  }

  /* "asyncpg/protocol/codecs/record.pyx":51
 *         cpython.PyTuple_SET_ITEM(result, i, elem)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/codecs/record.pyx":20
 * 
 * 
 * cdef anonymous_record_decode(ConnectionSettings settings, FRBuffer *buf):             # <<<<<<<<<<<<<<
 *     cdef:
 *         tuple result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.anonymous_record_decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_elem_codec);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/record.pyx":54
 * 
 * 
 * cdef anonymous_record_encode(ConnectionSettings settings, WriteBuffer buf, obj):             # <<<<<<<<<<<<<<
 *     raise exceptions.UnsupportedClientFeatureError(
 *         'input of anonymous composite types is not supported',
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_encode(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings, CYTHON_UNUSED struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf, CYTHON_UNUSED PyObject *__pyx_v_obj) {
  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("anonymous_record_encode", 0);

  /* "asyncpg/protocol/codecs/record.pyx":55
 * 
 * cdef anonymous_record_encode(ConnectionSettings settings, WriteBuffer buf, obj):
 *     raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *         'input of anonymous composite types is not supported',
 *         hint=(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UnsupportedClientFeatureError); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":57
 *     raise exceptions.UnsupportedClientFeatureError(
 *         'input of anonymous composite types is not supported',
 *         hint=(             # <<<<<<<<<<<<<<
 *             'Consider declaring an explicit composite type and '
 *             'using it to cast the argument.'
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hint, __pyx_kp_u_Consider_declaring_an_explicit_c) < 0) __PYX_ERR(11, 57, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_detail, __pyx_kp_u_PostgreSQL_does_not_implement_an) < 0) __PYX_ERR(11, 57, __pyx_L1_error)

  /* "asyncpg/protocol/codecs/record.pyx":55
 * 
 * cdef anonymous_record_encode(ConnectionSettings settings, WriteBuffer buf, obj):
 *     raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *         'input of anonymous composite types is not supported',
 *         hint=(
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__25, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(11, 55, __pyx_L1_error)

  /* "asyncpg/protocol/codecs/record.pyx":54
 * 
 * 
 * cdef anonymous_record_encode(ConnectionSettings settings, WriteBuffer buf, obj):             # <<<<<<<<<<<<<<
 *     raise exceptions.UnsupportedClientFeatureError(
 *         'input of anonymous composite types is not supported',
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.anonymous_record_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/codecs/record.pyx":65
 * 
 * 
 * cdef init_record_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(RECORDOID,
 *                         <encode_func>anonymous_record_encode,
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_init_record_codecs(void) {
  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_record_codecs", 0);

  /* "asyncpg/protocol/codecs/record.pyx":66
 * 
 * cdef init_record_codecs():
 *     register_core_codec(RECORDOID,             # <<<<<<<<<<<<<<
 *                         <encode_func>anonymous_record_encode,
 *                         <decode_func>anonymous_record_decode,
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_register_core_codec(0x8C9, ((__pyx_t_7asyncpg_8protocol_8protocol_encode_func)__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_encode), ((__pyx_t_7asyncpg_8protocol_8protocol_decode_func)__pyx_f_7asyncpg_8protocol_8protocol_anonymous_record_decode), __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":65
 * 
 * 
 * cdef init_record_codecs():             # <<<<<<<<<<<<<<
 *     register_core_codec(RECORDOID,
 *                         <encode_func>anonymous_record_encode,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.init_record_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":100
 *     )
 * 
 *     def __cinit__(self, bytes authentication_method):             # <<<<<<<<<<<<<<
 *         self.authentication_method = authentication_method
 *         self.authorization_message = None
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_authentication_method = 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_authentication_method,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_authentication_method)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 100, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_authentication_method = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_authentication_method), (&PyBytes_Type), 1, "authentication_method", 1))) __PYX_ERR(0, 100, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication___cinit__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self), __pyx_v_authentication_method);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_authentication_method) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asyncpg/protocol/scram.pyx":101
 * 
 *     def __cinit__(self, bytes authentication_method):
 *         self.authentication_method = authentication_method             # <<<<<<<<<<<<<<
 *         self.authorization_message = None
 *         # channel binding is turned off for the time being
 */
  __Pyx_INCREF(__pyx_v_authentication_method);
  __Pyx_GIVEREF(__pyx_v_authentication_method);
  __Pyx_GOTREF(__pyx_v_self->authentication_method);
  __Pyx_DECREF(__pyx_v_self->authentication_method);
  __pyx_v_self->authentication_method = __pyx_v_authentication_method;

  /* "asyncpg/protocol/scram.pyx":102
 *     def __cinit__(self, bytes authentication_method):
 *         self.authentication_method = authentication_method
 *         self.authorization_message = None             # <<<<<<<<<<<<<<
 *         # channel binding is turned off for the time being
 *         self.client_channel_binding = b"n,,"
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->authorization_message);
  __Pyx_DECREF(__pyx_v_self->authorization_message);
  __pyx_v_self->authorization_message = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":104
 *         self.authorization_message = None
 *         # channel binding is turned off for the time being
 *         self.client_channel_binding = b"n,,"             # <<<<<<<<<<<<<<
 *         self.client_first_message_bare = None
 *         self.client_nonce = None
 */
  __Pyx_INCREF(__pyx_kp_b_n);
  __Pyx_GIVEREF(__pyx_kp_b_n);
  __Pyx_GOTREF(__pyx_v_self->client_channel_binding);
  __Pyx_DECREF(__pyx_v_self->client_channel_binding);
  __pyx_v_self->client_channel_binding = __pyx_kp_b_n;

  /* "asyncpg/protocol/scram.pyx":105
 *         # channel binding is turned off for the time being
 *         self.client_channel_binding = b"n,,"
 *         self.client_first_message_bare = None             # <<<<<<<<<<<<<<
 *         self.client_nonce = None
 *         self.client_proof = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->client_first_message_bare);
  __Pyx_DECREF(__pyx_v_self->client_first_message_bare);
  __pyx_v_self->client_first_message_bare = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":106
 *         self.client_channel_binding = b"n,,"
 *         self.client_first_message_bare = None
 *         self.client_nonce = None             # <<<<<<<<<<<<<<
 *         self.client_proof = None
 *         self.password_salt = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->client_nonce);
  __Pyx_DECREF(__pyx_v_self->client_nonce);
  __pyx_v_self->client_nonce = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":107
 *         self.client_first_message_bare = None
 *         self.client_nonce = None
 *         self.client_proof = None             # <<<<<<<<<<<<<<
 *         self.password_salt = None
 *         # self.password_iterations = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->client_proof);
  __Pyx_DECREF(__pyx_v_self->client_proof);
  __pyx_v_self->client_proof = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":108
 *         self.client_nonce = None
 *         self.client_proof = None
 *         self.password_salt = None             # <<<<<<<<<<<<<<
 *         # self.password_iterations = None
 *         self.server_first_message = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->password_salt);
  __Pyx_DECREF(__pyx_v_self->password_salt);
  __pyx_v_self->password_salt = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":110
 *         self.password_salt = None
 *         # self.password_iterations = None
 *         self.server_first_message = None             # <<<<<<<<<<<<<<
 *         self.server_key = None
 *         self.server_nonce = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->server_first_message);
  __Pyx_DECREF(__pyx_v_self->server_first_message);
  __pyx_v_self->server_first_message = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":111
 *         # self.password_iterations = None
 *         self.server_first_message = None
 *         self.server_key = None             # <<<<<<<<<<<<<<
 *         self.server_nonce = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->server_key);
  __Pyx_DECREF(__pyx_v_self->server_key);
  __pyx_v_self->server_key = Py_None;

  /* "asyncpg/protocol/scram.pyx":112
 *         self.server_first_message = None
 *         self.server_key = None
 *         self.server_nonce = None             # <<<<<<<<<<<<<<
 * 
 *     cdef create_client_first_message(self, str username):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->server_nonce);
  __Pyx_DECREF(__pyx_v_self->server_nonce);
  __pyx_v_self->server_nonce = ((PyObject*)Py_None);

  /* "asyncpg/protocol/scram.pyx":100
 *     )
 * 
 *     def __cinit__(self, bytes authentication_method):             # <<<<<<<<<<<<<<
 *         self.authentication_method = authentication_method
 *         self.authorization_message = None
 */

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

/* "asyncpg/protocol/scram.pyx":114
 *         self.server_nonce = None
 * 
 *     cdef create_client_first_message(self, str username):             # <<<<<<<<<<<<<<
 *         """Create the initial client message for SCRAM authentication"""
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_username) {
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_v_client_first_message = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_client_first_message", 0);

  /* "asyncpg/protocol/scram.pyx":121
 * 
 *         self.client_nonce = \
 *             self._generate_client_nonce(self.DEFAULT_CLIENT_NONCE_BYTES)             # <<<<<<<<<<<<<<
 *         # set the client first message bare here, as it's used in a later step
 *         self.client_first_message_bare =  b"n=" + username.encode("utf-8") + \
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DEFAULT_CLIENT_NONCE_BYTES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_nonce(__pyx_v_self, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 121, __pyx_L1_error)

  /* "asyncpg/protocol/scram.pyx":120
 *             bytes client_first_message
 * 
 *         self.client_nonce = \             # <<<<<<<<<<<<<<
 *             self._generate_client_nonce(self.DEFAULT_CLIENT_NONCE_BYTES)
 *         # set the client first message bare here, as it's used in a later step
 */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->client_nonce);
  __Pyx_DECREF(__pyx_v_self->client_nonce);
  __pyx_v_self->client_nonce = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":123
 *             self._generate_client_nonce(self.DEFAULT_CLIENT_NONCE_BYTES)
 *         # set the client first message bare here, as it's used in a later step
 *         self.client_first_message_bare =  b"n=" + username.encode("utf-8") + \             # <<<<<<<<<<<<<<
 *             b",r=" + self.client_nonce
 *         # put together the full message here
 */
  if (unlikely(__pyx_v_username == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 123, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Add(__pyx_kp_b_n_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_kp_b_r_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":124
 *         # set the client first message bare here, as it's used in a later step
 *         self.client_first_message_bare =  b"n=" + username.encode("utf-8") + \
 *             b",r=" + self.client_nonce             # <<<<<<<<<<<<<<
 *         # put together the full message here
 *         msg = bytes()
 */
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_self->client_nonce); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 124, __pyx_L1_error)

  /* "asyncpg/protocol/scram.pyx":123
 *             self._generate_client_nonce(self.DEFAULT_CLIENT_NONCE_BYTES)
 *         # set the client first message bare here, as it's used in a later step
 *         self.client_first_message_bare =  b"n=" + username.encode("utf-8") + \             # <<<<<<<<<<<<<<
 *             b",r=" + self.client_nonce
 *         # put together the full message here
 */
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->client_first_message_bare);
  __Pyx_DECREF(__pyx_v_self->client_first_message_bare);
  __pyx_v_self->client_first_message_bare = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":126
 *             b",r=" + self.client_nonce
 *         # put together the full message here
 *         msg = bytes()             # <<<<<<<<<<<<<<
 *         msg += self.authentication_method + b"\0"
 *         client_first_message = self.client_channel_binding + \
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_msg = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":127
 *         # put together the full message here
 *         msg = bytes()
 *         msg += self.authentication_method + b"\0"             # <<<<<<<<<<<<<<
 *         client_first_message = self.client_channel_binding + \
 *             self.client_first_message_bare
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_self->authentication_method, __pyx_kp_b__26); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":128
 *         msg = bytes()
 *         msg += self.authentication_method + b"\0"
 *         client_first_message = self.client_channel_binding + \             # <<<<<<<<<<<<<<
 *             self.client_first_message_bare
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_self->client_channel_binding, __pyx_v_self->client_first_message_bare); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_client_first_message = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":130
 *         client_first_message = self.client_channel_binding + \
 *             self.client_first_message_bare
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \             # <<<<<<<<<<<<<<
 *             client_first_message
 *         return msg
 */
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_client_first_message); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 130, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_to_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_byteorder, __pyx_n_u_big) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__27, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __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;

  /* "asyncpg/protocol/scram.pyx":131
 *             self.client_first_message_bare
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \
 *             client_first_message             # <<<<<<<<<<<<<<
 *         return msg
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_client_first_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/scram.pyx":130
 *         client_first_message = self.client_channel_binding + \
 *             self.client_first_message_bare
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \             # <<<<<<<<<<<<<<
 *             client_first_message
 *         return msg
 */
  __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_5));
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/scram.pyx":132
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \
 *             client_first_message
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef create_client_final_message(self, str password):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":114
 *         self.server_nonce = None
 * 
 *     cdef create_client_first_message(self, str username):             # <<<<<<<<<<<<<<
 *         """Create the initial client message for SCRAM authentication"""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.create_client_first_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_client_first_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":134
 *         return msg
 * 
 *     cdef create_client_final_message(self, str password):             # <<<<<<<<<<<<<<
 *         """Create the final client message as part of SCRAM authentication"""
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password) {
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_8genexpr2__pyx_v_val = 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 *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_client_final_message", 0);
  __Pyx_INCREF(__pyx_v_password);

  /* "asyncpg/protocol/scram.pyx":139
 *             bytes msg
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):
 *             raise Exception(
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "asyncpg/protocol/scram.pyx":140
 * 
 *         if any([getattr(self, val) is None for val in
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):             # <<<<<<<<<<<<<<
 *             raise Exception(
 *                 "you need values from server to generate a client proof")
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_REQUIREMENTS_CLIENT_FINAL_MESSAG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 140, __pyx_L6_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 140, __pyx_L6_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        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, 140, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_val, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/scram.pyx":139
 *             bytes msg
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):
 *             raise Exception(
 */
      __pyx_t_2 = __Pyx_GetAttr(((PyObject *)__pyx_v_self), __pyx_8genexpr2__pyx_v_val); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = (__pyx_t_2 == Py_None);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 139, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_val); __pyx_8genexpr2__pyx_v_val = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_val); __pyx_8genexpr2__pyx_v_val = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_6)) {

    /* "asyncpg/protocol/scram.pyx":141
 *         if any([getattr(self, val) is None for val in
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):
 *             raise Exception(             # <<<<<<<<<<<<<<
 *                 "you need values from server to generate a client proof")
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __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, 141, __pyx_L1_error)

    /* "asyncpg/protocol/scram.pyx":139
 *             bytes msg
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):
 *             raise Exception(
 */
  }

  /* "asyncpg/protocol/scram.pyx":145
 * 
 *         # normalize the password using the SASLprep algorithm in RFC 4013
 *         password = self._normalize_password(password)             # <<<<<<<<<<<<<<
 * 
 *         # generate the client proof
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__normalize_password(__pyx_v_self, __pyx_v_password); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_password, ((PyObject*)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":148
 * 
 *         # generate the client proof
 *         self.client_proof = self._generate_client_proof(password=password)             # <<<<<<<<<<<<<<
 *         msg = bytes()
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_proof(__pyx_v_self, __pyx_v_password); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->client_proof);
  __Pyx_DECREF(__pyx_v_self->client_proof);
  __pyx_v_self->client_proof = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":149
 *         # generate the client proof
 *         self.client_proof = self._generate_client_proof(password=password)
 *         msg = bytes()             # <<<<<<<<<<<<<<
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \
 *             b",r=" + self.server_nonce + \
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyBytes_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_msg = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/scram.pyx":150
 *         self.client_proof = self._generate_client_proof(password=password)
 *         msg = bytes()
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \             # <<<<<<<<<<<<<<
 *             b",r=" + self.server_nonce + \
 *             b",p=" + base64.b64encode(self.client_proof)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_base64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_v_self->client_channel_binding) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->client_channel_binding);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_b_c_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_b_r_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":151
 *         msg = bytes()
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \
 *             b",r=" + self.server_nonce + \             # <<<<<<<<<<<<<<
 *             b",p=" + base64.b64encode(self.client_proof)
 *         return msg
 */
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_self->server_nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_b_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":152
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \
 *             b",r=" + self.server_nonce + \
 *             b",p=" + base64.b64encode(self.client_proof)             # <<<<<<<<<<<<<<
 *         return msg
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_base64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __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 && 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_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_self->client_proof) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->client_proof);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":150
 *         self.client_proof = self._generate_client_proof(password=password)
 *         msg = bytes()
 *         msg += b"c=" + base64.b64encode(self.client_channel_binding) + \             # <<<<<<<<<<<<<<
 *             b",r=" + self.server_nonce + \
 *             b",p=" + base64.b64encode(self.client_proof)
 */
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":153
 *             b",r=" + self.server_nonce + \
 *             b",p=" + base64.b64encode(self.client_proof)
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef parse_server_first_message(self, bytes server_response):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":134
 *         return msg
 * 
 *     cdef create_client_final_message(self, str password):             # <<<<<<<<<<<<<<
 *         """Create the final client message as part of SCRAM authentication"""
 *         cdef:
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.create_client_final_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_password);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":155
 *         return msg
 * 
 *     cdef parse_server_first_message(self, bytes server_response):             # <<<<<<<<<<<<<<
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_parse_server_first_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_server_response) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_server_first_message", 0);

  /* "asyncpg/protocol/scram.pyx":157
 *     cdef parse_server_first_message(self, bytes server_response):
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response             # <<<<<<<<<<<<<<
 *         try:
 *             self.server_nonce = re.search(b'r=([^,]+),',
 */
  __Pyx_INCREF(__pyx_v_server_response);
  __Pyx_GIVEREF(__pyx_v_server_response);
  __Pyx_GOTREF(__pyx_v_self->server_first_message);
  __Pyx_DECREF(__pyx_v_self->server_first_message);
  __pyx_v_self->server_first_message = __pyx_v_server_response;

  /* "asyncpg/protocol/scram.pyx":158
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response
 *         try:             # <<<<<<<<<<<<<<
 *             self.server_nonce = re.search(b'r=([^,]+),',
 *                 self.server_first_message).group(1)
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/scram.pyx":159
 *         self.server_first_message = server_response
 *         try:
 *             self.server_nonce = re.search(b'r=([^,]+),',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1)
 *         except IndexError:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_re); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 159, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_search); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/scram.pyx":160
 *         try:
 *             self.server_nonce = re.search(b'r=([^,]+),',
 *                 self.server_first_message).group(1)             # <<<<<<<<<<<<<<
 *         except IndexError:
 *             raise Exception("could not get nonce")
 */
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_b_r_3, __pyx_v_self->server_first_message};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_b_r_3, __pyx_v_self->server_first_message};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 159, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_b_r_3);
        __Pyx_GIVEREF(__pyx_kp_b_r_3);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_b_r_3);
        __Pyx_INCREF(__pyx_v_self->server_first_message);
        __Pyx_GIVEREF(__pyx_v_self->server_first_message);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self->server_first_message);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_group); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L3_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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 160, __pyx_L3_error)

      /* "asyncpg/protocol/scram.pyx":159
 *         self.server_first_message = server_response
 *         try:
 *             self.server_nonce = re.search(b'r=([^,]+),',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1)
 *         except IndexError:
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->server_nonce);
      __Pyx_DECREF(__pyx_v_self->server_nonce);
      __pyx_v_self->server_nonce = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/scram.pyx":158
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response
 *         try:             # <<<<<<<<<<<<<<
 *             self.server_nonce = re.search(b'r=([^,]+),',
 *                 self.server_first_message).group(1)
 */
    }
    __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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/scram.pyx":161
 *             self.server_nonce = re.search(b'r=([^,]+),',
 *                 self.server_first_message).group(1)
 *         except IndexError:             # <<<<<<<<<<<<<<
 *             raise Exception("could not get nonce")
 *         if not self.server_nonce.startswith(self.client_nonce):
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.parse_server_first_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 161, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_5);

      /* "asyncpg/protocol/scram.pyx":162
 *                 self.server_first_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get nonce")             # <<<<<<<<<<<<<<
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")
 */
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 162, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(0, 162, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asyncpg/protocol/scram.pyx":158
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response
 *         try:             # <<<<<<<<<<<<<<
 *             self.server_nonce = re.search(b'r=([^,]+),',
 *                 self.server_first_message).group(1)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "asyncpg/protocol/scram.pyx":163
 *         except IndexError:
 *             raise Exception("could not get nonce")
 *         if not self.server_nonce.startswith(self.client_nonce):             # <<<<<<<<<<<<<<
 *             raise Exception("invalid nonce")
 *         try:
 */
  if (unlikely(__pyx_v_self->server_nonce == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
    __PYX_ERR(0, 163, __pyx_L1_error)
  }
  __pyx_t_10 = __Pyx_PyBytes_Tailmatch(__pyx_v_self->server_nonce, __pyx_v_self->client_nonce, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 163, __pyx_L1_error)
  __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
  if (unlikely(__pyx_t_11)) {

    /* "asyncpg/protocol/scram.pyx":164
 *             raise Exception("could not get nonce")
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")             # <<<<<<<<<<<<<<
 *         try:
 *             self.password_salt = re.search(b's=([^,]+),',
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 164, __pyx_L1_error)

    /* "asyncpg/protocol/scram.pyx":163
 *         except IndexError:
 *             raise Exception("could not get nonce")
 *         if not self.server_nonce.startswith(self.client_nonce):             # <<<<<<<<<<<<<<
 *             raise Exception("invalid nonce")
 *         try:
 */
  }

  /* "asyncpg/protocol/scram.pyx":165
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_salt = re.search(b's=([^,]+),',
 *                 self.server_first_message).group(1)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "asyncpg/protocol/scram.pyx":166
 *             raise Exception("invalid nonce")
 *         try:
 *             self.password_salt = re.search(b's=([^,]+),',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1)
 *         except IndexError:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_search); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 166, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/scram.pyx":167
 *         try:
 *             self.password_salt = re.search(b's=([^,]+),',
 *                 self.server_first_message).group(1)             # <<<<<<<<<<<<<<
 *         except IndexError:
 *             raise Exception("could not get salt")
 */
      __pyx_t_4 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_b_s, __pyx_v_self->server_first_message};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L12_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_b_s, __pyx_v_self->server_first_message};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L12_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L12_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_b_s);
        __Pyx_GIVEREF(__pyx_kp_b_s);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_kp_b_s);
        __Pyx_INCREF(__pyx_v_self->server_first_message);
        __Pyx_GIVEREF(__pyx_v_self->server_first_message);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_self->server_first_message);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_group); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 167, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_int_1);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 167, __pyx_L12_error)

      /* "asyncpg/protocol/scram.pyx":166
 *             raise Exception("invalid nonce")
 *         try:
 *             self.password_salt = re.search(b's=([^,]+),',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1)
 *         except IndexError:
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_v_self->password_salt);
      __Pyx_DECREF(__pyx_v_self->password_salt);
      __pyx_v_self->password_salt = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "asyncpg/protocol/scram.pyx":165
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_salt = re.search(b's=([^,]+),',
 *                 self.server_first_message).group(1)
 */
    }
    __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_L17_try_end;
    __pyx_L12_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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/scram.pyx":168
 *             self.password_salt = re.search(b's=([^,]+),',
 *                 self.server_first_message).group(1)
 *         except IndexError:             # <<<<<<<<<<<<<<
 *             raise Exception("could not get salt")
 *         try:
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.parse_server_first_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_9, &__pyx_t_7) < 0) __PYX_ERR(0, 168, __pyx_L14_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_7);

      /* "asyncpg/protocol/scram.pyx":169
 *                 self.server_first_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get salt")             # <<<<<<<<<<<<<<
 *         try:
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 */
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L14_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 169, __pyx_L14_except_error)
    }
    goto __pyx_L14_except_error;
    __pyx_L14_except_error:;

    /* "asyncpg/protocol/scram.pyx":165
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_salt = re.search(b's=([^,]+),',
 *                 self.server_first_message).group(1)
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L17_try_end:;
  }

  /* "asyncpg/protocol/scram.pyx":170
 *         except IndexError:
 *             raise Exception("could not get salt")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 *                 self.server_first_message).group(1))
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/scram.pyx":171
 *             raise Exception("could not get salt")
 *         try:
 *             self.password_iterations = int(re.search(b'i=(\d+),?',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1))
 *         except (IndexError, TypeError, ValueError):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_search); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "asyncpg/protocol/scram.pyx":172
 *         try:
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 *                 self.server_first_message).group(1))             # <<<<<<<<<<<<<<
 *         except (IndexError, TypeError, ValueError):
 *             raise Exception("could not get iterations")
 */
      __pyx_t_5 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_b_i_d, __pyx_v_self->server_first_message};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L20_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_b_i_d, __pyx_v_self->server_first_message};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L20_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_b_i_d);
        __Pyx_GIVEREF(__pyx_kp_b_i_d);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_b_i_d);
        __Pyx_INCREF(__pyx_v_self->server_first_message);
        __Pyx_GIVEREF(__pyx_v_self->server_first_message);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_v_self->server_first_message);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_group); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 172, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/scram.pyx":171
 *             raise Exception("could not get salt")
 *         try:
 *             self.password_iterations = int(re.search(b'i=(\d+),?',             # <<<<<<<<<<<<<<
 *                 self.server_first_message).group(1))
 *         except (IndexError, TypeError, ValueError):
 */
      __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L20_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_self->password_iterations = __pyx_t_8;

      /* "asyncpg/protocol/scram.pyx":170
 *         except IndexError:
 *             raise Exception("could not get salt")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 *                 self.server_first_message).group(1))
 */
    }
    __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_L25_try_end;
    __pyx_L20_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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/scram.pyx":173
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 *                 self.server_first_message).group(1))
 *         except (IndexError, TypeError, ValueError):             # <<<<<<<<<<<<<<
 *             raise Exception("could not get iterations")
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.parse_server_first_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(0, 173, __pyx_L22_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "asyncpg/protocol/scram.pyx":174
 *                 self.server_first_message).group(1))
 *         except (IndexError, TypeError, ValueError):
 *             raise Exception("could not get iterations")             # <<<<<<<<<<<<<<
 * 
 *     cdef verify_server_final_message(self, bytes server_final_message):
 */
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L22_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 174, __pyx_L22_except_error)
    }
    goto __pyx_L22_except_error;
    __pyx_L22_except_error:;

    /* "asyncpg/protocol/scram.pyx":170
 *         except IndexError:
 *             raise Exception("could not get salt")
 *         try:             # <<<<<<<<<<<<<<
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 *                 self.server_first_message).group(1))
 */
    __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_L25_try_end:;
  }

  /* "asyncpg/protocol/scram.pyx":155
 *         return msg
 * 
 *     cdef parse_server_first_message(self, bytes server_response):             # <<<<<<<<<<<<<<
 *         """Parse the response from the first message from the server"""
 *         self.server_first_message = server_response
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.parse_server_first_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":176
 *             raise Exception("could not get iterations")
 * 
 *     cdef verify_server_final_message(self, bytes server_final_message):             # <<<<<<<<<<<<<<
 *         """Verify the final message from the server"""
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_verify_server_final_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_server_final_message) {
  PyObject *__pyx_v_server_signature = 0;
  PyObject *__pyx_v_verify_server_signature = 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;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("verify_server_final_message", 0);

  /* "asyncpg/protocol/scram.pyx":181
 *             bytes server_signature
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             server_signature = re.search(b'v=([^,]+)',
 *                 server_final_message).group(1)
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/scram.pyx":182
 * 
 *         try:
 *             server_signature = re.search(b'v=([^,]+)',             # <<<<<<<<<<<<<<
 *                 server_final_message).group(1)
 *         except IndexError:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_re); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_search); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/scram.pyx":183
 *         try:
 *             server_signature = re.search(b'v=([^,]+)',
 *                 server_final_message).group(1)             # <<<<<<<<<<<<<<
 *         except IndexError:
 *             raise Exception("could not get server signature")
 */
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_b_v, __pyx_v_server_final_message};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_b_v, __pyx_v_server_final_message};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_b_v);
        __Pyx_GIVEREF(__pyx_kp_b_v);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_b_v);
        __Pyx_INCREF(__pyx_v_server_final_message);
        __Pyx_GIVEREF(__pyx_v_server_final_message);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_server_final_message);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_group); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L3_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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 183, __pyx_L3_error)
      __pyx_v_server_signature = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/scram.pyx":181
 *             bytes server_signature
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             server_signature = re.search(b'v=([^,]+)',
 *                 server_final_message).group(1)
 */
    }
    __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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/scram.pyx":184
 *             server_signature = re.search(b'v=([^,]+)',
 *                 server_final_message).group(1)
 *         except IndexError:             # <<<<<<<<<<<<<<
 *             raise Exception("could not get server signature")
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.verify_server_final_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 184, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_5);

      /* "asyncpg/protocol/scram.pyx":185
 *                 server_final_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get server signature")             # <<<<<<<<<<<<<<
 * 
 *         verify_server_signature = hmac.new(self.server_key.digest(),
 */
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(0, 185, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asyncpg/protocol/scram.pyx":181
 *             bytes server_signature
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             server_signature = re.search(b'v=([^,]+)',
 *                 server_final_message).group(1)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "asyncpg/protocol/scram.pyx":187
 *             raise Exception("could not get server signature")
 * 
 *         verify_server_signature = hmac.new(self.server_key.digest(),             # <<<<<<<<<<<<<<
 *             self.authorization_message, self.DIGEST)
 *         # validate the server signature against the verifier
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_hmac); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_new); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->server_key, __pyx_n_s_digest); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "asyncpg/protocol/scram.pyx":188
 * 
 *         verify_server_signature = hmac.new(self.server_key.digest(),
 *             self.authorization_message, self.DIGEST)             # <<<<<<<<<<<<<<
 *         # validate the server signature against the verifier
 *         return server_signature == base64.b64encode(
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_7, __pyx_v_self->authorization_message, __pyx_t_9};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __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_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_7, __pyx_v_self->authorization_message, __pyx_t_9};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_self->authorization_message);
    __Pyx_GIVEREF(__pyx_v_self->authorization_message);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_self->authorization_message);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_verify_server_signature = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/scram.pyx":190
 *             self.authorization_message, self.DIGEST)
 *         # validate the server signature against the verifier
 *         return server_signature == base64.b64encode(             # <<<<<<<<<<<<<<
 *             verify_server_signature.digest())
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_base64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/scram.pyx":191
 *         # validate the server signature against the verifier
 *         return server_signature == base64.b64encode(
 *             verify_server_signature.digest())             # <<<<<<<<<<<<<<
 * 
 *     cdef _bytes_xor(self, bytes a, bytes b):
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_verify_server_signature, __pyx_n_s_digest); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_RichCompare(__pyx_v_server_signature, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":176
 *             raise Exception("could not get iterations")
 * 
 *     cdef verify_server_final_message(self, bytes server_final_message):             # <<<<<<<<<<<<<<
 *         """Verify the final message from the server"""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.verify_server_final_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_server_signature);
  __Pyx_XDECREF(__pyx_v_verify_server_signature);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_2generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/scram.pyx":195
 *     cdef _bytes_xor(self, bytes a, bytes b):
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))             # <<<<<<<<<<<<<<
 * 
 *     cdef _generate_client_nonce(self, int num_bytes):
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 195, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_2generator11, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_SCRAMAuthentication__bytes_xor_l, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(0, 195, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._bytes_xor.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_2generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 195, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); __PYX_ERR(0, 195, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_b)) { __Pyx_RaiseClosureNameError("b"); __PYX_ERR(0, 195, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_a);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_b);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_b);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 195, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      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, 195, __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, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_L6_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_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_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, 195, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a_i, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_b_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_b_i, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_2 = PyNumber_Xor(__pyx_cur_scope->__pyx_v_a_i, __pyx_cur_scope->__pyx_v_b_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L8_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 195, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":193
 *             verify_server_signature.digest())
 * 
 *     cdef _bytes_xor(self, bytes a, bytes b):             # <<<<<<<<<<<<<<
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *__pyx_cur_scope;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_2generator11 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_bytes_xor", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 193, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_a = __pyx_v_a;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
  __pyx_cur_scope->__pyx_v_b = __pyx_v_b;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_b);

  /* "asyncpg/protocol/scram.pyx":195
 *     cdef _bytes_xor(self, bytes a, bytes b):
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))             # <<<<<<<<<<<<<<
 * 
 *     cdef _generate_client_nonce(self, int num_bytes):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":193
 *             verify_server_signature.digest())
 * 
 *     cdef _bytes_xor(self, bytes a, bytes b):             # <<<<<<<<<<<<<<
 *         """XOR two bytestrings together"""
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._bytes_xor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10_bytes_xor_2generator11);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":197
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))
 * 
 *     cdef _generate_client_nonce(self, int num_bytes):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bytes token
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_nonce(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, int __pyx_v_num_bytes) {
  PyObject *__pyx_v_token = 0;
  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("_generate_client_nonce", 0);

  /* "asyncpg/protocol/scram.pyx":201
 *             bytes token
 * 
 *         token = generate_token_bytes(num_bytes)             # <<<<<<<<<<<<<<
 * 
 *         return base64.b64encode(token)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_generate_token_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_num_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 201, __pyx_L1_error)
  __pyx_v_token = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":203
 *         token = generate_token_bytes(num_bytes)
 * 
 *         return base64.b64encode(token)             # <<<<<<<<<<<<<<
 * 
 *     cdef _generate_client_proof(self, str password):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_base64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __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_v_token) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_token);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":197
 *         return bytes(a_i ^ b_i for a_i, b_i in zip(a, b))
 * 
 *     cdef _generate_client_nonce(self, int num_bytes):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bytes token
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._generate_client_nonce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_token);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":205
 *         return base64.b64encode(token)
 * 
 *     cdef _generate_client_proof(self, str password):             # <<<<<<<<<<<<<<
 *         """need to ensure a server response exists, i.e. """
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_proof(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password) {
  PyObject *__pyx_v_salted_password = 0;
  PyObject *__pyx_v_client_key = NULL;
  PyObject *__pyx_v_stored_key = NULL;
  PyObject *__pyx_v_client_signature = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_val = 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 *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_generate_client_proof", 0);

  /* "asyncpg/protocol/scram.pyx":210
 *             bytes salted_password
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_PROOF]):
 *             raise Exception(
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "asyncpg/protocol/scram.pyx":211
 * 
 *         if any([getattr(self, val) is None for val in
 *                 self.REQUIREMENTS_CLIENT_PROOF]):             # <<<<<<<<<<<<<<
 *             raise Exception(
 *                 "you need values from server to generate a client proof")
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_REQUIREMENTS_CLIENT_PROOF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L6_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L6_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        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, 211, __pyx_L6_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_val, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/scram.pyx":210
 *             bytes salted_password
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_PROOF]):
 *             raise Exception(
 */
      __pyx_t_2 = __Pyx_GetAttr(((PyObject *)__pyx_v_self), __pyx_8genexpr4__pyx_v_val); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = (__pyx_t_2 == Py_None);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 210, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_val); __pyx_8genexpr4__pyx_v_val = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_val); __pyx_8genexpr4__pyx_v_val = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_6)) {

    /* "asyncpg/protocol/scram.pyx":212
 *         if any([getattr(self, val) is None for val in
 *                 self.REQUIREMENTS_CLIENT_PROOF]):
 *             raise Exception(             # <<<<<<<<<<<<<<
 *                 "you need values from server to generate a client proof")
 *         # generate a salt password
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __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, 212, __pyx_L1_error)

    /* "asyncpg/protocol/scram.pyx":210
 *             bytes salted_password
 * 
 *         if any([getattr(self, val) is None for val in             # <<<<<<<<<<<<<<
 *                 self.REQUIREMENTS_CLIENT_PROOF]):
 *             raise Exception(
 */
  }

  /* "asyncpg/protocol/scram.pyx":216
 *         # generate a salt password
 *         salted_password = self._generate_salted_password(password,
 *             self.password_salt, self.password_iterations)             # <<<<<<<<<<<<<<
 *         # client key is derived from the salted password
 *         client_key = hmac.new(salted_password, b"Client Key", self.DIGEST)
 */
  __pyx_t_3 = __pyx_v_self->password_salt;
  __Pyx_INCREF(__pyx_t_3);

  /* "asyncpg/protocol/scram.pyx":215
 *                 "you need values from server to generate a client proof")
 *         # generate a salt password
 *         salted_password = self._generate_salted_password(password,             # <<<<<<<<<<<<<<
 *             self.password_salt, self.password_iterations)
 *         # client key is derived from the salted password
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_salted_password(__pyx_v_self, __pyx_v_password, ((PyObject*)__pyx_t_3), __pyx_v_self->password_iterations); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 215, __pyx_L1_error)
  __pyx_v_salted_password = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":218
 *             self.password_salt, self.password_iterations)
 *         # client key is derived from the salted password
 *         client_key = hmac.new(salted_password, b"Client Key", self.DIGEST)             # <<<<<<<<<<<<<<
 *         # this allows us to compute the stored key that is residing on the server
 *         stored_key = self.DIGEST(client_key.digest())
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_hmac); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_salted_password, __pyx_kp_b_Client_Key, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_salted_password, __pyx_kp_b_Client_Key, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_salted_password);
    __Pyx_GIVEREF(__pyx_v_salted_password);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_salted_password);
    __Pyx_INCREF(__pyx_kp_b_Client_Key);
    __Pyx_GIVEREF(__pyx_kp_b_Client_Key);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_kp_b_Client_Key);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_client_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":220
 *         client_key = hmac.new(salted_password, b"Client Key", self.DIGEST)
 *         # this allows us to compute the stored key that is residing on the server
 *         stored_key = self.DIGEST(client_key.digest())             # <<<<<<<<<<<<<<
 *         # as well as compute the server key
 *         self.server_key = hmac.new(salted_password, b"Server Key", self.DIGEST)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_key, __pyx_n_s_digest); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __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_9 = (__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_9)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __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_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_stored_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":222
 *         stored_key = self.DIGEST(client_key.digest())
 *         # as well as compute the server key
 *         self.server_key = hmac.new(salted_password, b"Server Key", self.DIGEST)             # <<<<<<<<<<<<<<
 *         # build the authorization message that will be used in the
 *         # client signature
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_hmac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_salted_password, __pyx_kp_b_Server_Key, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_salted_password, __pyx_kp_b_Server_Key, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_salted_password);
    __Pyx_GIVEREF(__pyx_v_salted_password);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_salted_password);
    __Pyx_INCREF(__pyx_kp_b_Server_Key);
    __Pyx_GIVEREF(__pyx_kp_b_Server_Key);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_kp_b_Server_Key);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->server_key);
  __Pyx_DECREF(__pyx_v_self->server_key);
  __pyx_v_self->server_key = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":227
 *         # the "c=" portion is for the channel binding, but this is not
 *         # presently implemented
 *         self.authorization_message = self.client_first_message_bare + b"," + \             # <<<<<<<<<<<<<<
 *             self.server_first_message + b",c=" + \
 *             base64.b64encode(self.client_channel_binding) + \
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_self->client_first_message_bare, __pyx_kp_b__34); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "asyncpg/protocol/scram.pyx":228
 *         # presently implemented
 *         self.authorization_message = self.client_first_message_bare + b"," + \
 *             self.server_first_message + b",c=" + \             # <<<<<<<<<<<<<<
 *             base64.b64encode(self.client_channel_binding) + \
 *             b",r=" +  self.server_nonce
 */
  __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_v_self->server_first_message); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_kp_b_c_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "asyncpg/protocol/scram.pyx":229
 *         self.authorization_message = self.client_first_message_bare + b"," + \
 *             self.server_first_message + b",c=" + \
 *             base64.b64encode(self.client_channel_binding) + \             # <<<<<<<<<<<<<<
 *             b",r=" +  self.server_nonce
 *         # sign!
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_base64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_self->client_channel_binding) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->client_channel_binding);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":228
 *         # presently implemented
 *         self.authorization_message = self.client_first_message_bare + b"," + \
 *             self.server_first_message + b",c=" + \             # <<<<<<<<<<<<<<
 *             base64.b64encode(self.client_channel_binding) + \
 *             b",r=" +  self.server_nonce
 */
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "asyncpg/protocol/scram.pyx":229
 *         self.authorization_message = self.client_first_message_bare + b"," + \
 *             self.server_first_message + b",c=" + \
 *             base64.b64encode(self.client_channel_binding) + \             # <<<<<<<<<<<<<<
 *             b",r=" +  self.server_nonce
 *         # sign!
 */
  __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_kp_b_r_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":230
 *             self.server_first_message + b",c=" + \
 *             base64.b64encode(self.client_channel_binding) + \
 *             b",r=" +  self.server_nonce             # <<<<<<<<<<<<<<
 *         # sign!
 *         client_signature = hmac.new(stored_key.digest(),
 */
  __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_v_self->server_nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 230, __pyx_L1_error)

  /* "asyncpg/protocol/scram.pyx":227
 *         # the "c=" portion is for the channel binding, but this is not
 *         # presently implemented
 *         self.authorization_message = self.client_first_message_bare + b"," + \             # <<<<<<<<<<<<<<
 *             self.server_first_message + b",c=" + \
 *             base64.b64encode(self.client_channel_binding) + \
 */
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->authorization_message);
  __Pyx_DECREF(__pyx_v_self->authorization_message);
  __pyx_v_self->authorization_message = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":232
 *             b",r=" +  self.server_nonce
 *         # sign!
 *         client_signature = hmac.new(stored_key.digest(),             # <<<<<<<<<<<<<<
 *             self.authorization_message, self.DIGEST)
 *         # and the proof
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_hmac); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stored_key, __pyx_n_s_digest); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __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_9 = (__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_9)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "asyncpg/protocol/scram.pyx":233
 *         # sign!
 *         client_signature = hmac.new(stored_key.digest(),
 *             self.authorization_message, self.DIGEST)             # <<<<<<<<<<<<<<
 *         # and the proof
 *         return self._bytes_xor(client_key.digest(), client_signature.digest())
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_9, __pyx_v_self->authorization_message, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_9, __pyx_v_self->authorization_message, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_self->authorization_message);
    __Pyx_GIVEREF(__pyx_v_self->authorization_message);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_self->authorization_message);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_7);
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_client_signature = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":235
 *             self.authorization_message, self.DIGEST)
 *         # and the proof
 *         return self._bytes_xor(client_key.digest(), client_signature.digest())             # <<<<<<<<<<<<<<
 * 
 *     cdef _generate_salted_password(self, str password, bytes salt, int iterations):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_key, __pyx_n_s_digest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 235, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_signature, __pyx_n_s_digest); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 235, __pyx_L1_error)
  __pyx_t_10 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor(__pyx_v_self, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":205
 *         return base64.b64encode(token)
 * 
 *     cdef _generate_client_proof(self, str password):             # <<<<<<<<<<<<<<
 *         """need to ensure a server response exists, i.e. """
 *         cdef:
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._generate_client_proof", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_salted_password);
  __Pyx_XDECREF(__pyx_v_client_key);
  __Pyx_XDECREF(__pyx_v_stored_key);
  __Pyx_XDECREF(__pyx_v_client_signature);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":237
 *         return self._bytes_xor(client_key.digest(), client_signature.digest())
 * 
 *     cdef _generate_salted_password(self, str password, bytes salt, int iterations):             # <<<<<<<<<<<<<<
 *         """This follows the "Hi" algorithm specified in RFC5802"""
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_salted_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_password, PyObject *__pyx_v_salt, int __pyx_v_iterations) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_u = 0;
  PyObject *__pyx_v_ui = NULL;
  CYTHON_UNUSED long __pyx_v_x;
  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;
  long __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_generate_salted_password", 0);

  /* "asyncpg/protocol/scram.pyx":246
 *         # convert the password to a binary string - UTF8 is safe for SASL
 *         # (though there are SASLPrep rules)
 *         p = password.encode("utf8")             # <<<<<<<<<<<<<<
 *         # the salt needs to be base64 decoded -- full binary must be used
 *         s = base64.b64decode(salt)
 */
  if (unlikely(__pyx_v_password == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(0, 246, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":248
 *         p = password.encode("utf8")
 *         # the salt needs to be base64 decoded -- full binary must be used
 *         s = base64.b64decode(salt)             # <<<<<<<<<<<<<<
 *         # the initial signature is the salt with a terminator of a 32-bit string
 *         # ending in 1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_base64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_b64decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __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_v_salt) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_salt);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 248, __pyx_L1_error)
  __pyx_v_s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":251
 *         # the initial signature is the salt with a terminator of a 32-bit string
 *         # ending in 1
 *         ui = hmac.new(p, s + b'\x00\x00\x00\x01', self.DIGEST)             # <<<<<<<<<<<<<<
 *         # grab the initial digest
 *         u = ui.digest()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_hmac); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_v_s, __pyx_kp_b__35); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_DIGEST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __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_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_p, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_p, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_p);
    __Pyx_GIVEREF(__pyx_v_p);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_p);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ui = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":253
 *         ui = hmac.new(p, s + b'\x00\x00\x00\x01', self.DIGEST)
 *         # grab the initial digest
 *         u = ui.digest()             # <<<<<<<<<<<<<<
 *         # for X number of iterations, recompute the HMAC signature against the
 *         # password and the latest iteration of the hash, and XOR it with the
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ui, __pyx_n_s_digest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_v_u = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/scram.pyx":257
 *         # password and the latest iteration of the hash, and XOR it with the
 *         # previous version
 *         for x in range(iterations - 1):             # <<<<<<<<<<<<<<
 *             ui = hmac.new(p, ui.digest(), hashlib.sha256)
 *             # this is a fancy way of XORing two byte strings together
 */
  __pyx_t_8 = (__pyx_v_iterations - 1);
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_x = __pyx_t_10;

    /* "asyncpg/protocol/scram.pyx":258
 *         # previous version
 *         for x in range(iterations - 1):
 *             ui = hmac.new(p, ui.digest(), hashlib.sha256)             # <<<<<<<<<<<<<<
 *             # this is a fancy way of XORing two byte strings together
 *             u = self._bytes_xor(u, ui.digest())
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_hmac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ui, __pyx_n_s_digest); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __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_2 = (__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_2)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sha256); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_p, __pyx_t_2, __pyx_t_3};
      __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, 258, __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;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_p, __pyx_t_2, __pyx_t_3};
      __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, 258, __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;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __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_SET(__pyx_v_ui, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/scram.pyx":260
 *             ui = hmac.new(p, ui.digest(), hashlib.sha256)
 *             # this is a fancy way of XORing two byte strings together
 *             u = self._bytes_xor(u, ui.digest())             # <<<<<<<<<<<<<<
 *         return u
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_ui, __pyx_n_s_digest); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __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_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 260, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor(__pyx_v_self, __pyx_v_u, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_u, ((PyObject*)__pyx_t_7));
    __pyx_t_7 = 0;
  }

  /* "asyncpg/protocol/scram.pyx":261
 *             # this is a fancy way of XORing two byte strings together
 *             u = self._bytes_xor(u, ui.digest())
 *         return u             # <<<<<<<<<<<<<<
 * 
 *     cdef _normalize_password(self, str original_password):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_u);
  __pyx_r = __pyx_v_u;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":237
 *         return self._bytes_xor(client_key.digest(), client_signature.digest())
 * 
 *     cdef _generate_salted_password(self, str password, bytes salt, int iterations):             # <<<<<<<<<<<<<<
 *         """This follows the "Hi" algorithm specified in RFC5802"""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._generate_salted_password", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_XDECREF(__pyx_v_ui);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_2generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/scram.pyx":294
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c             # <<<<<<<<<<<<<<
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 *         )
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 294, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_2generator12, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_SCRAMAuthentication__normalize_p, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(0, 294, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._normalize_password.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_2generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 294, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);

  /* "asyncpg/protocol/scram.pyx":295
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password)) { __Pyx_RaiseClosureNameError("normalized_password"); __PYX_ERR(0, 295, __pyx_L1_error) }
  __pyx_t_1 = PySequence_Tuple(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 295, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_in_table_b1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __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 && unlikely(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_cur_scope->__pyx_v_c) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((!__pyx_t_6) != 0);
    if (__pyx_t_7) {

      /* "asyncpg/protocol/scram.pyx":294
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c             # <<<<<<<<<<<<<<
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 *         )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_in_table_c12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_cur_scope->__pyx_v_c) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_cur_scope->__pyx_v_c);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        __Pyx_INCREF(__pyx_kp_u__36);
        __pyx_t_1 = __pyx_kp_u__36;
      } else {
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_c);
        __pyx_t_1 = __pyx_cur_scope->__pyx_v_c;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/scram.pyx":295
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/scram.pyx":294
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c             # <<<<<<<<<<<<<<
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 *         )
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_5generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 320, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_5generator13, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_SCRAMAuthentication__normalize_p, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._normalize_password.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_5generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 320, __pyx_L1_error)

  /* "asyncpg/protocol/scram.pyx":321
 *             if any(
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 321, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_SASLPREP_PROHIBITED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 321, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 321, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 321, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_in_prohibited_table);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_in_prohibited_table, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_c)) { __Pyx_RaiseClosureNameError("c"); __PYX_ERR(0, 320, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_in_prohibited_table);
    __pyx_t_5 = __pyx_cur_scope->__pyx_v_in_prohibited_table; __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_cur_scope->__pyx_outer_scope->__pyx_v_c) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_c);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "asyncpg/protocol/scram.pyx":319
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:
 *             if any(             # <<<<<<<<<<<<<<
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 */
      __Pyx_XDECREF(__pyx_r);

      /* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "asyncpg/protocol/scram.pyx":321
 *             if any(
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
  }
  /*else*/ {

    /* "asyncpg/protocol/scram.pyx":319
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:
 *             if any(             # <<<<<<<<<<<<<<
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 */
    __Pyx_XDECREF(__pyx_r);

    /* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/scram.pyx":321
 *             if any(
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_8generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/scram.pyx":334
 *         #    character must be the first and last character of the string
 *         # RandALCat characters are found in table D.1, whereas LCat are in D.2
 *         if any(stringprep.in_table_d1(c) for c in normalized_password_tuple):             # <<<<<<<<<<<<<<
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_6genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 334, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_8generator14, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_SCRAMAuthentication__normalize_p, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._normalize_password.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_8generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 334, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple)) { __Pyx_RaiseClosureNameError("normalized_password_tuple"); __PYX_ERR(0, 334, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 334, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_in_table_d1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __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 && unlikely(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_cur_scope->__pyx_v_c) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_11generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/scram.pyx":343
 *             # if any characters are in D.2, use the original password
 *             if any(
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_9genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 343, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_11generator15, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_SCRAMAuthentication__normalize_p, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._normalize_password.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_11generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple)) { __Pyx_RaiseClosureNameError("normalized_password_tuple"); __PYX_ERR(0, 343, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 343, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_normalized_password_tuple; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_in_table_d2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __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 && unlikely(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_cur_scope->__pyx_v_c) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "asyncpg/protocol/scram.pyx":342
 * 
 *             # if any characters are in D.2, use the original password
 *             if any(             # <<<<<<<<<<<<<<
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple
 *             ):
 */
      __Pyx_XDECREF(__pyx_r);

      /* "asyncpg/protocol/scram.pyx":343
 *             # if any characters are in D.2, use the original password
 *             if any(
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "asyncpg/protocol/scram.pyx":342
 * 
 *             # if any characters are in D.2, use the original password
 *             if any(             # <<<<<<<<<<<<<<
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple
 *             ):
 */
    __Pyx_XDECREF(__pyx_r);

    /* "asyncpg/protocol/scram.pyx":343
 *             # if any characters are in D.2, use the original password
 *             if any(
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pyx":263
 *         return u
 * 
 *     cdef _normalize_password(self, str original_password):             # <<<<<<<<<<<<<<
 *         """Normalize the password using the SASLprep from RFC4013"""
 *         cdef:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__normalize_password(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self, PyObject *__pyx_v_original_password) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_cur_scope;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_2generator12 = 0;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_5generator13 = 0;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_8generator14 = 0;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_11generator15 = 0;
  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;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_normalize_password", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 263, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "asyncpg/protocol/scram.pyx":278
 *         # https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/common/saslprep.c
 *         # using the `pg_saslprep` function
 *         normalized_password = original_password             # <<<<<<<<<<<<<<
 *         # if the original password is an ASCII string or fails to encode as a
 *         # UTF-8 string, then no further action is needed
 */
  __Pyx_INCREF(__pyx_v_original_password);
  __Pyx_GIVEREF(__pyx_v_original_password);
  __pyx_cur_scope->__pyx_v_normalized_password = __pyx_v_original_password;

  /* "asyncpg/protocol/scram.pyx":281
 *         # if the original password is an ASCII string or fails to encode as a
 *         # UTF-8 string, then no further action is needed
 *         try:             # <<<<<<<<<<<<<<
 *             original_password.encode("ascii")
 *         except UnicodeEncodeError:
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/scram.pyx":282
 *         # UTF-8 string, then no further action is needed
 *         try:
 *             original_password.encode("ascii")             # <<<<<<<<<<<<<<
 *         except UnicodeEncodeError:
 *             pass
 */
      if (unlikely(__pyx_v_original_password == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
        __PYX_ERR(0, 282, __pyx_L3_error)
      }
      __pyx_t_4 = PyUnicode_AsASCIIString(__pyx_v_original_password); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/scram.pyx":281
 *         # if the original password is an ASCII string or fails to encode as a
 *         # UTF-8 string, then no further action is needed
 *         try:             # <<<<<<<<<<<<<<
 *             original_password.encode("ascii")
 *         except UnicodeEncodeError:
 */
    }

    /* "asyncpg/protocol/scram.pyx":286
 *             pass
 *         else:
 *             return original_password             # <<<<<<<<<<<<<<
 * 
 *         # Step 1 of SASLPrep: Map. Per the algorithm, we map non-ascii space
 */
    /*else:*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_original_password);
      __pyx_r = __pyx_v_original_password;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/scram.pyx":283
 *         try:
 *             original_password.encode("ascii")
 *         except UnicodeEncodeError:             # <<<<<<<<<<<<<<
 *             pass
 *         else:
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeEncodeError);
    if (__pyx_t_5) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asyncpg/protocol/scram.pyx":281
 *         # if the original password is an ASCII string or fails to encode as a
 *         # UTF-8 string, then no further action is needed
 *         try:             # <<<<<<<<<<<<<<
 *             original_password.encode("ascii")
 *         except UnicodeEncodeError:
 */
    __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_L4_exception_handled:;
    __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);
  }

  /* "asyncpg/protocol/scram.pyx":294
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(
 *             ' ' if stringprep.in_table_c12(c) else c             # <<<<<<<<<<<<<<
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 *         )
 */
  __pyx_t_4 = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "asyncpg/protocol/scram.pyx":293
 *         # Table C.1.2 -- non-ASCII spaces
 *         # Table B.1 -- "Commonly mapped to nothing"
 *         normalized_password = u"".join(             # <<<<<<<<<<<<<<
 *             ' ' if stringprep.in_table_c12(c) else c
 *             for c in tuple(normalized_password) if not stringprep.in_table_b1(c)
 */
  __pyx_t_6 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__37, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_normalized_password);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_normalized_password, ((PyObject*)__pyx_t_4));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/scram.pyx":300
 *         # If at this point the password is empty, PostgreSQL uses the original
 *         # password
 *         if not normalized_password:             # <<<<<<<<<<<<<<
 *             return original_password
 * 
 */
  __pyx_t_7 = (__pyx_cur_scope->__pyx_v_normalized_password != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_cur_scope->__pyx_v_normalized_password) != 0);
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {

    /* "asyncpg/protocol/scram.pyx":301
 *         # password
 *         if not normalized_password:
 *             return original_password             # <<<<<<<<<<<<<<
 * 
 *         # Step 2 of SASLPrep: Normalize. Normalize the password using the
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_original_password);
    __pyx_r = __pyx_v_original_password;
    goto __pyx_L0;

    /* "asyncpg/protocol/scram.pyx":300
 *         # If at this point the password is empty, PostgreSQL uses the original
 *         # password
 *         if not normalized_password:             # <<<<<<<<<<<<<<
 *             return original_password
 * 
 */
  }

  /* "asyncpg/protocol/scram.pyx":305
 *         # Step 2 of SASLPrep: Normalize. Normalize the password using the
 *         # Unicode normalization algorithm to NFKC form
 *         normalized_password = unicodedata.normalize('NFKC', normalized_password)             # <<<<<<<<<<<<<<
 * 
 *         # If the password is not empty, PostgreSQL uses the original password
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_unicodedata); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_normalize); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_u_NFKC, __pyx_cur_scope->__pyx_v_normalized_password};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_u_NFKC, __pyx_cur_scope->__pyx_v_normalized_password};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_NFKC);
    __Pyx_GIVEREF(__pyx_n_u_NFKC);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_n_u_NFKC);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_normalized_password);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_normalized_password);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_normalized_password);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_normalized_password);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_normalized_password, ((PyObject*)__pyx_t_4));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/scram.pyx":308
 * 
 *         # If the password is not empty, PostgreSQL uses the original password
 *         if not normalized_password:             # <<<<<<<<<<<<<<
 *             return original_password
 * 
 */
  __pyx_t_8 = (__pyx_cur_scope->__pyx_v_normalized_password != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_cur_scope->__pyx_v_normalized_password) != 0);
  __pyx_t_7 = ((!__pyx_t_8) != 0);
  if (__pyx_t_7) {

    /* "asyncpg/protocol/scram.pyx":309
 *         # If the password is not empty, PostgreSQL uses the original password
 *         if not normalized_password:
 *             return original_password             # <<<<<<<<<<<<<<
 * 
 *         normalized_password_tuple = tuple(normalized_password)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_original_password);
    __pyx_r = __pyx_v_original_password;
    goto __pyx_L0;

    /* "asyncpg/protocol/scram.pyx":308
 * 
 *         # If the password is not empty, PostgreSQL uses the original password
 *         if not normalized_password:             # <<<<<<<<<<<<<<
 *             return original_password
 * 
 */
  }

  /* "asyncpg/protocol/scram.pyx":311
 *             return original_password
 * 
 *         normalized_password_tuple = tuple(normalized_password)             # <<<<<<<<<<<<<<
 * 
 *         # Step 3 of SASLPrep: Prohobited characters. If PostgreSQL detects any
 */
  __pyx_t_4 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_normalized_password); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_normalized_password_tuple = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/scram.pyx":318
 *         # We also include "unassigned code points" in the prohibited character
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:             # <<<<<<<<<<<<<<
 *             if any(
 *                 in_prohibited_table(c)
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_normalized_password_tuple; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0;
  for (;;) {
    if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_9); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 318, __pyx_L1_error)
    #else
    __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_9 = 0;

    /* "asyncpg/protocol/scram.pyx":320
 *         for c in normalized_password_tuple:
 *             if any(
 *                 in_prohibited_table(c)             # <<<<<<<<<<<<<<
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 */
    __pyx_t_9 = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_Generator_Next(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "asyncpg/protocol/scram.pyx":319
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:
 *             if any(             # <<<<<<<<<<<<<<
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 */
    if (__pyx_t_7) {

      /* "asyncpg/protocol/scram.pyx":323
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 *             ):
 *                 return original_password             # <<<<<<<<<<<<<<
 * 
 *         # Step 4 of SASLPrep: Bi-directional characters. PostgreSQL follows the
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_original_password);
      __pyx_r = __pyx_v_original_password;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "asyncpg/protocol/scram.pyx":319
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:
 *             if any(             # <<<<<<<<<<<<<<
 *                 in_prohibited_table(c)
 *                 for in_prohibited_table in self.SASLPREP_PROHIBITED
 */
    }

    /* "asyncpg/protocol/scram.pyx":318
 *         # We also include "unassigned code points" in the prohibited character
 *         # category as PostgreSQL does the same
 *         for c in normalized_password_tuple:             # <<<<<<<<<<<<<<
 *             if any(
 *                 in_prohibited_table(c)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/scram.pyx":334
 *         #    character must be the first and last character of the string
 *         # RandALCat characters are found in table D.1, whereas LCat are in D.2
 *         if any(stringprep.in_table_d1(c) for c in normalized_password_tuple):             # <<<<<<<<<<<<<<
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 */
  __pyx_t_4 = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_6genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_Generator_Next(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_7) {

    /* "asyncpg/protocol/scram.pyx":337
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 *             if not (stringprep.in_table_d1(normalized_password_tuple[0]) and             # <<<<<<<<<<<<<<
 *                     stringprep.in_table_d1(normalized_password_tuple[-1])):
 *                 return original_password
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_in_table_d1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_cur_scope->__pyx_v_normalized_password_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_10 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L16_bool_binop_done;
    }

    /* "asyncpg/protocol/scram.pyx":338
 *             # return the original password
 *             if not (stringprep.in_table_d1(normalized_password_tuple[0]) and
 *                     stringprep.in_table_d1(normalized_password_tuple[-1])):             # <<<<<<<<<<<<<<
 *                 return original_password
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_in_table_d1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_cur_scope->__pyx_v_normalized_password_tuple, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_10 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L16_bool_binop_done:;

    /* "asyncpg/protocol/scram.pyx":337
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 *             if not (stringprep.in_table_d1(normalized_password_tuple[0]) and             # <<<<<<<<<<<<<<
 *                     stringprep.in_table_d1(normalized_password_tuple[-1])):
 *                 return original_password
 */
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (__pyx_t_8) {

      /* "asyncpg/protocol/scram.pyx":339
 *             if not (stringprep.in_table_d1(normalized_password_tuple[0]) and
 *                     stringprep.in_table_d1(normalized_password_tuple[-1])):
 *                 return original_password             # <<<<<<<<<<<<<<
 * 
 *             # if any characters are in D.2, use the original password
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_original_password);
      __pyx_r = __pyx_v_original_password;
      goto __pyx_L0;

      /* "asyncpg/protocol/scram.pyx":337
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 *             if not (stringprep.in_table_d1(normalized_password_tuple[0]) and             # <<<<<<<<<<<<<<
 *                     stringprep.in_table_d1(normalized_password_tuple[-1])):
 *                 return original_password
 */
    }

    /* "asyncpg/protocol/scram.pyx":343
 *             # if any characters are in D.2, use the original password
 *             if any(
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple             # <<<<<<<<<<<<<<
 *             ):
 *                 return original_password
 */
    __pyx_t_10 = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_9genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/scram.pyx":342
 * 
 *             # if any characters are in D.2, use the original password
 *             if any(             # <<<<<<<<<<<<<<
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple
 *             ):
 */
    if (__pyx_t_8) {

      /* "asyncpg/protocol/scram.pyx":345
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple
 *             ):
 *                 return original_password             # <<<<<<<<<<<<<<
 * 
 *         # return the normalized password
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_original_password);
      __pyx_r = __pyx_v_original_password;
      goto __pyx_L0;

      /* "asyncpg/protocol/scram.pyx":342
 * 
 *             # if any characters are in D.2, use the original password
 *             if any(             # <<<<<<<<<<<<<<
 *                 stringprep.in_table_d2(c) for c in normalized_password_tuple
 *             ):
 */
    }

    /* "asyncpg/protocol/scram.pyx":334
 *         #    character must be the first and last character of the string
 *         # RandALCat characters are found in table D.1, whereas LCat are in D.2
 *         if any(stringprep.in_table_d1(c) for c in normalized_password_tuple):             # <<<<<<<<<<<<<<
 *             # if the first character or the last character are not in D.1,
 *             # return the original password
 */
  }

  /* "asyncpg/protocol/scram.pyx":348
 * 
 *         # return the normalized password
 *         return normalized_password             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_normalized_password);
  __pyx_r = __pyx_cur_scope->__pyx_v_normalized_password;
  goto __pyx_L0;

  /* "asyncpg/protocol/scram.pyx":263
 *         return u
 * 
 *     cdef _normalize_password(self, str original_password):             # <<<<<<<<<<<<<<
 *         """Normalize the password using the SASLprep from RFC4013"""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication._normalize_password", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_2generator12);
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_5generator13);
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_8generator14);
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19_normalize_password_11generator15);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pxd":10
 * cdef class SCRAMAuthentication:
 *     cdef:
 *         readonly bytes authentication_method             # <<<<<<<<<<<<<<
 *         readonly bytes authorization_message
 *         readonly bytes client_channel_binding
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->authentication_method);
  __pyx_r = __pyx_v_self->authentication_method;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":11
 *     cdef:
 *         readonly bytes authentication_method
 *         readonly bytes authorization_message             # <<<<<<<<<<<<<<
 *         readonly bytes client_channel_binding
 *         readonly bytes client_first_message_bare
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->authorization_message);
  __pyx_r = __pyx_v_self->authorization_message;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":12
 *         readonly bytes authentication_method
 *         readonly bytes authorization_message
 *         readonly bytes client_channel_binding             # <<<<<<<<<<<<<<
 *         readonly bytes client_first_message_bare
 *         readonly bytes client_nonce
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->client_channel_binding);
  __pyx_r = __pyx_v_self->client_channel_binding;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":13
 *         readonly bytes authorization_message
 *         readonly bytes client_channel_binding
 *         readonly bytes client_first_message_bare             # <<<<<<<<<<<<<<
 *         readonly bytes client_nonce
 *         readonly bytes client_proof
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->client_first_message_bare);
  __pyx_r = __pyx_v_self->client_first_message_bare;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":14
 *         readonly bytes client_channel_binding
 *         readonly bytes client_first_message_bare
 *         readonly bytes client_nonce             # <<<<<<<<<<<<<<
 *         readonly bytes client_proof
 *         readonly bytes password_salt
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->client_nonce);
  __pyx_r = __pyx_v_self->client_nonce;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":15
 *         readonly bytes client_first_message_bare
 *         readonly bytes client_nonce
 *         readonly bytes client_proof             # <<<<<<<<<<<<<<
 *         readonly bytes password_salt
 *         readonly int   password_iterations
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->client_proof);
  __pyx_r = __pyx_v_self->client_proof;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":16
 *         readonly bytes client_nonce
 *         readonly bytes client_proof
 *         readonly bytes password_salt             # <<<<<<<<<<<<<<
 *         readonly int   password_iterations
 *         readonly bytes server_first_message
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->password_salt);
  __pyx_r = __pyx_v_self->password_salt;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":17
 *         readonly bytes client_proof
 *         readonly bytes password_salt
 *         readonly int   password_iterations             # <<<<<<<<<<<<<<
 *         readonly bytes server_first_message
 *         # server_key is an instance of hmac.HAMC
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->password_iterations); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.SCRAMAuthentication.password_iterations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/scram.pxd":18
 *         readonly bytes password_salt
 *         readonly int   password_iterations
 *         readonly bytes server_first_message             # <<<<<<<<<<<<<<
 *         # server_key is an instance of hmac.HAMC
 *         readonly object server_key
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->server_first_message);
  __pyx_r = __pyx_v_self->server_first_message;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":20
 *         readonly bytes server_first_message
 *         # server_key is an instance of hmac.HAMC
 *         readonly object server_key             # <<<<<<<<<<<<<<
 *         readonly bytes server_nonce
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->server_key);
  __pyx_r = __pyx_v_self->server_key;
  goto __pyx_L0;

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

/* "asyncpg/protocol/scram.pxd":21
 *         # server_key is an instance of hmac.HAMC
 *         readonly object server_key
 *         readonly bytes server_nonce             # <<<<<<<<<<<<<<
 * 
 *     cdef create_client_first_message(self, str username)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->server_nonce);
  __pyx_r = __pyx_v_self->server_nonce;
  goto __pyx_L0;

  /* function exit code */
  __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_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_3__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_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_2__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__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__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.SCRAMAuthentication.__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_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_5__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_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_4__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *__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__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.SCRAMAuthentication.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":16
 * cdef class CoreProtocol:
 * 
 *     def __init__(self, con_params):             # <<<<<<<<<<<<<<
 *         # type of `con_params` is `_ConnectionParameters`
 *         self.buffer = ReadBuffer()
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_con_params = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_con_params,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_con_params)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(6, 16, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_con_params = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 16, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol___init__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_v_con_params);

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

static int __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_con_params) {
  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("__init__", 0);

  /* "asyncpg/protocol/coreproto.pyx":18
 *     def __init__(self, con_params):
 *         # type of `con_params` is `_ConnectionParameters`
 *         self.buffer = ReadBuffer()             # <<<<<<<<<<<<<<
 *         self.user = con_params.user
 *         self.password = con_params.password
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->buffer);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->buffer));
  __pyx_v_self->buffer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":19
 *         # type of `con_params` is `_ConnectionParameters`
 *         self.buffer = ReadBuffer()
 *         self.user = con_params.user             # <<<<<<<<<<<<<<
 *         self.password = con_params.password
 *         self.auth_msg = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_con_params, __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_user, __pyx_t_1) < 0) __PYX_ERR(6, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":20
 *         self.buffer = ReadBuffer()
 *         self.user = con_params.user
 *         self.password = con_params.password             # <<<<<<<<<<<<<<
 *         self.auth_msg = None
 *         self.con_params = con_params
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_con_params, __pyx_n_s_password); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_password, __pyx_t_1) < 0) __PYX_ERR(6, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":21
 *         self.user = con_params.user
 *         self.password = con_params.password
 *         self.auth_msg = None             # <<<<<<<<<<<<<<
 *         self.con_params = con_params
 *         self.con_status = CONNECTION_BAD
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, Py_None) < 0) __PYX_ERR(6, 21, __pyx_L1_error)

  /* "asyncpg/protocol/coreproto.pyx":22
 *         self.password = con_params.password
 *         self.auth_msg = None
 *         self.con_params = con_params             # <<<<<<<<<<<<<<
 *         self.con_status = CONNECTION_BAD
 *         self.state = PROTOCOL_IDLE
 */
  __Pyx_INCREF(__pyx_v_con_params);
  __Pyx_GIVEREF(__pyx_v_con_params);
  __Pyx_GOTREF(__pyx_v_self->con_params);
  __Pyx_DECREF(__pyx_v_self->con_params);
  __pyx_v_self->con_params = __pyx_v_con_params;

  /* "asyncpg/protocol/coreproto.pyx":23
 *         self.auth_msg = None
 *         self.con_params = con_params
 *         self.con_status = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *         self.state = PROTOCOL_IDLE
 *         self.xact_status = PQTRANS_IDLE
 */
  __pyx_v_self->con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD;

  /* "asyncpg/protocol/coreproto.pyx":24
 *         self.con_params = con_params
 *         self.con_status = CONNECTION_BAD
 *         self.state = PROTOCOL_IDLE             # <<<<<<<<<<<<<<
 *         self.xact_status = PQTRANS_IDLE
 *         self.encoding = 'utf-8'
 */
  __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE;

  /* "asyncpg/protocol/coreproto.pyx":25
 *         self.con_status = CONNECTION_BAD
 *         self.state = PROTOCOL_IDLE
 *         self.xact_status = PQTRANS_IDLE             # <<<<<<<<<<<<<<
 *         self.encoding = 'utf-8'
 *         # type of `scram` is `SCRAMAuthentcation`
 */
  __pyx_v_self->xact_status = __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_IDLE;

  /* "asyncpg/protocol/coreproto.pyx":26
 *         self.state = PROTOCOL_IDLE
 *         self.xact_status = PQTRANS_IDLE
 *         self.encoding = 'utf-8'             # <<<<<<<<<<<<<<
 *         # type of `scram` is `SCRAMAuthentcation`
 *         self.scram = None
 */
  __Pyx_INCREF(__pyx_kp_u_utf_8);
  __Pyx_GIVEREF(__pyx_kp_u_utf_8);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = __pyx_kp_u_utf_8;

  /* "asyncpg/protocol/coreproto.pyx":28
 *         self.encoding = 'utf-8'
 *         # type of `scram` is `SCRAMAuthentcation`
 *         self.scram = None             # <<<<<<<<<<<<<<
 * 
 *         self._reset_result()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->scram);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->scram));
  __pyx_v_self->scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":30
 *         self.scram = None
 * 
 *         self._reset_result()             # <<<<<<<<<<<<<<
 * 
 *     cpdef is_in_transaction(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_reset_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":16
 * cdef class CoreProtocol:
 * 
 *     def __init__(self, con_params):             # <<<<<<<<<<<<<<
 *         # type of `con_params` is `_ConnectionParameters`
 *         self.buffer = ReadBuffer()
 */

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

/* "asyncpg/protocol/coreproto.pyx":32
 *         self._reset_result()
 * 
 *     cpdef is_in_transaction(self):             # <<<<<<<<<<<<<<
 *         # PQTRANS_INTRANS = idle, within transaction block
 *         # PQTRANS_INERROR = idle, within failed transaction
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_3is_in_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol_is_in_transaction(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_in_transaction", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_in_transaction); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_3is_in_transaction)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __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(6, 32, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "asyncpg/protocol/coreproto.pyx":35
 *         # PQTRANS_INTRANS = idle, within transaction block
 *         # PQTRANS_INERROR = idle, within failed transaction
 *         return self.xact_status in (PQTRANS_INTRANS, PQTRANS_INERROR)             # <<<<<<<<<<<<<<
 * 
 *     cdef _read_server_messages(self):
 */
  __Pyx_XDECREF(__pyx_r);
  switch (__pyx_v_self->xact_status) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INTRANS:
    case __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INERROR:
    __pyx_t_5 = 1;
    break;
    default:
    __pyx_t_5 = 0;
    break;
  }
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":32
 *         self._reset_result()
 * 
 *     cpdef is_in_transaction(self):             # <<<<<<<<<<<<<<
 *         # PQTRANS_INTRANS = idle, within transaction block
 *         # PQTRANS_INERROR = idle, within failed transaction
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.is_in_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_3is_in_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_3is_in_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_in_transaction (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_2is_in_transaction(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_2is_in_transaction(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__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("is_in_transaction", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol_is_in_transaction(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.is_in_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":37
 *         return self.xact_status in (PQTRANS_INTRANS, PQTRANS_INERROR)
 * 
 *     cdef _read_server_messages(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char mtype
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__read_server_messages(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  char __pyx_v_mtype;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_v_state;
  __pyx_t_7asyncpg_7pgproto_7pgproto_take_message_method __pyx_v_take_message;
  __pyx_t_7asyncpg_7pgproto_7pgproto_get_message_type_method __pyx_v_get_message_type;
  PyObject *__pyx_v_ex = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_UCS4 __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  char const *__pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_read_server_messages", 0);

  /* "asyncpg/protocol/coreproto.pyx":42
 *             ProtocolState state
 *             pgproto.take_message_method take_message = \
 *                 <pgproto.take_message_method>self.buffer.take_message             # <<<<<<<<<<<<<<
 *             pgproto.get_message_type_method get_message_type= \
 *                 <pgproto.get_message_type_method>self.buffer.get_message_type
 */
  __pyx_v_take_message = ((__pyx_t_7asyncpg_7pgproto_7pgproto_take_message_method)((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->take_message);

  /* "asyncpg/protocol/coreproto.pyx":44
 *                 <pgproto.take_message_method>self.buffer.take_message
 *             pgproto.get_message_type_method get_message_type= \
 *                 <pgproto.get_message_type_method>self.buffer.get_message_type             # <<<<<<<<<<<<<<
 * 
 *         while take_message(self.buffer) == 1:
 */
  __pyx_v_get_message_type = ((__pyx_t_7asyncpg_7pgproto_7pgproto_get_message_type_method)__pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_type);

  /* "asyncpg/protocol/coreproto.pyx":46
 *                 <pgproto.get_message_type_method>self.buffer.get_message_type
 * 
 *         while take_message(self.buffer) == 1:             # <<<<<<<<<<<<<<
 *             mtype = get_message_type(self.buffer)
 *             state = self.state
 */
  while (1) {
    __pyx_t_1 = ((PyObject *)__pyx_v_self->buffer);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __pyx_v_take_message(__pyx_t_1); if (unlikely(__pyx_t_2 == ((int32_t)-1))) __PYX_ERR(6, 46, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = ((__pyx_t_2 == 1) != 0);
    if (!__pyx_t_3) break;

    /* "asyncpg/protocol/coreproto.pyx":47
 * 
 *         while take_message(self.buffer) == 1:
 *             mtype = get_message_type(self.buffer)             # <<<<<<<<<<<<<<
 *             state = self.state
 * 
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_self->buffer);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_mtype = __pyx_v_get_message_type(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":48
 *         while take_message(self.buffer) == 1:
 *             mtype = get_message_type(self.buffer)
 *             state = self.state             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
    __pyx_t_4 = __pyx_v_self->state;
    __pyx_v_state = __pyx_t_4;

    /* "asyncpg/protocol/coreproto.pyx":50
 *             state = self.state
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if mtype == b'S':
 *                     # ParameterStatus
 */
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "asyncpg/protocol/coreproto.pyx":51
 * 
 *             try:
 *                 if mtype == b'S':             # <<<<<<<<<<<<<<
 *                     # ParameterStatus
 *                     self._parse_msg_parameter_status()
 */
          __pyx_t_3 = ((__pyx_v_mtype == 'S') != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":53
 *                 if mtype == b'S':
 *                     # ParameterStatus
 *                     self._parse_msg_parameter_status()             # <<<<<<<<<<<<<<
 * 
 *                 elif mtype == b'A':
 */
            __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_parameter_status(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 53, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "asyncpg/protocol/coreproto.pyx":51
 * 
 *             try:
 *                 if mtype == b'S':             # <<<<<<<<<<<<<<
 *                     # ParameterStatus
 *                     self._parse_msg_parameter_status()
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":55
 *                     self._parse_msg_parameter_status()
 * 
 *                 elif mtype == b'A':             # <<<<<<<<<<<<<<
 *                     # NotificationResponse
 *                     self._parse_msg_notification()
 */
          __pyx_t_3 = ((__pyx_v_mtype == 'A') != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":57
 *                 elif mtype == b'A':
 *                     # NotificationResponse
 *                     self._parse_msg_notification()             # <<<<<<<<<<<<<<
 * 
 *                 elif mtype == b'N':
 */
            __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_notification(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 57, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "asyncpg/protocol/coreproto.pyx":55
 *                     self._parse_msg_parameter_status()
 * 
 *                 elif mtype == b'A':             # <<<<<<<<<<<<<<
 *                     # NotificationResponse
 *                     self._parse_msg_notification()
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":59
 *                     self._parse_msg_notification()
 * 
 *                 elif mtype == b'N':             # <<<<<<<<<<<<<<
 *                     # 'N' - NoticeResponse
 *                     self._on_notice(self._parse_msg_error_response(False))
 */
          __pyx_t_3 = ((__pyx_v_mtype == 'N') != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":61
 *                 elif mtype == b'N':
 *                     # 'N' - NoticeResponse
 *                     self._on_notice(self._parse_msg_error_response(False))             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_AUTH:
 */
            __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_False); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 61, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_notice(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 61, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":59
 *                     self._parse_msg_notification()
 * 
 *                 elif mtype == b'N':             # <<<<<<<<<<<<<<
 *                     # 'N' - NoticeResponse
 *                     self._on_notice(self._parse_msg_error_response(False))
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":63
 *                     self._on_notice(self._parse_msg_error_response(False))
 * 
 *                 elif state == PROTOCOL_AUTH:             # <<<<<<<<<<<<<<
 *                     self._process__auth(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_AUTH) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":64
 * 
 *                 elif state == PROTOCOL_AUTH:
 *                     self._process__auth(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_PREPARE:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__auth(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 64, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":63
 *                     self._on_notice(self._parse_msg_error_response(False))
 * 
 *                 elif state == PROTOCOL_AUTH:             # <<<<<<<<<<<<<<
 *                     self._process__auth(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":66
 *                     self._process__auth(mtype)
 * 
 *                 elif state == PROTOCOL_PREPARE:             # <<<<<<<<<<<<<<
 *                     self._process__prepare(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_PREPARE) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":67
 * 
 *                 elif state == PROTOCOL_PREPARE:
 *                     self._process__prepare(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__prepare(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 67, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":66
 *                     self._process__auth(mtype)
 * 
 *                 elif state == PROTOCOL_PREPARE:             # <<<<<<<<<<<<<<
 *                     self._process__prepare(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":69
 *                     self._process__prepare(mtype)
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":70
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE:
 *                     self._process__bind_execute(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE_MANY:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__bind_execute(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 70, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":69
 *                     self._process__prepare(mtype)
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":72
 *                     self._process__bind_execute(mtype)
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE_MANY:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute_many(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE_MANY) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":73
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE_MANY:
 *                     self._process__bind_execute_many(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_EXECUTE:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__bind_execute_many(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 73, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":72
 *                     self._process__bind_execute(mtype)
 * 
 *                 elif state == PROTOCOL_BIND_EXECUTE_MANY:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute_many(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":75
 *                     self._process__bind_execute_many(mtype)
 * 
 *                 elif state == PROTOCOL_EXECUTE:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_EXECUTE) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":76
 * 
 *                 elif state == PROTOCOL_EXECUTE:
 *                     self._process__bind_execute(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_BIND:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__bind_execute(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 76, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":75
 *                     self._process__bind_execute_many(mtype)
 * 
 *                 elif state == PROTOCOL_EXECUTE:             # <<<<<<<<<<<<<<
 *                     self._process__bind_execute(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":78
 *                     self._process__bind_execute(mtype)
 * 
 *                 elif state == PROTOCOL_BIND:             # <<<<<<<<<<<<<<
 *                     self._process__bind(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":79
 * 
 *                 elif state == PROTOCOL_BIND:
 *                     self._process__bind(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_CLOSE_STMT_PORTAL:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__bind(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 79, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":78
 *                     self._process__bind_execute(mtype)
 * 
 *                 elif state == PROTOCOL_BIND:             # <<<<<<<<<<<<<<
 *                     self._process__bind(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":81
 *                     self._process__bind(mtype)
 * 
 *                 elif state == PROTOCOL_CLOSE_STMT_PORTAL:             # <<<<<<<<<<<<<<
 *                     self._process__close_stmt_portal(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CLOSE_STMT_PORTAL) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":82
 * 
 *                 elif state == PROTOCOL_CLOSE_STMT_PORTAL:
 *                     self._process__close_stmt_portal(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_SIMPLE_QUERY:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__close_stmt_portal(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 82, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":81
 *                     self._process__bind(mtype)
 * 
 *                 elif state == PROTOCOL_CLOSE_STMT_PORTAL:             # <<<<<<<<<<<<<<
 *                     self._process__close_stmt_portal(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":84
 *                     self._process__close_stmt_portal(mtype)
 * 
 *                 elif state == PROTOCOL_SIMPLE_QUERY:             # <<<<<<<<<<<<<<
 *                     self._process__simple_query(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_SIMPLE_QUERY) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":85
 * 
 *                 elif state == PROTOCOL_SIMPLE_QUERY:
 *                     self._process__simple_query(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_COPY_OUT:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__simple_query(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 85, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":84
 *                     self._process__close_stmt_portal(mtype)
 * 
 *                 elif state == PROTOCOL_SIMPLE_QUERY:             # <<<<<<<<<<<<<<
 *                     self._process__simple_query(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":87
 *                     self._process__simple_query(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_OUT:             # <<<<<<<<<<<<<<
 *                     self._process__copy_out(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":88
 * 
 *                 elif state == PROTOCOL_COPY_OUT:
 *                     self._process__copy_out(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__copy_out(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 88, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":87
 *                     self._process__simple_query(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_OUT:             # <<<<<<<<<<<<<<
 *                     self._process__copy_out(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":90
 *                     self._process__copy_out(mtype)
 * 
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or             # <<<<<<<<<<<<<<
 *                         state == PROTOCOL_COPY_OUT_DONE):
 *                     self._process__copy_out_data(mtype)
 */
          switch (__pyx_v_state) {
            case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA:
            case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE:

            /* "asyncpg/protocol/coreproto.pyx":91
 * 
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or
 *                         state == PROTOCOL_COPY_OUT_DONE):             # <<<<<<<<<<<<<<
 *                     self._process__copy_out_data(mtype)
 * 
 */
            __pyx_t_3 = 1;

            /* "asyncpg/protocol/coreproto.pyx":90
 *                     self._process__copy_out(mtype)
 * 
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or             # <<<<<<<<<<<<<<
 *                         state == PROTOCOL_COPY_OUT_DONE):
 *                     self._process__copy_out_data(mtype)
 */
            break;
            default:
            __pyx_t_3 = 0;
            break;
          }
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":92
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or
 *                         state == PROTOCOL_COPY_OUT_DONE):
 *                     self._process__copy_out_data(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_COPY_IN:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__copy_out_data(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 92, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":90
 *                     self._process__copy_out(mtype)
 * 
 *                 elif (state == PROTOCOL_COPY_OUT_DATA or             # <<<<<<<<<<<<<<
 *                         state == PROTOCOL_COPY_OUT_DONE):
 *                     self._process__copy_out_data(mtype)
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":94
 *                     self._process__copy_out_data(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_IN:             # <<<<<<<<<<<<<<
 *                     self._process__copy_in(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":95
 * 
 *                 elif state == PROTOCOL_COPY_IN:
 *                     self._process__copy_in(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_COPY_IN_DATA:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__copy_in(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 95, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":94
 *                     self._process__copy_out_data(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_IN:             # <<<<<<<<<<<<<<
 *                     self._process__copy_in(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":97
 *                     self._process__copy_in(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_IN_DATA:             # <<<<<<<<<<<<<<
 *                     self._process__copy_in_data(mtype)
 * 
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN_DATA) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":98
 * 
 *                 elif state == PROTOCOL_COPY_IN_DATA:
 *                     self._process__copy_in_data(mtype)             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_CANCELLED:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__copy_in_data(__pyx_v_self, __pyx_v_mtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 98, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":97
 *                     self._process__copy_in(mtype)
 * 
 *                 elif state == PROTOCOL_COPY_IN_DATA:             # <<<<<<<<<<<<<<
 *                     self._process__copy_in_data(mtype)
 * 
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":100
 *                     self._process__copy_in_data(mtype)
 * 
 *                 elif state == PROTOCOL_CANCELLED:             # <<<<<<<<<<<<<<
 *                     # discard all messages until the sync message
 *                     if mtype == b'E':
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CANCELLED) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":102
 *                 elif state == PROTOCOL_CANCELLED:
 *                     # discard all messages until the sync message
 *                     if mtype == b'E':             # <<<<<<<<<<<<<<
 *                         self._parse_msg_error_response(True)
 *                     elif mtype == b'Z':
 */
            switch (__pyx_v_mtype) {
              case 'E':

              /* "asyncpg/protocol/coreproto.pyx":103
 *                     # discard all messages until the sync message
 *                     if mtype == b'E':
 *                         self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 *                     elif mtype == b'Z':
 *                         self._parse_msg_ready_for_query()
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 103, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "asyncpg/protocol/coreproto.pyx":102
 *                 elif state == PROTOCOL_CANCELLED:
 *                     # discard all messages until the sync message
 *                     if mtype == b'E':             # <<<<<<<<<<<<<<
 *                         self._parse_msg_error_response(True)
 *                     elif mtype == b'Z':
 */
              break;
              case 'Z':

              /* "asyncpg/protocol/coreproto.pyx":105
 *                         self._parse_msg_error_response(True)
 *                     elif mtype == b'Z':
 *                         self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *                         self._push_result()
 *                     else:
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 105, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "asyncpg/protocol/coreproto.pyx":106
 *                     elif mtype == b'Z':
 *                         self._parse_msg_ready_for_query()
 *                         self._push_result()             # <<<<<<<<<<<<<<
 *                     else:
 *                         self.buffer.discard_message()
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 106, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "asyncpg/protocol/coreproto.pyx":104
 *                     if mtype == b'E':
 *                         self._parse_msg_error_response(True)
 *                     elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *                         self._parse_msg_ready_for_query()
 *                         self._push_result()
 */
              break;
              default:

              /* "asyncpg/protocol/coreproto.pyx":108
 *                         self._push_result()
 *                     else:
 *                         self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_ERROR_CONSUME:
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 108, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              break;
            }

            /* "asyncpg/protocol/coreproto.pyx":100
 *                     self._process__copy_in_data(mtype)
 * 
 *                 elif state == PROTOCOL_CANCELLED:             # <<<<<<<<<<<<<<
 *                     # discard all messages until the sync message
 *                     if mtype == b'E':
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":110
 *                         self.buffer.discard_message()
 * 
 *                 elif state == PROTOCOL_ERROR_CONSUME:             # <<<<<<<<<<<<<<
 *                     # Error in protocol (on asyncpg side);
 *                     # discard all messages until sync message
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_ERROR_CONSUME) != 0);
          if (__pyx_t_3) {

            /* "asyncpg/protocol/coreproto.pyx":114
 *                     # discard all messages until sync message
 * 
 *                     if mtype == b'Z':             # <<<<<<<<<<<<<<
 *                         # Sync point, self to push the result
 *                         if self.result_type != RESULT_FAILED:
 */
            __pyx_t_3 = ((__pyx_v_mtype == 'Z') != 0);
            if (__pyx_t_3) {

              /* "asyncpg/protocol/coreproto.pyx":116
 *                     if mtype == b'Z':
 *                         # Sync point, self to push the result
 *                         if self.result_type != RESULT_FAILED:             # <<<<<<<<<<<<<<
 *                             self.result_type = RESULT_FAILED
 *                             self.result = apg_exc.InternalClientError(
 */
              __pyx_t_3 = ((__pyx_v_self->result_type != __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED) != 0);
              if (__pyx_t_3) {

                /* "asyncpg/protocol/coreproto.pyx":117
 *                         # Sync point, self to push the result
 *                         if self.result_type != RESULT_FAILED:
 *                             self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *                             self.result = apg_exc.InternalClientError(
 *                                 'unknown error in protocol implementation')
 */
                __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

                /* "asyncpg/protocol/coreproto.pyx":118
 *                         if self.result_type != RESULT_FAILED:
 *                             self.result_type = RESULT_FAILED
 *                             self.result = apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                                 'unknown error in protocol implementation')
 * 
 */
                __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 118, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 118, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_9);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __pyx_t_1 = NULL;
                if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
                  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
                  if (likely(__pyx_t_1)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
                    __Pyx_INCREF(__pyx_t_1);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_9, function);
                  }
                }
                __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_1, __pyx_kp_u_unknown_error_in_protocol_implem) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_u_unknown_error_in_protocol_implem);
                __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 118, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_GIVEREF(__pyx_t_8);
                __Pyx_GOTREF(__pyx_v_self->result);
                __Pyx_DECREF(__pyx_v_self->result);
                __pyx_v_self->result = __pyx_t_8;
                __pyx_t_8 = 0;

                /* "asyncpg/protocol/coreproto.pyx":116
 *                     if mtype == b'Z':
 *                         # Sync point, self to push the result
 *                         if self.result_type != RESULT_FAILED:             # <<<<<<<<<<<<<<
 *                             self.result_type = RESULT_FAILED
 *                             self.result = apg_exc.InternalClientError(
 */
              }

              /* "asyncpg/protocol/coreproto.pyx":121
 *                                 'unknown error in protocol implementation')
 * 
 *                         self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *                         self._push_result()
 * 
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 121, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "asyncpg/protocol/coreproto.pyx":122
 * 
 *                         self._parse_msg_ready_for_query()
 *                         self._push_result()             # <<<<<<<<<<<<<<
 * 
 *                     else:
 */
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 122, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "asyncpg/protocol/coreproto.pyx":114
 *                     # discard all messages until sync message
 * 
 *                     if mtype == b'Z':             # <<<<<<<<<<<<<<
 *                         # Sync point, self to push the result
 *                         if self.result_type != RESULT_FAILED:
 */
              goto __pyx_L19;
            }

            /* "asyncpg/protocol/coreproto.pyx":125
 * 
 *                     else:
 *                         self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *                 elif state == PROTOCOL_TERMINATING:
 */
            /*else*/ {
              __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 125, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            __pyx_L19:;

            /* "asyncpg/protocol/coreproto.pyx":110
 *                         self.buffer.discard_message()
 * 
 *                 elif state == PROTOCOL_ERROR_CONSUME:             # <<<<<<<<<<<<<<
 *                     # Error in protocol (on asyncpg side);
 *                     # discard all messages until sync message
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":127
 *                         self.buffer.discard_message()
 * 
 *                 elif state == PROTOCOL_TERMINATING:             # <<<<<<<<<<<<<<
 *                     # The connection is being terminated.
 *                     # discard all messages until connection
 */
          __pyx_t_3 = ((__pyx_v_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING) != 0);
          if (likely(__pyx_t_3)) {

            /* "asyncpg/protocol/coreproto.pyx":131
 *                     # discard all messages until connection
 *                     # termination.
 *                     self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
            __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 131, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "asyncpg/protocol/coreproto.pyx":127
 *                         self.buffer.discard_message()
 * 
 *                 elif state == PROTOCOL_TERMINATING:             # <<<<<<<<<<<<<<
 *                     # The connection is being terminated.
 *                     # discard all messages until connection
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":134
 * 
 *                 else:
 *                     raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                         f'cannot process message {chr(mtype)!r}: '
 *                         f'protocol is in an unexpected state {state!r}.')
 */
          /*else*/ {
            __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 134, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 134, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

            /* "asyncpg/protocol/coreproto.pyx":135
 *                 else:
 *                     raise apg_exc.InternalClientError(
 *                         f'cannot process message {chr(mtype)!r}: '             # <<<<<<<<<<<<<<
 *                         f'protocol is in an unexpected state {state!r}.')
 * 
 */
            __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 135, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_cannot_process_message);
            __pyx_t_10 += 23;
            __Pyx_GIVEREF(__pyx_kp_u_cannot_process_message);
            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_cannot_process_message);
            __pyx_t_12 = __Pyx_PyInt_From_char(__pyx_v_mtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 135, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(6, 135, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_13), __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 135, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_11;
            __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_12);
            PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_12);
            __pyx_t_12 = 0;
            __Pyx_INCREF(__pyx_kp_u_protocol_is_in_an_unexpected_st);
            __pyx_t_10 += 37;
            __Pyx_GIVEREF(__pyx_kp_u_protocol_is_in_an_unexpected_st);
            PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_protocol_is_in_an_unexpected_st);

            /* "asyncpg/protocol/coreproto.pyx":136
 *                     raise apg_exc.InternalClientError(
 *                         f'cannot process message {chr(mtype)!r}: '
 *                         f'protocol is in an unexpected state {state!r}.')             # <<<<<<<<<<<<<<
 * 
 *             except Exception as ex:
 */
            __pyx_t_12 = __Pyx_PyUnicode_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_state, 0, ' ', 'd'); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 136, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_11;
            __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_12);
            PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_12);
            __pyx_t_12 = 0;
            __Pyx_INCREF(__pyx_kp_u__40);
            __pyx_t_10 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__40);
            PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_kp_u__40);

            /* "asyncpg/protocol/coreproto.pyx":135
 *                 else:
 *                     raise apg_exc.InternalClientError(
 *                         f'cannot process message {chr(mtype)!r}: '             # <<<<<<<<<<<<<<
 *                         f'protocol is in an unexpected state {state!r}.')
 * 
 */
            __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 135, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_9 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_9)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_9);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12);
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 134, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_Raise(__pyx_t_8, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __PYX_ERR(6, 134, __pyx_L10_error)
          }
          __pyx_L18:;

          /* "asyncpg/protocol/coreproto.pyx":50
 *             state = self.state
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if mtype == b'S':
 *                     # ParameterStatus
 */
        }
        __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;
        goto __pyx_L17_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "asyncpg/protocol/coreproto.pyx":138
 *                         f'protocol is in an unexpected state {state!r}.')
 * 
 *             except Exception as ex:             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = ex
 */
        __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_14) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._read_server_messages", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_1, &__pyx_t_12) < 0) __PYX_ERR(6, 138, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_1);
          __pyx_v_ex = __pyx_t_1;
          /*try:*/ {

            /* "asyncpg/protocol/coreproto.pyx":139
 * 
 *             except Exception as ex:
 *                 self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *                 self.result = ex
 * 
 */
            __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

            /* "asyncpg/protocol/coreproto.pyx":140
 *             except Exception as ex:
 *                 self.result_type = RESULT_FAILED
 *                 self.result = ex             # <<<<<<<<<<<<<<
 * 
 *                 if mtype == b'Z':
 */
            __Pyx_INCREF(__pyx_v_ex);
            __Pyx_GIVEREF(__pyx_v_ex);
            __Pyx_GOTREF(__pyx_v_self->result);
            __Pyx_DECREF(__pyx_v_self->result);
            __pyx_v_self->result = __pyx_v_ex;

            /* "asyncpg/protocol/coreproto.pyx":142
 *                 self.result = ex
 * 
 *                 if mtype == b'Z':             # <<<<<<<<<<<<<<
 *                     self._push_result()
 *                 else:
 */
            __pyx_t_3 = ((__pyx_v_mtype == 'Z') != 0);
            if (__pyx_t_3) {

              /* "asyncpg/protocol/coreproto.pyx":143
 * 
 *                 if mtype == b'Z':
 *                     self._push_result()             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.state = PROTOCOL_ERROR_CONSUME
 */
              __pyx_t_9 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 143, __pyx_L26_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

              /* "asyncpg/protocol/coreproto.pyx":142
 *                 self.result = ex
 * 
 *                 if mtype == b'Z':             # <<<<<<<<<<<<<<
 *                     self._push_result()
 *                 else:
 */
              goto __pyx_L28;
            }

            /* "asyncpg/protocol/coreproto.pyx":145
 *                     self._push_result()
 *                 else:
 *                     self.state = PROTOCOL_ERROR_CONSUME             # <<<<<<<<<<<<<<
 * 
 *             finally:
 */
            /*else*/ {
              __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_ERROR_CONSUME;
            }
            __pyx_L28:;
          }

          /* "asyncpg/protocol/coreproto.pyx":138
 *                         f'protocol is in an unexpected state {state!r}.')
 * 
 *             except Exception as ex:             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = ex
 */
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_DECREF(__pyx_v_ex);
              __pyx_v_ex = NULL;
              goto __pyx_L27;
            }
            __pyx_L26_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
              __Pyx_XGOTREF(__pyx_t_17);
              __Pyx_XGOTREF(__pyx_t_18);
              __Pyx_XGOTREF(__pyx_t_19);
              __Pyx_XGOTREF(__pyx_t_20);
              __Pyx_XGOTREF(__pyx_t_21);
              __Pyx_XGOTREF(__pyx_t_22);
              __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_ex);
                __pyx_v_ex = NULL;
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
              }
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_XGIVEREF(__pyx_t_18);
              __Pyx_XGIVEREF(__pyx_t_19);
              __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
              __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
              __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
              goto __pyx_L12_except_error;
            }
            __pyx_L27:;
          }
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L11_exception_handled;
        }
        goto __pyx_L12_except_error;
        __pyx_L12_except_error:;

        /* "asyncpg/protocol/coreproto.pyx":50
 *             state = self.state
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if mtype == b'S':
 *                     # ParameterStatus
 */
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L8_error;
        __pyx_L11_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L17_try_end:;
      }
    }

    /* "asyncpg/protocol/coreproto.pyx":148
 * 
 *             finally:
 *                 self.buffer.finish_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__auth(self, char mtype):
 */
    /*finally:*/ {
      /*normal exit:*/{
        __pyx_t_12 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->finish_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L9;
      }
      __pyx_L8_error:;
      /*exception exit:*/{
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_20);
        __pyx_t_15 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_23 = __pyx_filename;
        {
          __pyx_t_12 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->finish_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_12)) __PYX_ERR(6, 148, __pyx_L36_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
        __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0;
        __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_23;
        goto __pyx_L1_error;
        __pyx_L36_error:;
        if (PY_MAJOR_VERSION >= 3) {
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0;
        goto __pyx_L1_error;
      }
      __pyx_L9:;
    }
  }

  /* "asyncpg/protocol/coreproto.pyx":37
 *         return self.xact_status in (PQTRANS_INTRANS, PQTRANS_INERROR)
 * 
 *     cdef _read_server_messages(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char mtype
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._read_server_messages", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":150
 *                 self.buffer.finish_message()
 * 
 *     cdef _process__auth(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'R':
 *             # Authentication...
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__auth(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_process__auth", 0);

  /* "asyncpg/protocol/coreproto.pyx":151
 * 
 *     cdef _process__auth(self, char mtype):
 *         if mtype == b'R':             # <<<<<<<<<<<<<<
 *             # Authentication...
 *             self._parse_msg_authentication()
 */
  switch (__pyx_v_mtype) {
    case 'R':

    /* "asyncpg/protocol/coreproto.pyx":153
 *         if mtype == b'R':
 *             # Authentication...
 *             self._parse_msg_authentication()             # <<<<<<<<<<<<<<
 *             if self.result_type != RESULT_OK:
 *                 self.con_status = CONNECTION_BAD
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_authentication(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":154
 *             # Authentication...
 *             self._parse_msg_authentication()
 *             if self.result_type != RESULT_OK:             # <<<<<<<<<<<<<<
 *                 self.con_status = CONNECTION_BAD
 *                 self._push_result()
 */
    __pyx_t_2 = ((__pyx_v_self->result_type != __pyx_e_7asyncpg_8protocol_8protocol_RESULT_OK) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/coreproto.pyx":155
 *             self._parse_msg_authentication()
 *             if self.result_type != RESULT_OK:
 *                 self.con_status = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *                 self._push_result()
 * 
 */
      __pyx_v_self->con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD;

      /* "asyncpg/protocol/coreproto.pyx":156
 *             if self.result_type != RESULT_OK:
 *                 self.con_status = CONNECTION_BAD
 *                 self._push_result()             # <<<<<<<<<<<<<<
 * 
 *             elif self.auth_msg is not None:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/coreproto.pyx":154
 *             # Authentication...
 *             self._parse_msg_authentication()
 *             if self.result_type != RESULT_OK:             # <<<<<<<<<<<<<<
 *                 self.con_status = CONNECTION_BAD
 *                 self._push_result()
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/coreproto.pyx":158
 *                 self._push_result()
 * 
 *             elif self.auth_msg is not None:             # <<<<<<<<<<<<<<
 *                 # Server wants us to send auth data, so do that.
 *                 self._write(self.auth_msg)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 158, __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 (__pyx_t_3) {

      /* "asyncpg/protocol/coreproto.pyx":160
 *             elif self.auth_msg is not None:
 *                 # Server wants us to send auth data, so do that.
 *                 self._write(self.auth_msg)             # <<<<<<<<<<<<<<
 *                 self.auth_msg = None
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/coreproto.pyx":161
 *                 # Server wants us to send auth data, so do that.
 *                 self._write(self.auth_msg)
 *                 self.auth_msg = None             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'K':
 */
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, Py_None) < 0) __PYX_ERR(6, 161, __pyx_L1_error)

      /* "asyncpg/protocol/coreproto.pyx":158
 *                 self._push_result()
 * 
 *             elif self.auth_msg is not None:             # <<<<<<<<<<<<<<
 *                 # Server wants us to send auth data, so do that.
 *                 self._write(self.auth_msg)
 */
    }
    __pyx_L3:;

    /* "asyncpg/protocol/coreproto.pyx":151
 * 
 *     cdef _process__auth(self, char mtype):
 *         if mtype == b'R':             # <<<<<<<<<<<<<<
 *             # Authentication...
 *             self._parse_msg_authentication()
 */
    break;
    case 'K':

    /* "asyncpg/protocol/coreproto.pyx":165
 *         elif mtype == b'K':
 *             # BackendKeyData
 *             self._parse_msg_backend_key_data()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'E':
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_backend_key_data(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/coreproto.pyx":163
 *                 self.auth_msg = None
 * 
 *         elif mtype == b'K':             # <<<<<<<<<<<<<<
 *             # BackendKeyData
 *             self._parse_msg_backend_key_data()
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":169
 *         elif mtype == b'E':
 *             # ErrorResponse
 *             self.con_status = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 *             self._push_result()
 */
    __pyx_v_self->con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD;

    /* "asyncpg/protocol/coreproto.pyx":170
 *             # ErrorResponse
 *             self.con_status = CONNECTION_BAD
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/coreproto.pyx":171
 *             self.con_status = CONNECTION_BAD
 *             self._parse_msg_error_response(True)
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/coreproto.pyx":167
 *             self._parse_msg_backend_key_data()
 * 
 *         elif mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self.con_status = CONNECTION_BAD
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":175
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self.con_status = CONNECTION_OK
 *             self._push_result()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/coreproto.pyx":176
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self.con_status = CONNECTION_OK             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_v_self->con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_OK;

    /* "asyncpg/protocol/coreproto.pyx":177
 *             self._parse_msg_ready_for_query()
 *             self.con_status = CONNECTION_OK
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__prepare(self, char mtype):
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/coreproto.pyx":173
 *             self._push_result()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":150
 *                 self.buffer.finish_message()
 * 
 *     cdef _process__auth(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'R':
 *             # Authentication...
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__auth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":179
 *             self._push_result()
 * 
 *     cdef _process__prepare(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b't':
 *             # Parameters description
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_process__prepare", 0);

  /* "asyncpg/protocol/coreproto.pyx":180
 * 
 *     cdef _process__prepare(self, char mtype):
 *         if mtype == b't':             # <<<<<<<<<<<<<<
 *             # Parameters description
 *             self.result_param_desc = self.buffer.consume_message()
 */
  switch (__pyx_v_mtype) {
    case 't':

    /* "asyncpg/protocol/coreproto.pyx":182
 *         if mtype == b't':
 *             # Parameters description
 *             self.result_param_desc = self.buffer.consume_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'1':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->consume_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->result_param_desc);
    __Pyx_DECREF(__pyx_v_self->result_param_desc);
    __pyx_v_self->result_param_desc = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":180
 * 
 *     cdef _process__prepare(self, char mtype):
 *         if mtype == b't':             # <<<<<<<<<<<<<<
 *             # Parameters description
 *             self.result_param_desc = self.buffer.consume_message()
 */
    break;
    case '1':

    /* "asyncpg/protocol/coreproto.pyx":186
 *         elif mtype == b'1':
 *             # ParseComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'T':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":184
 *             self.result_param_desc = self.buffer.consume_message()
 * 
 *         elif mtype == b'1':             # <<<<<<<<<<<<<<
 *             # ParseComplete
 *             self.buffer.discard_message()
 */
    break;
    case 'T':

    /* "asyncpg/protocol/coreproto.pyx":190
 *         elif mtype == b'T':
 *             # Row description
 *             self.result_row_desc = self.buffer.consume_message()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->consume_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->result_row_desc);
    __Pyx_DECREF(__pyx_v_self->result_row_desc);
    __pyx_v_self->result_row_desc = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":191
 *             # Row description
 *             self.result_row_desc = self.buffer.consume_message()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'E':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":188
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'T':             # <<<<<<<<<<<<<<
 *             # Row description
 *             self.result_row_desc = self.buffer.consume_message()
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":195
 *         elif mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 *             # we don't send a sync during the parse/describe sequence
 *             # but send a FLUSH instead. If an error happens we need to
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":201
 *             # this effectively clears the error and we then wait until we get a
 *             # ready for new query message
 *             self._write(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *             self.state = PROTOCOL_ERROR_CONSUME
 * 
 */
    __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 201, __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;

    /* "asyncpg/protocol/coreproto.pyx":202
 *             # ready for new query message
 *             self._write(SYNC_MESSAGE)
 *             self.state = PROTOCOL_ERROR_CONSUME             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'n':
 */
    __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_ERROR_CONSUME;

    /* "asyncpg/protocol/coreproto.pyx":193
 *             self._push_result()
 * 
 *         elif mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case 'n':

    /* "asyncpg/protocol/coreproto.pyx":206
 *         elif mtype == b'n':
 *             # NoData
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":207
 *             # NoData
 *             self.buffer.discard_message()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__bind_execute(self, char mtype):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":204
 *             self.state = PROTOCOL_ERROR_CONSUME
 * 
 *         elif mtype == b'n':             # <<<<<<<<<<<<<<
 *             # NoData
 *             self.buffer.discard_message()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":179
 *             self._push_result()
 * 
 *     cdef _process__prepare(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b't':
 *             # Parameters description
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":209
 *             self._push_result()
 * 
 *     cdef _process__bind_execute(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'D':
 *             # DataRow
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__bind_execute", 0);

  /* "asyncpg/protocol/coreproto.pyx":210
 * 
 *     cdef _process__bind_execute(self, char mtype):
 *         if mtype == b'D':             # <<<<<<<<<<<<<<
 *             # DataRow
 *             self._parse_data_msgs()
 */
  switch (__pyx_v_mtype) {
    case 'D':

    /* "asyncpg/protocol/coreproto.pyx":212
 *         if mtype == b'D':
 *             # DataRow
 *             self._parse_data_msgs()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b's':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_data_msgs(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":210
 * 
 *     cdef _process__bind_execute(self, char mtype):
 *         if mtype == b'D':             # <<<<<<<<<<<<<<
 *             # DataRow
 *             self._parse_data_msgs()
 */
    break;
    case 's':

    /* "asyncpg/protocol/coreproto.pyx":216
 *         elif mtype == b's':
 *             # PortalSuspended
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'C':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":214
 *             self._parse_data_msgs()
 * 
 *         elif mtype == b's':             # <<<<<<<<<<<<<<
 *             # PortalSuspended
 *             self.buffer.discard_message()
 */
    break;
    case 'C':

    /* "asyncpg/protocol/coreproto.pyx":220
 *         elif mtype == b'C':
 *             # CommandComplete
 *             self.result_execute_completed = True             # <<<<<<<<<<<<<<
 *             self._parse_msg_command_complete()
 * 
 */
    __pyx_v_self->result_execute_completed = 1;

    /* "asyncpg/protocol/coreproto.pyx":221
 *             # CommandComplete
 *             self.result_execute_completed = True
 *             self._parse_msg_command_complete()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'E':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_command_complete(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":218
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'C':             # <<<<<<<<<<<<<<
 *             # CommandComplete
 *             self.result_execute_completed = True
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":225
 *         elif mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'2':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":223
 *             self._parse_msg_command_complete()
 * 
 *         elif mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case '2':

    /* "asyncpg/protocol/coreproto.pyx":229
 *         elif mtype == b'2':
 *             # BindComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":227
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'2':             # <<<<<<<<<<<<<<
 *             # BindComplete
 *             self.buffer.discard_message()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":233
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":234
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'I':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":231
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    case 'I':

    /* "asyncpg/protocol/coreproto.pyx":238
 *         elif mtype == b'I':
 *             # EmptyQueryResponse
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__bind_execute_many(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":236
 *             self._push_result()
 * 
 *         elif mtype == b'I':             # <<<<<<<<<<<<<<
 *             # EmptyQueryResponse
 *             self.buffer.discard_message()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":209
 *             self._push_result()
 * 
 *     cdef _process__bind_execute(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'D':
 *             # DataRow
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":240
 *             self.buffer.discard_message()
 * 
 *     cdef _process__bind_execute_many(self, char mtype):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__bind_execute_many", 0);

  /* "asyncpg/protocol/coreproto.pyx":243
 *         cdef WriteBuffer buf
 * 
 *         if mtype == b'D':             # <<<<<<<<<<<<<<
 *             # DataRow
 *             self._parse_data_msgs()
 */
  switch (__pyx_v_mtype) {
    case 'D':

    /* "asyncpg/protocol/coreproto.pyx":245
 *         if mtype == b'D':
 *             # DataRow
 *             self._parse_data_msgs()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b's':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_data_msgs(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":243
 *         cdef WriteBuffer buf
 * 
 *         if mtype == b'D':             # <<<<<<<<<<<<<<
 *             # DataRow
 *             self._parse_data_msgs()
 */
    break;
    case 's':

    /* "asyncpg/protocol/coreproto.pyx":249
 *         elif mtype == b's':
 *             # PortalSuspended
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'C':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":247
 *             self._parse_data_msgs()
 * 
 *         elif mtype == b's':             # <<<<<<<<<<<<<<
 *             # PortalSuspended
 *             self.buffer.discard_message()
 */
    break;
    case 'C':

    /* "asyncpg/protocol/coreproto.pyx":253
 *         elif mtype == b'C':
 *             # CommandComplete
 *             self._parse_msg_command_complete()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'E':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_command_complete(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":251
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'C':             # <<<<<<<<<<<<<<
 *             # CommandComplete
 *             self._parse_msg_command_complete()
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":257
 *         elif mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'2':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":255
 *             self._parse_msg_command_complete()
 * 
 *         elif mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case '2':

    /* "asyncpg/protocol/coreproto.pyx":261
 *         elif mtype == b'2':
 *             # BindComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":259
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'2':             # <<<<<<<<<<<<<<
 *             # BindComplete
 *             self.buffer.discard_message()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":265
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":266
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'I':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":263
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    case 'I':

    /* "asyncpg/protocol/coreproto.pyx":270
 *         elif mtype == b'I':
 *             # EmptyQueryResponse
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'1':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":268
 *             self._push_result()
 * 
 *         elif mtype == b'I':             # <<<<<<<<<<<<<<
 *             # EmptyQueryResponse
 *             self.buffer.discard_message()
 */
    break;
    case '1':

    /* "asyncpg/protocol/coreproto.pyx":274
 *         elif mtype == b'1':
 *             # ParseComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__bind(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":272
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'1':             # <<<<<<<<<<<<<<
 *             # ParseComplete
 *             self.buffer.discard_message()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":240
 *             self.buffer.discard_message()
 * 
 *     cdef _process__bind_execute_many(self, char mtype):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":276
 *             self.buffer.discard_message()
 * 
 *     cdef _process__bind(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             # ErrorResponse
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__bind", 0);

  /* "asyncpg/protocol/coreproto.pyx":277
 * 
 *     cdef _process__bind(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":279
 *         if mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'2':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":277
 * 
 *     cdef _process__bind(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case '2':

    /* "asyncpg/protocol/coreproto.pyx":283
 *         elif mtype == b'2':
 *             # BindComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":281
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'2':             # <<<<<<<<<<<<<<
 *             # BindComplete
 *             self.buffer.discard_message()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":287
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":288
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__close_stmt_portal(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":285
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":276
 *             self.buffer.discard_message()
 * 
 *     cdef _process__bind(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             # ErrorResponse
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":290
 *             self._push_result()
 * 
 *     cdef _process__close_stmt_portal(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             # ErrorResponse
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__close_stmt_portal(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__close_stmt_portal", 0);

  /* "asyncpg/protocol/coreproto.pyx":291
 * 
 *     cdef _process__close_stmt_portal(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":293
 *         if mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'3':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":291
 * 
 *     cdef _process__close_stmt_portal(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case '3':

    /* "asyncpg/protocol/coreproto.pyx":297
 *         elif mtype == b'3':
 *             # CloseComplete
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":295
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'3':             # <<<<<<<<<<<<<<
 *             # CloseComplete
 *             self.buffer.discard_message()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":301
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":302
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__simple_query(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":299
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":290
 *             self._push_result()
 * 
 *     cdef _process__close_stmt_portal(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             # ErrorResponse
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__close_stmt_portal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":304
 *             self._push_result()
 * 
 *     cdef _process__simple_query(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype in {b'D', b'I', b'T'}:
 *             # 'D' - DataRow
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__simple_query", 0);

  /* "asyncpg/protocol/coreproto.pyx":305
 * 
 *     cdef _process__simple_query(self, char mtype):
 *         if mtype in {b'D', b'I', b'T'}:             # <<<<<<<<<<<<<<
 *             # 'D' - DataRow
 *             # 'I' - EmptyQueryResponse
 */
  switch (__pyx_v_mtype) {
    case 'D':
    case 'I':
    case 'T':

    /* "asyncpg/protocol/coreproto.pyx":309
 *             # 'I' - EmptyQueryResponse
 *             # 'T' - RowDescription
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'E':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":305
 * 
 *     cdef _process__simple_query(self, char mtype):
 *         if mtype in {b'D', b'I', b'T'}:             # <<<<<<<<<<<<<<
 *             # 'D' - DataRow
 *             # 'I' - EmptyQueryResponse
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":313
 *         elif mtype == b'E':
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":311
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'E':             # <<<<<<<<<<<<<<
 *             # ErrorResponse
 *             self._parse_msg_error_response(True)
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":317
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":318
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'C':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":315
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    case 'C':

    /* "asyncpg/protocol/coreproto.pyx":322
 *         elif mtype == b'C':
 *             # CommandComplete
 *             self._parse_msg_command_complete()             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_command_complete(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":320
 *             self._push_result()
 * 
 *         elif mtype == b'C':             # <<<<<<<<<<<<<<
 *             # CommandComplete
 *             self._parse_msg_command_complete()
 */
    break;
    default:

    /* "asyncpg/protocol/coreproto.pyx":326
 *         else:
 *             # We don't really care about COPY IN etc
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__copy_out(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    break;
  }

  /* "asyncpg/protocol/coreproto.pyx":304
 *             self._push_result()
 * 
 *     cdef _process__simple_query(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype in {b'D', b'I', b'T'}:
 *             # 'D' - DataRow
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__simple_query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":328
 *             self.buffer.discard_message()
 * 
 *     cdef _process__copy_out(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__copy_out", 0);

  /* "asyncpg/protocol/coreproto.pyx":329
 * 
 *     cdef _process__copy_out(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":330
 *     cdef _process__copy_out(self, char mtype):
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'H':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":329
 * 
 *     cdef _process__copy_out(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
    break;
    case 'H':

    /* "asyncpg/protocol/coreproto.pyx":334
 *         elif mtype == b'H':
 *             # CopyOutResponse
 *             self._set_state(PROTOCOL_COPY_OUT_DATA)             # <<<<<<<<<<<<<<
 *             self.buffer.discard_message()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":335
 *             # CopyOutResponse
 *             self._set_state(PROTOCOL_COPY_OUT_DATA)
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":332
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'H':             # <<<<<<<<<<<<<<
 *             # CopyOutResponse
 *             self._set_state(PROTOCOL_COPY_OUT_DATA)
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":339
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":340
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__copy_out_data(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":337
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":328
 *             self.buffer.discard_message()
 * 
 *     cdef _process__copy_out(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":342
 *             self._push_result()
 * 
 *     cdef _process__copy_out_data(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__copy_out_data", 0);

  /* "asyncpg/protocol/coreproto.pyx":343
 * 
 *     cdef _process__copy_out_data(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":344
 *     cdef _process__copy_out_data(self, char mtype):
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'd':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":343
 * 
 *     cdef _process__copy_out_data(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
    break;
    case 'd':

    /* "asyncpg/protocol/coreproto.pyx":348
 *         elif mtype == b'd':
 *             # CopyData
 *             self._parse_copy_data_msgs()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'c':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_copy_data_msgs(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":346
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'd':             # <<<<<<<<<<<<<<
 *             # CopyData
 *             self._parse_copy_data_msgs()
 */
    break;
    case 'c':

    /* "asyncpg/protocol/coreproto.pyx":352
 *         elif mtype == b'c':
 *             # CopyDone
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 *             self._set_state(PROTOCOL_COPY_OUT_DONE)
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":353
 *             # CopyDone
 *             self.buffer.discard_message()
 *             self._set_state(PROTOCOL_COPY_OUT_DONE)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'C':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":350
 *             self._parse_copy_data_msgs()
 * 
 *         elif mtype == b'c':             # <<<<<<<<<<<<<<
 *             # CopyDone
 *             self.buffer.discard_message()
 */
    break;
    case 'C':

    /* "asyncpg/protocol/coreproto.pyx":357
 *         elif mtype == b'C':
 *             # CommandComplete
 *             self._parse_msg_command_complete()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_command_complete(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":355
 *             self._set_state(PROTOCOL_COPY_OUT_DONE)
 * 
 *         elif mtype == b'C':             # <<<<<<<<<<<<<<
 *             # CommandComplete
 *             self._parse_msg_command_complete()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":361
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":362
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__copy_in(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":359
 *             self._parse_msg_command_complete()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":342
 *             self._push_result()
 * 
 *     cdef _process__copy_out_data(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__copy_out_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":364
 *             self._push_result()
 * 
 *     cdef _process__copy_in(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__copy_in", 0);

  /* "asyncpg/protocol/coreproto.pyx":365
 * 
 *     cdef _process__copy_in(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":366
 *     cdef _process__copy_in(self, char mtype):
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'G':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":365
 * 
 *     cdef _process__copy_in(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
    break;
    case 'G':

    /* "asyncpg/protocol/coreproto.pyx":370
 *         elif mtype == b'G':
 *             # CopyInResponse
 *             self._set_state(PROTOCOL_COPY_IN_DATA)             # <<<<<<<<<<<<<<
 *             self.buffer.discard_message()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN_DATA); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":371
 *             # CopyInResponse
 *             self._set_state(PROTOCOL_COPY_IN_DATA)
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":368
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'G':             # <<<<<<<<<<<<<<
 *             # CopyInResponse
 *             self._set_state(PROTOCOL_COPY_IN_DATA)
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":375
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":376
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _process__copy_in_data(self, char mtype):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":373
 *             self.buffer.discard_message()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":364
 *             self._push_result()
 * 
 *     cdef _process__copy_in(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":378
 *             self._push_result()
 * 
 *     cdef _process__copy_in_data(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, char __pyx_v_mtype) {
  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("_process__copy_in_data", 0);

  /* "asyncpg/protocol/coreproto.pyx":379
 * 
 *     cdef _process__copy_in_data(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
  switch (__pyx_v_mtype) {
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":380
 *     cdef _process__copy_in_data(self, char mtype):
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'C':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_error_response(__pyx_v_self, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":379
 * 
 *     cdef _process__copy_in_data(self, char mtype):
 *         if mtype == b'E':             # <<<<<<<<<<<<<<
 *             self._parse_msg_error_response(True)
 * 
 */
    break;
    case 'C':

    /* "asyncpg/protocol/coreproto.pyx":384
 *         elif mtype == b'C':
 *             # CommandComplete
 *             self._parse_msg_command_complete()             # <<<<<<<<<<<<<<
 * 
 *         elif mtype == b'Z':
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_command_complete(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":382
 *             self._parse_msg_error_response(True)
 * 
 *         elif mtype == b'C':             # <<<<<<<<<<<<<<
 *             # CommandComplete
 *             self._parse_msg_command_complete()
 */
    break;
    case 'Z':

    /* "asyncpg/protocol/coreproto.pyx":388
 *         elif mtype == b'Z':
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()             # <<<<<<<<<<<<<<
 *             self._push_result()
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_parse_msg_ready_for_query(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":389
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 *             self._push_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_command_complete(self):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":386
 *             self._parse_msg_command_complete()
 * 
 *         elif mtype == b'Z':             # <<<<<<<<<<<<<<
 *             # ReadyForQuery
 *             self._parse_msg_ready_for_query()
 */
    break;
    default: break;
  }

  /* "asyncpg/protocol/coreproto.pyx":378
 *             self._push_result()
 * 
 *     cdef _process__copy_in_data(self, char mtype):             # <<<<<<<<<<<<<<
 *         if mtype == b'E':
 *             self._parse_msg_error_response(True)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._process__copy_in_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":391
 *             self._push_result()
 * 
 *     cdef _parse_msg_command_complete(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             const char* cbuf
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_command_complete(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  char const *__pyx_v_cbuf;
  Py_ssize_t __pyx_v_cbuf_len;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_msg_command_complete", 0);

  /* "asyncpg/protocol/coreproto.pyx":396
 *             ssize_t cbuf_len
 * 
 *         cbuf = self.buffer.try_consume_message(&cbuf_len)             # <<<<<<<<<<<<<<
 *         if cbuf != NULL and cbuf_len > 0:
 *             msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)
 */
  __pyx_v_cbuf = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->try_consume_message(__pyx_v_self->buffer, (&__pyx_v_cbuf_len));

  /* "asyncpg/protocol/coreproto.pyx":397
 * 
 *         cbuf = self.buffer.try_consume_message(&cbuf_len)
 *         if cbuf != NULL and cbuf_len > 0:             # <<<<<<<<<<<<<<
 *             msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_cbuf != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_cbuf_len > 0) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/coreproto.pyx":398
 *         cbuf = self.buffer.try_consume_message(&cbuf_len)
 *         if cbuf != NULL and cbuf_len > 0:
 *             msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)             # <<<<<<<<<<<<<<
 *         else:
 *             msg = self.buffer.read_null_str()
 */
    __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_cbuf, (__pyx_v_cbuf_len - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_msg = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/coreproto.pyx":397
 * 
 *         cbuf = self.buffer.try_consume_message(&cbuf_len)
 *         if cbuf != NULL and cbuf_len > 0:             # <<<<<<<<<<<<<<
 *             msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/coreproto.pyx":400
 *             msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)
 *         else:
 *             msg = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 *         self.result_status_msg = msg
 * 
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_msg = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/coreproto.pyx":401
 *         else:
 *             msg = self.buffer.read_null_str()
 *         self.result_status_msg = msg             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_copy_data_msgs(self):
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_msg))||((__pyx_v_msg) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_msg)->tp_name), 0))) __PYX_ERR(6, 401, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_msg;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->result_status_msg);
  __Pyx_DECREF(__pyx_v_self->result_status_msg);
  __pyx_v_self->result_status_msg = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/coreproto.pyx":391
 *             self._push_result()
 * 
 *     cdef _parse_msg_command_complete(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             const char* cbuf
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_msg_command_complete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":403
 *         self.result_status_msg = msg
 * 
 *     cdef _parse_copy_data_msgs(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ReadBuffer buf = self.buffer
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_copy_data_msgs(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_copy_data_msgs", 0);

  /* "asyncpg/protocol/coreproto.pyx":405
 *     cdef _parse_copy_data_msgs(self):
 *         cdef:
 *             ReadBuffer buf = self.buffer             # <<<<<<<<<<<<<<
 * 
 *         self.result = buf.consume_messages(b'd')
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->buffer);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":407
 *             ReadBuffer buf = self.buffer
 * 
 *         self.result = buf.consume_messages(b'd')             # <<<<<<<<<<<<<<
 * 
 *         # By this point we have consumed all CopyData messages
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->consume_messages(__pyx_v_buf, 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":416
 *         # we must not push the result here and let the
 *         # _process__copy_out_data subprotocol do the job.
 *         if not buf.take_message():             # <<<<<<<<<<<<<<
 *             self._on_result()
 *             self.result = None
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->take_message(__pyx_v_buf); if (unlikely(__pyx_t_2 == ((int32_t)-1))) __PYX_ERR(6, 416, __pyx_L1_error)
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/coreproto.pyx":417
 *         # _process__copy_out_data subprotocol do the job.
 *         if not buf.take_message():
 *             self._on_result()             # <<<<<<<<<<<<<<
 *             self.result = None
 *         else:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":418
 *         if not buf.take_message():
 *             self._on_result()
 *             self.result = None             # <<<<<<<<<<<<<<
 *         else:
 *             # If there is a message in the buffer, put it back to
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->result);
    __Pyx_DECREF(__pyx_v_self->result);
    __pyx_v_self->result = Py_None;

    /* "asyncpg/protocol/coreproto.pyx":416
 *         # we must not push the result here and let the
 *         # _process__copy_out_data subprotocol do the job.
 *         if not buf.take_message():             # <<<<<<<<<<<<<<
 *             self._on_result()
 *             self.result = None
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/coreproto.pyx":422
 *             # If there is a message in the buffer, put it back to
 *             # be processed by the next protocol iteration.
 *             buf.put_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_copy_data_msg(self, object data):
 */
  /*else*/ {
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->put_message(__pyx_v_buf); if (unlikely(__pyx_t_2 == ((int32_t)-1))) __PYX_ERR(6, 422, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "asyncpg/protocol/coreproto.pyx":403
 *         self.result_status_msg = msg
 * 
 *     cdef _parse_copy_data_msgs(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ReadBuffer buf = self.buffer
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_copy_data_msgs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":424
 *             buf.put_message()
 * 
 *     cdef _write_copy_data_msg(self, object data):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_data_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_v_mview = 0;
  Py_buffer *__pyx_v_pybuf;
  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("_write_copy_data_msg", 0);

  /* "asyncpg/protocol/coreproto.pyx":430
 *             Py_buffer *pybuf
 * 
 *         mview = cpythonx.PyMemoryView_GetContiguous(             # <<<<<<<<<<<<<<
 *             data, cpython.PyBUF_READ, b'C')
 * 
 */
  __pyx_t_1 = PyMemoryView_GetContiguous(__pyx_v_data, PyBUF_READ, 'C'); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mview = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":433
 *             data, cpython.PyBUF_READ, b'C')
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             pybuf = cpythonx.PyMemoryView_GET_BUFFER(mview)
 * 
 */
  /*try:*/ {

    /* "asyncpg/protocol/coreproto.pyx":434
 * 
 *         try:
 *             pybuf = cpythonx.PyMemoryView_GET_BUFFER(mview)             # <<<<<<<<<<<<<<
 * 
 *             buf = WriteBuffer.new_message(b'd')
 */
    __pyx_v_pybuf = PyMemoryView_GET_BUFFER(__pyx_v_mview);

    /* "asyncpg/protocol/coreproto.pyx":436
 *             pybuf = cpythonx.PyMemoryView_GET_BUFFER(mview)
 * 
 *             buf = WriteBuffer.new_message(b'd')             # <<<<<<<<<<<<<<
 *             buf.write_cstr(<const char *>pybuf.buf, pybuf.len)
 *             buf.end_message()
 */
    __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('d')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 436, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":437
 * 
 *             buf = WriteBuffer.new_message(b'd')
 *             buf.write_cstr(<const char *>pybuf.buf, pybuf.len)             # <<<<<<<<<<<<<<
 *             buf.end_message()
 *         finally:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_cstr(__pyx_v_buf, ((char const *)__pyx_v_pybuf->buf), __pyx_v_pybuf->len); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 437, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":438
 *             buf = WriteBuffer.new_message(b'd')
 *             buf.write_cstr(<const char *>pybuf.buf, pybuf.len)
 *             buf.end_message()             # <<<<<<<<<<<<<<
 *         finally:
 *             mview.release()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 438, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asyncpg/protocol/coreproto.pyx":440
 *             buf.end_message()
 *         finally:
 *             mview.release()             # <<<<<<<<<<<<<<
 * 
 *         self._write(buf)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_mview, __pyx_n_s_release); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 440, __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(6, 440, __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;
      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;
      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;
      {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_mview, __pyx_n_s_release); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 440, __pyx_L7_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(6, 440, __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;
      }
      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:;
  }

  /* "asyncpg/protocol/coreproto.pyx":442
 *             mview.release()
 * 
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_copy_done_msg(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":424
 *             buf.put_message()
 * 
 *     cdef _write_copy_data_msg(self, object data):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* 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("asyncpg.protocol.protocol.CoreProtocol._write_copy_data_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_mview);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":444
 *         self._write(buf)
 * 
 *     cdef _write_copy_done_msg(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_done_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  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("_write_copy_done_msg", 0);

  /* "asyncpg/protocol/coreproto.pyx":448
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new_message(b'c')             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('c')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":449
 * 
 *         buf = WriteBuffer.new_message(b'c')
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":450
 *         buf = WriteBuffer.new_message(b'c')
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write_copy_fail_msg(self, str cause):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":444
 *         self._write(buf)
 * 
 *     cdef _write_copy_done_msg(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._write_copy_done_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":452
 *         self._write(buf)
 * 
 *     cdef _write_copy_fail_msg(self, str cause):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_fail_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_cause) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  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("_write_copy_fail_msg", 0);

  /* "asyncpg/protocol/coreproto.pyx":456
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new_message(b'f')             # <<<<<<<<<<<<<<
 *         buf.write_str(cause or '', self.encoding)
 *         buf.end_message()
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('f')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":457
 * 
 *         buf = WriteBuffer.new_message(b'f')
 *         buf.write_str(cause or '', self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_cause); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 457, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __Pyx_INCREF(__pyx_v_cause);
    __pyx_t_1 = __pyx_v_cause;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_u__37);
  __pyx_t_1 = __pyx_kp_u__37;
  __pyx_L3_bool_binop_done:;
  __pyx_t_3 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":458
 *         buf = WriteBuffer.new_message(b'f')
 *         buf.write_str(cause or '', self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":459
 *         buf.write_str(cause or '', self.encoding)
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_data_msgs(self):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":452
 *         self._write(buf)
 * 
 *     cdef _write_copy_fail_msg(self, str cause):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* 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("asyncpg.protocol.protocol.CoreProtocol._write_copy_fail_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":461
 *         self._write(buf)
 * 
 *     cdef _parse_data_msgs(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ReadBuffer buf = self.buffer
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_data_msgs(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_v_rows = 0;
  __pyx_t_7asyncpg_8protocol_8protocol_decode_row_method __pyx_v_decoder;
  __pyx_t_7asyncpg_7pgproto_7pgproto_try_consume_message_method __pyx_v_try_consume_message;
  __pyx_t_7asyncpg_7pgproto_7pgproto_take_message_type_method __pyx_v_take_message_type;
  char const *__pyx_v_cbuf;
  Py_ssize_t __pyx_v_cbuf_len;
  PyObject *__pyx_v_row = 0;
  PyObject *__pyx_v_mem = 0;
  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;
  int32_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_data_msgs", 0);

  /* "asyncpg/protocol/coreproto.pyx":463
 *     cdef _parse_data_msgs(self):
 *         cdef:
 *             ReadBuffer buf = self.buffer             # <<<<<<<<<<<<<<
 *             list rows
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->buffer);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":466
 *             list rows
 * 
 *             decode_row_method decoder = <decode_row_method>self._decode_row             # <<<<<<<<<<<<<<
 *             pgproto.try_consume_message_method try_consume_message = \
 *                 <pgproto.try_consume_message_method>buf.try_consume_message
 */
  __pyx_v_decoder = ((__pyx_t_7asyncpg_8protocol_8protocol_decode_row_method)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_decode_row);

  /* "asyncpg/protocol/coreproto.pyx":468
 *             decode_row_method decoder = <decode_row_method>self._decode_row
 *             pgproto.try_consume_message_method try_consume_message = \
 *                 <pgproto.try_consume_message_method>buf.try_consume_message             # <<<<<<<<<<<<<<
 *             pgproto.take_message_type_method take_message_type = \
 *                 <pgproto.take_message_type_method>buf.take_message_type
 */
  __pyx_v_try_consume_message = ((__pyx_t_7asyncpg_7pgproto_7pgproto_try_consume_message_method)((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->try_consume_message);

  /* "asyncpg/protocol/coreproto.pyx":470
 *                 <pgproto.try_consume_message_method>buf.try_consume_message
 *             pgproto.take_message_type_method take_message_type = \
 *                 <pgproto.take_message_type_method>buf.take_message_type             # <<<<<<<<<<<<<<
 * 
 *             const char* cbuf
 */
  __pyx_v_take_message_type = ((__pyx_t_7asyncpg_7pgproto_7pgproto_take_message_type_method)((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->take_message_type);

  /* "asyncpg/protocol/coreproto.pyx":477
 *             bytes mem
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if buf.get_message_type() != b'D':
 *                 raise apg_exc.InternalClientError(
 */
  __pyx_t_2 = (PG_DEBUG != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/coreproto.pyx":478
 * 
 *         if PG_DEBUG:
 *             if buf.get_message_type() != b'D':             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: first message is not "D"')
 */
    __pyx_t_2 = ((__pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_type(__pyx_v_buf) != 'D') != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/coreproto.pyx":479
 *         if PG_DEBUG:
 *             if buf.get_message_type() != b'D':
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     '_parse_data_msgs: first message is not "D"')
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 479, __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 && 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_parse_data_msgs_first_message_i) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_parse_data_msgs_first_message_i);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 479, __pyx_L1_error)

      /* "asyncpg/protocol/coreproto.pyx":478
 * 
 *         if PG_DEBUG:
 *             if buf.get_message_type() != b'D':             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: first message is not "D"')
 */
    }

    /* "asyncpg/protocol/coreproto.pyx":477
 *             bytes mem
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if buf.get_message_type() != b'D':
 *                 raise apg_exc.InternalClientError(
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":482
 *                     '_parse_data_msgs: first message is not "D"')
 * 
 *         if self._discard_data:             # <<<<<<<<<<<<<<
 *             while take_message_type(buf, b'D'):
 *                 buf.discard_message()
 */
  __pyx_t_2 = (__pyx_v_self->_discard_data != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/coreproto.pyx":483
 * 
 *         if self._discard_data:
 *             while take_message_type(buf, b'D'):             # <<<<<<<<<<<<<<
 *                 buf.discard_message()
 *             return
 */
    while (1) {
      __pyx_t_5 = __pyx_v_take_message_type(((PyObject *)__pyx_v_buf), 'D'); if (unlikely(__pyx_t_5 == ((int32_t)-1))) __PYX_ERR(6, 483, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_5 != 0);
      if (!__pyx_t_2) break;

      /* "asyncpg/protocol/coreproto.pyx":484
 *         if self._discard_data:
 *             while take_message_type(buf, b'D'):
 *                 buf.discard_message()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->discard_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "asyncpg/protocol/coreproto.pyx":485
 *             while take_message_type(buf, b'D'):
 *                 buf.discard_message()
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if PG_DEBUG:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/coreproto.pyx":482
 *                     '_parse_data_msgs: first message is not "D"')
 * 
 *         if self._discard_data:             # <<<<<<<<<<<<<<
 *             while take_message_type(buf, b'D'):
 *                 buf.discard_message()
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":487
 *             return
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if type(self.result) is not list:
 *                 raise apg_exc.InternalClientError(
 */
  __pyx_t_2 = (PG_DEBUG != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/coreproto.pyx":488
 * 
 *         if PG_DEBUG:
 *             if type(self.result) is not list:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: result is not a list, but {!r}'.
 */
    __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_self->result)) != ((PyObject *)(&PyList_Type)));
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (unlikely(__pyx_t_6)) {

      /* "asyncpg/protocol/coreproto.pyx":489
 *         if PG_DEBUG:
 *             if type(self.result) is not list:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     '_parse_data_msgs: result is not a list, but {!r}'.
 *                     format(self.result))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/coreproto.pyx":490
 *             if type(self.result) is not list:
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: result is not a list, but {!r}'.             # <<<<<<<<<<<<<<
 *                     format(self.result))
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_parse_data_msgs_result_is_not_a, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "asyncpg/protocol/coreproto.pyx":491
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: result is not a list, but {!r}'.
 *                     format(self.result))             # <<<<<<<<<<<<<<
 * 
 *         rows = self.result
 */
      __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_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_self->result) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->result);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 491, __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 && 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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __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_1)) __PYX_ERR(6, 489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 489, __pyx_L1_error)

      /* "asyncpg/protocol/coreproto.pyx":488
 * 
 *         if PG_DEBUG:
 *             if type(self.result) is not list:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_parse_data_msgs: result is not a list, but {!r}'.
 */
    }

    /* "asyncpg/protocol/coreproto.pyx":487
 *             return
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if type(self.result) is not list:
 *                 raise apg_exc.InternalClientError(
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":493
 *                     format(self.result))
 * 
 *         rows = self.result             # <<<<<<<<<<<<<<
 *         while take_message_type(buf, b'D'):
 *             cbuf = try_consume_message(buf, &cbuf_len)
 */
  if (!(likely(PyList_CheckExact(__pyx_v_self->result))||((__pyx_v_self->result) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_self->result)->tp_name), 0))) __PYX_ERR(6, 493, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_self->result;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_rows = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":494
 * 
 *         rows = self.result
 *         while take_message_type(buf, b'D'):             # <<<<<<<<<<<<<<
 *             cbuf = try_consume_message(buf, &cbuf_len)
 *             if cbuf != NULL:
 */
  while (1) {
    __pyx_t_5 = __pyx_v_take_message_type(((PyObject *)__pyx_v_buf), 'D'); if (unlikely(__pyx_t_5 == ((int32_t)-1))) __PYX_ERR(6, 494, __pyx_L1_error)
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (!__pyx_t_6) break;

    /* "asyncpg/protocol/coreproto.pyx":495
 *         rows = self.result
 *         while take_message_type(buf, b'D'):
 *             cbuf = try_consume_message(buf, &cbuf_len)             # <<<<<<<<<<<<<<
 *             if cbuf != NULL:
 *                 row = decoder(self, cbuf, cbuf_len)
 */
    __pyx_v_cbuf = __pyx_v_try_consume_message(((PyObject *)__pyx_v_buf), (&__pyx_v_cbuf_len));

    /* "asyncpg/protocol/coreproto.pyx":496
 *         while take_message_type(buf, b'D'):
 *             cbuf = try_consume_message(buf, &cbuf_len)
 *             if cbuf != NULL:             # <<<<<<<<<<<<<<
 *                 row = decoder(self, cbuf, cbuf_len)
 *             else:
 */
    __pyx_t_6 = ((__pyx_v_cbuf != NULL) != 0);
    if (__pyx_t_6) {

      /* "asyncpg/protocol/coreproto.pyx":497
 *             cbuf = try_consume_message(buf, &cbuf_len)
 *             if cbuf != NULL:
 *                 row = decoder(self, cbuf, cbuf_len)             # <<<<<<<<<<<<<<
 *             else:
 *                 mem = buf.consume_message()
 */
      __pyx_t_1 = __pyx_v_decoder(((PyObject *)__pyx_v_self), __pyx_v_cbuf, __pyx_v_cbuf_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/coreproto.pyx":496
 *         while take_message_type(buf, b'D'):
 *             cbuf = try_consume_message(buf, &cbuf_len)
 *             if cbuf != NULL:             # <<<<<<<<<<<<<<
 *                 row = decoder(self, cbuf, cbuf_len)
 *             else:
 */
      goto __pyx_L12;
    }

    /* "asyncpg/protocol/coreproto.pyx":499
 *                 row = decoder(self, cbuf, cbuf_len)
 *             else:
 *                 mem = buf.consume_message()             # <<<<<<<<<<<<<<
 *                 row = decoder(
 *                     self,
 */
    /*else*/ {
      __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_buf->__pyx_vtab)->consume_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_mem, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/coreproto.pyx":500
 *             else:
 *                 mem = buf.consume_message()
 *                 row = decoder(             # <<<<<<<<<<<<<<
 *                     self,
 *                     cpython.PyBytes_AS_STRING(mem),
 */
      __pyx_t_1 = __pyx_v_decoder(((PyObject *)__pyx_v_self), PyBytes_AS_STRING(__pyx_v_mem), PyBytes_GET_SIZE(__pyx_v_mem)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L12:;

    /* "asyncpg/protocol/coreproto.pyx":505
 *                     cpython.PyBytes_GET_SIZE(mem))
 * 
 *             cpython.PyList_Append(rows, row)             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_backend_key_data(self):
 */
    __pyx_t_9 = PyList_Append(__pyx_v_rows, __pyx_v_row); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(6, 505, __pyx_L1_error)
  }

  /* "asyncpg/protocol/coreproto.pyx":461
 *         self._write(buf)
 * 
 *     cdef _parse_data_msgs(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ReadBuffer buf = self.buffer
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_data_msgs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_rows);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XDECREF(__pyx_v_mem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":507
 *             cpython.PyList_Append(rows, row)
 * 
 *     cdef _parse_msg_backend_key_data(self):             # <<<<<<<<<<<<<<
 *         self.backend_pid = self.buffer.read_int32()
 *         self.backend_secret = self.buffer.read_int32()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_backend_key_data(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_msg_backend_key_data", 0);

  /* "asyncpg/protocol/coreproto.pyx":508
 * 
 *     cdef _parse_msg_backend_key_data(self):
 *         self.backend_pid = self.buffer.read_int32()             # <<<<<<<<<<<<<<
 *         self.backend_secret = self.buffer.read_int32()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_int32(__pyx_v_self->buffer); if (unlikely(__pyx_t_1 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 508, __pyx_L1_error)
  __pyx_v_self->backend_pid = __pyx_t_1;

  /* "asyncpg/protocol/coreproto.pyx":509
 *     cdef _parse_msg_backend_key_data(self):
 *         self.backend_pid = self.buffer.read_int32()
 *         self.backend_secret = self.buffer.read_int32()             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_parameter_status(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_int32(__pyx_v_self->buffer); if (unlikely(__pyx_t_1 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 509, __pyx_L1_error)
  __pyx_v_self->backend_secret = __pyx_t_1;

  /* "asyncpg/protocol/coreproto.pyx":507
 *             cpython.PyList_Append(rows, row)
 * 
 *     cdef _parse_msg_backend_key_data(self):             # <<<<<<<<<<<<<<
 *         self.backend_pid = self.buffer.read_int32()
 *         self.backend_secret = self.buffer.read_int32()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_msg_backend_key_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":511
 *         self.backend_secret = self.buffer.read_int32()
 * 
 *     cdef _parse_msg_parameter_status(self):             # <<<<<<<<<<<<<<
 *         name = self.buffer.read_null_str()
 *         name = name.decode(self.encoding)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_parameter_status(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_val = NULL;
  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("_parse_msg_parameter_status", 0);

  /* "asyncpg/protocol/coreproto.pyx":512
 * 
 *     cdef _parse_msg_parameter_status(self):
 *         name = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 *         name = name.decode(self.encoding)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":513
 *     cdef _parse_msg_parameter_status(self):
 *         name = self.buffer.read_null_str()
 *         name = name.decode(self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         val = self.buffer.read_null_str()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 513, __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_self->encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->encoding);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":515
 *         name = name.decode(self.encoding)
 * 
 *         val = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 *         val = val.decode(self.encoding)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_val = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":516
 * 
 *         val = self.buffer.read_null_str()
 *         val = val.decode(self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         self._set_server_parameter(name, val)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 516, __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_self->encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->encoding);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":518
 *         val = val.decode(self.encoding)
 * 
 *         self._set_server_parameter(name, val)             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_notification(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_server_parameter(__pyx_v_self, __pyx_v_name, __pyx_v_val); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":511
 *         self.backend_secret = self.buffer.read_int32()
 * 
 *     cdef _parse_msg_parameter_status(self):             # <<<<<<<<<<<<<<
 *         name = self.buffer.read_null_str()
 *         name = name.decode(self.encoding)
 */

  /* 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("asyncpg.protocol.protocol.CoreProtocol._parse_msg_parameter_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":520
 *         self._set_server_parameter(name, val)
 * 
 *     cdef _parse_msg_notification(self):             # <<<<<<<<<<<<<<
 *         pid = self.buffer.read_int32()
 *         channel = self.buffer.read_null_str().decode(self.encoding)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_notification(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  int32_t __pyx_v_pid;
  PyObject *__pyx_v_channel = NULL;
  PyObject *__pyx_v_payload = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __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("_parse_msg_notification", 0);

  /* "asyncpg/protocol/coreproto.pyx":521
 * 
 *     cdef _parse_msg_notification(self):
 *         pid = self.buffer.read_int32()             # <<<<<<<<<<<<<<
 *         channel = self.buffer.read_null_str().decode(self.encoding)
 *         payload = self.buffer.read_null_str().decode(self.encoding)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_int32(__pyx_v_self->buffer); if (unlikely(__pyx_t_1 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 521, __pyx_L1_error)
  __pyx_v_pid = __pyx_t_1;

  /* "asyncpg/protocol/coreproto.pyx":522
 *     cdef _parse_msg_notification(self):
 *         pid = self.buffer.read_int32()
 *         channel = self.buffer.read_null_str().decode(self.encoding)             # <<<<<<<<<<<<<<
 *         payload = self.buffer.read_null_str().decode(self.encoding)
 *         self._on_notification(pid, channel, payload)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 522, __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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_self->encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->encoding);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_channel = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":523
 *         pid = self.buffer.read_int32()
 *         channel = self.buffer.read_null_str().decode(self.encoding)
 *         payload = self.buffer.read_null_str().decode(self.encoding)             # <<<<<<<<<<<<<<
 *         self._on_notification(pid, channel, payload)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __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_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_self->encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->encoding);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_payload = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":524
 *         channel = self.buffer.read_null_str().decode(self.encoding)
 *         payload = self.buffer.read_null_str().decode(self.encoding)
 *         self._on_notification(pid, channel, payload)             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_authentication(self):
 */
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_pid); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_notification(__pyx_v_self, __pyx_t_2, __pyx_v_channel, __pyx_v_payload); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 524, __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;

  /* "asyncpg/protocol/coreproto.pyx":520
 *         self._set_server_parameter(name, val)
 * 
 *     cdef _parse_msg_notification(self):             # <<<<<<<<<<<<<<
 *         pid = self.buffer.read_int32()
 *         channel = self.buffer.read_null_str().decode(self.encoding)
 */

  /* 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("asyncpg.protocol.protocol.CoreProtocol._parse_msg_notification", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_channel);
  __Pyx_XDECREF(__pyx_v_payload);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":526
 *         self._on_notification(pid, channel, payload)
 * 
 *     cdef _parse_msg_authentication(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int32_t status
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_authentication(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  int32_t __pyx_v_status;
  PyObject *__pyx_v_md5_salt = 0;
  PyObject *__pyx_v_sasl_auth_methods = 0;
  PyObject *__pyx_v_unsupported_sasl_auth_methods = 0;
  PyObject *__pyx_v_auth_method = NULL;
  PyObject *__pyx_v_server_response = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_m = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_msg_authentication", 0);

  /* "asyncpg/protocol/coreproto.pyx":533
 *             list unsupported_sasl_auth_methods
 * 
 *         status = self.buffer.read_int32()             # <<<<<<<<<<<<<<
 * 
 *         if status == AUTH_SUCCESSFUL:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_int32(__pyx_v_self->buffer); if (unlikely(__pyx_t_1 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 533, __pyx_L1_error)
  __pyx_v_status = __pyx_t_1;

  /* "asyncpg/protocol/coreproto.pyx":535
 *         status = self.buffer.read_int32()
 * 
 *         if status == AUTH_SUCCESSFUL:             # <<<<<<<<<<<<<<
 *             # AuthenticationOk
 *             self.result_type = RESULT_OK
 */
  switch (__pyx_v_status) {
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SUCCESSFUL:

    /* "asyncpg/protocol/coreproto.pyx":537
 *         if status == AUTH_SUCCESSFUL:
 *             # AuthenticationOk
 *             self.result_type = RESULT_OK             # <<<<<<<<<<<<<<
 * 
 *         elif status == AUTH_REQUIRED_PASSWORD:
 */
    __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_OK;

    /* "asyncpg/protocol/coreproto.pyx":535
 *         status = self.buffer.read_int32()
 * 
 *         if status == AUTH_SUCCESSFUL:             # <<<<<<<<<<<<<<
 *             # AuthenticationOk
 *             self.result_type = RESULT_OK
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_PASSWORD:

    /* "asyncpg/protocol/coreproto.pyx":541
 *         elif status == AUTH_REQUIRED_PASSWORD:
 *             # AuthenticationCleartextPassword
 *             self.result_type = RESULT_OK             # <<<<<<<<<<<<<<
 *             self.auth_msg = self._auth_password_message_cleartext()
 * 
 */
    __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_OK;

    /* "asyncpg/protocol/coreproto.pyx":542
 *             # AuthenticationCleartextPassword
 *             self.result_type = RESULT_OK
 *             self.auth_msg = self._auth_password_message_cleartext()             # <<<<<<<<<<<<<<
 * 
 *         elif status == AUTH_REQUIRED_PASSWORDMD5:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_auth_password_message_cleartext(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, __pyx_t_2) < 0) __PYX_ERR(6, 542, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":539
 *             self.result_type = RESULT_OK
 * 
 *         elif status == AUTH_REQUIRED_PASSWORD:             # <<<<<<<<<<<<<<
 *             # AuthenticationCleartextPassword
 *             self.result_type = RESULT_OK
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_PASSWORDMD5:

    /* "asyncpg/protocol/coreproto.pyx":547
 *             # AuthenticationMD5Password
 *             # Note: MD5 salt is passed as a four-byte sequence
 *             md5_salt = self.buffer.read_bytes(4)             # <<<<<<<<<<<<<<
 *             self.auth_msg = self._auth_password_message_md5(md5_salt)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_bytes(__pyx_v_self->buffer, 4); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_md5_salt = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":548
 *             # Note: MD5 salt is passed as a four-byte sequence
 *             md5_salt = self.buffer.read_bytes(4)
 *             self.auth_msg = self._auth_password_message_md5(md5_salt)             # <<<<<<<<<<<<<<
 * 
 *         elif status == AUTH_REQUIRED_SASL:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_auth_password_message_md5(__pyx_v_self, __pyx_v_md5_salt); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, __pyx_t_2) < 0) __PYX_ERR(6, 548, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":544
 *             self.auth_msg = self._auth_password_message_cleartext()
 * 
 *         elif status == AUTH_REQUIRED_PASSWORDMD5:             # <<<<<<<<<<<<<<
 *             # AuthenticationMD5Password
 *             # Note: MD5 salt is passed as a four-byte sequence
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SASL:

    /* "asyncpg/protocol/coreproto.pyx":555
 *             # to follow the SCRAM protocol defined in RFC 5802.
 *             # get the SASL authentication methods that the server is providing
 *             sasl_auth_methods = []             # <<<<<<<<<<<<<<
 *             unsupported_sasl_auth_methods = []
 *             # determine if the advertised authentication methods are supported,
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_sasl_auth_methods = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":556
 *             # get the SASL authentication methods that the server is providing
 *             sasl_auth_methods = []
 *             unsupported_sasl_auth_methods = []             # <<<<<<<<<<<<<<
 *             # determine if the advertised authentication methods are supported,
 *             # and if so, add them to the list
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_unsupported_sasl_auth_methods = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":559
 *             # determine if the advertised authentication methods are supported,
 *             # and if so, add them to the list
 *             auth_method = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 *             while auth_method:
 *                 if auth_method in SCRAMAuthentication.AUTHENTICATION_METHODS:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_auth_method = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":560
 *             # and if so, add them to the list
 *             auth_method = self.buffer.read_null_str()
 *             while auth_method:             # <<<<<<<<<<<<<<
 *                 if auth_method in SCRAMAuthentication.AUTHENTICATION_METHODS:
 *                     sasl_auth_methods.append(auth_method)
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_auth_method); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 560, __pyx_L1_error)
      if (!__pyx_t_3) break;

      /* "asyncpg/protocol/coreproto.pyx":561
 *             auth_method = self.buffer.read_null_str()
 *             while auth_method:
 *                 if auth_method in SCRAMAuthentication.AUTHENTICATION_METHODS:             # <<<<<<<<<<<<<<
 *                     sasl_auth_methods.append(auth_method)
 *                 else:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication), __pyx_n_s_AUTHENTICATION_METHODS); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_auth_method, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 561, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (__pyx_t_3 != 0);
      if (__pyx_t_4) {

        /* "asyncpg/protocol/coreproto.pyx":562
 *             while auth_method:
 *                 if auth_method in SCRAMAuthentication.AUTHENTICATION_METHODS:
 *                     sasl_auth_methods.append(auth_method)             # <<<<<<<<<<<<<<
 *                 else:
 *                     unsupported_sasl_auth_methods.append(auth_method)
 */
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_sasl_auth_methods, __pyx_v_auth_method); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(6, 562, __pyx_L1_error)

        /* "asyncpg/protocol/coreproto.pyx":561
 *             auth_method = self.buffer.read_null_str()
 *             while auth_method:
 *                 if auth_method in SCRAMAuthentication.AUTHENTICATION_METHODS:             # <<<<<<<<<<<<<<
 *                     sasl_auth_methods.append(auth_method)
 *                 else:
 */
        goto __pyx_L5;
      }

      /* "asyncpg/protocol/coreproto.pyx":564
 *                     sasl_auth_methods.append(auth_method)
 *                 else:
 *                     unsupported_sasl_auth_methods.append(auth_method)             # <<<<<<<<<<<<<<
 *                 auth_method = self.buffer.read_null_str()
 * 
 */
      /*else*/ {
        __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_unsupported_sasl_auth_methods, __pyx_v_auth_method); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(6, 564, __pyx_L1_error)
      }
      __pyx_L5:;

      /* "asyncpg/protocol/coreproto.pyx":565
 *                 else:
 *                     unsupported_sasl_auth_methods.append(auth_method)
 *                 auth_method = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 * 
 *             # if none of the advertised authentication methods are supported,
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_auth_method, __pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "asyncpg/protocol/coreproto.pyx":570
 *             # raise an error
 *             # otherwise, initialize the SASL authentication exchange
 *             if not sasl_auth_methods:             # <<<<<<<<<<<<<<
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")
 *                     for m in unsupported_sasl_auth_methods]
 */
    __pyx_t_4 = (PyList_GET_SIZE(__pyx_v_sasl_auth_methods) != 0);
    __pyx_t_3 = ((!__pyx_t_4) != 0);
    if (__pyx_t_3) {

      /* "asyncpg/protocol/coreproto.pyx":571
 *             # otherwise, initialize the SASL authentication exchange
 *             if not sasl_auth_methods:
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")             # <<<<<<<<<<<<<<
 *                     for m in unsupported_sasl_auth_methods]
 *                 self.result_type = RESULT_FAILED
 */
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 571, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_2);

        /* "asyncpg/protocol/coreproto.pyx":572
 *             if not sasl_auth_methods:
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")
 *                     for m in unsupported_sasl_auth_methods]             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(
 */
        __pyx_t_6 = __pyx_v_unsupported_sasl_auth_methods; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
        for (;;) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(6, 572, __pyx_L9_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 572, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_m, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "asyncpg/protocol/coreproto.pyx":571
 *             # otherwise, initialize the SASL authentication exchange
 *             if not sasl_auth_methods:
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")             # <<<<<<<<<<<<<<
 *                     for m in unsupported_sasl_auth_methods]
 *                 self.result_type = RESULT_FAILED
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr9__pyx_v_m, __pyx_n_s_decode); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 571, __pyx_L9_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_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_n_u_ascii);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 571, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(6, 571, __pyx_L9_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "asyncpg/protocol/coreproto.pyx":572
 *             if not sasl_auth_methods:
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")
 *                     for m in unsupported_sasl_auth_methods]             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(
 */
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_m); __pyx_8genexpr9__pyx_v_m = 0;
        goto __pyx_L12_exit_scope;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_m); __pyx_8genexpr9__pyx_v_m = 0;
        goto __pyx_L1_error;
        __pyx_L12_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_unsupported_sasl_auth_methods, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/coreproto.pyx":573
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")
 *                     for m in unsupported_sasl_auth_methods]
 *                 self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *                 self.result = apg_exc.InterfaceError(
 *                     'unsupported SASL Authentication methods requested by the '
 */
      __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

      /* "asyncpg/protocol/coreproto.pyx":574
 *                     for m in unsupported_sasl_auth_methods]
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                     'unsupported SASL Authentication methods requested by the '
 *                     'server: {!r}'.format(
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/coreproto.pyx":576
 *                 self.result = apg_exc.InterfaceError(
 *                     'unsupported SASL Authentication methods requested by the '
 *                     'server: {!r}'.format(             # <<<<<<<<<<<<<<
 *                         ", ".join(unsupported_sasl_auth_methods)))
 *             else:
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unsupported_SASL_Authentication, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "asyncpg/protocol/coreproto.pyx":577
 *                     'unsupported SASL Authentication methods requested by the '
 *                     'server: {!r}'.format(
 *                         ", ".join(unsupported_sasl_auth_methods)))             # <<<<<<<<<<<<<<
 *             else:
 *                 self.auth_msg = self._auth_password_message_sasl_initial(
 */
      __pyx_t_10 = PyUnicode_Join(__pyx_kp_u__41, __pyx_v_unsupported_sasl_auth_methods); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_6 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asyncpg/protocol/coreproto.pyx":574
 *                     for m in unsupported_sasl_auth_methods]
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                     'unsupported SASL Authentication methods requested by the '
 *                     'server: {!r}'.format(
 */
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->result);
      __Pyx_DECREF(__pyx_v_self->result);
      __pyx_v_self->result = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/coreproto.pyx":570
 *             # raise an error
 *             # otherwise, initialize the SASL authentication exchange
 *             if not sasl_auth_methods:             # <<<<<<<<<<<<<<
 *                 unsupported_sasl_auth_methods = [m.decode("ascii")
 *                     for m in unsupported_sasl_auth_methods]
 */
      goto __pyx_L6;
    }

    /* "asyncpg/protocol/coreproto.pyx":579
 *                         ", ".join(unsupported_sasl_auth_methods)))
 *             else:
 *                 self.auth_msg = self._auth_password_message_sasl_initial(             # <<<<<<<<<<<<<<
 *                     sasl_auth_methods)
 * 
 */
    /*else*/ {

      /* "asyncpg/protocol/coreproto.pyx":580
 *             else:
 *                 self.auth_msg = self._auth_password_message_sasl_initial(
 *                     sasl_auth_methods)             # <<<<<<<<<<<<<<
 * 
 *         elif status == AUTH_SASL_CONTINUE:
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_auth_password_message_sasl_initial(__pyx_v_self, __pyx_v_sasl_auth_methods); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "asyncpg/protocol/coreproto.pyx":579
 *                         ", ".join(unsupported_sasl_auth_methods)))
 *             else:
 *                 self.auth_msg = self._auth_password_message_sasl_initial(             # <<<<<<<<<<<<<<
 *                     sasl_auth_methods)
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, __pyx_t_2) < 0) __PYX_ERR(6, 579, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L6:;

    /* "asyncpg/protocol/coreproto.pyx":550
 *             self.auth_msg = self._auth_password_message_md5(md5_salt)
 * 
 *         elif status == AUTH_REQUIRED_SASL:             # <<<<<<<<<<<<<<
 *             # AuthenticationSASL
 *             # This requires making additional requests to the server in order
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_CONTINUE:

    /* "asyncpg/protocol/coreproto.pyx":588
 *             # if this is valid.
 *             # The client builds a challenge response to the server
 *             server_response = self.buffer.consume_message()             # <<<<<<<<<<<<<<
 *             self.auth_msg = self._auth_password_message_sasl_continue(
 *                 server_response)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->consume_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_server_response = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":589
 *             # The client builds a challenge response to the server
 *             server_response = self.buffer.consume_message()
 *             self.auth_msg = self._auth_password_message_sasl_continue(             # <<<<<<<<<<<<<<
 *                 server_response)
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_auth_password_message_sasl_continue(__pyx_v_self, __pyx_v_server_response); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_auth_msg, __pyx_t_2) < 0) __PYX_ERR(6, 589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":582
 *                     sasl_auth_methods)
 * 
 *         elif status == AUTH_SASL_CONTINUE:             # <<<<<<<<<<<<<<
 *             # AUTH_SASL_CONTINUE
 *             # this requeires sending the second part of the SASL exchange, where
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_FINAL:

    /* "asyncpg/protocol/coreproto.pyx":594
 *         elif status == AUTH_SASL_FINAL:
 *             # AUTH_SASL_FINAL
 *             server_response = self.buffer.consume_message()             # <<<<<<<<<<<<<<
 *             if not self.scram.verify_server_final_message(server_response):
 *                 self.result_type = RESULT_FAILED
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->consume_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_server_response = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":595
 *             # AUTH_SASL_FINAL
 *             server_response = self.buffer.consume_message()
 *             if not self.scram.verify_server_final_message(server_response):             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(
 */
    __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_verify_server_final_message(__pyx_v_self->scram, __pyx_v_server_response); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 595, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = ((!__pyx_t_3) != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/coreproto.pyx":596
 *             server_response = self.buffer.consume_message()
 *             if not self.scram.verify_server_final_message(server_response):
 *                 self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *                 self.result = apg_exc.InterfaceError(
 *                     'could not verify server signature for '
 */
      __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

      /* "asyncpg/protocol/coreproto.pyx":597
 *             if not self.scram.verify_server_final_message(server_response):
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                     'could not verify server signature for '
 *                     'SCRAM authentciation: scram-sha-256',
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 597, __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_6))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_kp_u_could_not_verify_server_signatur) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_could_not_verify_server_signatur);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->result);
      __Pyx_DECREF(__pyx_v_self->result);
      __pyx_v_self->result = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "asyncpg/protocol/coreproto.pyx":595
 *             # AUTH_SASL_FINAL
 *             server_response = self.buffer.consume_message()
 *             if not self.scram.verify_server_final_message(server_response):             # <<<<<<<<<<<<<<
 *                 self.result_type = RESULT_FAILED
 *                 self.result = apg_exc.InterfaceError(
 */
    }

    /* "asyncpg/protocol/coreproto.pyx":592
 *                 server_response)
 * 
 *         elif status == AUTH_SASL_FINAL:             # <<<<<<<<<<<<<<
 *             # AUTH_SASL_FINAL
 *             server_response = self.buffer.consume_message()
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_KERBEROS:

    /* "asyncpg/protocol/coreproto.pyx":602
 *                 )
 * 
 *         elif status in (AUTH_REQUIRED_KERBEROS, AUTH_REQUIRED_SCMCRED,             # <<<<<<<<<<<<<<
 *                         AUTH_REQUIRED_GSS, AUTH_REQUIRED_GSS_CONTINUE,
 *                         AUTH_REQUIRED_SSPI):
 */
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SCMCRED:
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_GSS:

    /* "asyncpg/protocol/coreproto.pyx":603
 * 
 *         elif status in (AUTH_REQUIRED_KERBEROS, AUTH_REQUIRED_SCMCRED,
 *                         AUTH_REQUIRED_GSS, AUTH_REQUIRED_GSS_CONTINUE,             # <<<<<<<<<<<<<<
 *                         AUTH_REQUIRED_SSPI):
 *             self.result_type = RESULT_FAILED
 */
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_GSS_CONTINUE:
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_REQUIRED_SSPI:

    /* "asyncpg/protocol/coreproto.pyx":605
 *                         AUTH_REQUIRED_GSS, AUTH_REQUIRED_GSS_CONTINUE,
 *                         AUTH_REQUIRED_SSPI):
 *             self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *             self.result = apg_exc.InterfaceError(
 *                 'unsupported authentication method requested by the '
 */
    __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

    /* "asyncpg/protocol/coreproto.pyx":606
 *                         AUTH_REQUIRED_SSPI):
 *             self.result_type = RESULT_FAILED
 *             self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'unsupported authentication method requested by the '
 *                 'server: {!r}'.format(AUTH_METHOD_NAME[status]))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/coreproto.pyx":608
 *             self.result = apg_exc.InterfaceError(
 *                 'unsupported authentication method requested by the '
 *                 'server: {!r}'.format(AUTH_METHOD_NAME[status]))             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unsupported_authentication_metho, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_AUTH_METHOD_NAME); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, __pyx_v_status, int32_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __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_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "asyncpg/protocol/coreproto.pyx":606
 *                         AUTH_REQUIRED_SSPI):
 *             self.result_type = RESULT_FAILED
 *             self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'unsupported authentication method requested by the '
 *                 'server: {!r}'.format(AUTH_METHOD_NAME[status]))
 */
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->result);
    __Pyx_DECREF(__pyx_v_self->result);
    __pyx_v_self->result = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":602
 *                 )
 * 
 *         elif status in (AUTH_REQUIRED_KERBEROS, AUTH_REQUIRED_SCMCRED,             # <<<<<<<<<<<<<<
 *                         AUTH_REQUIRED_GSS, AUTH_REQUIRED_GSS_CONTINUE,
 *                         AUTH_REQUIRED_SSPI):
 */
    break;
    default:

    /* "asyncpg/protocol/coreproto.pyx":611
 * 
 *         else:
 *             self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *             self.result = apg_exc.InterfaceError(
 *                 'unsupported authentication method requested by the '
 */
    __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

    /* "asyncpg/protocol/coreproto.pyx":612
 *         else:
 *             self.result_type = RESULT_FAILED
 *             self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'unsupported authentication method requested by the '
 *                 'server: {}'.format(status))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "asyncpg/protocol/coreproto.pyx":614
 *             self.result = apg_exc.InterfaceError(
 *                 'unsupported authentication method requested by the '
 *                 'server: {}'.format(status))             # <<<<<<<<<<<<<<
 * 
 *         if status not in [AUTH_SASL_CONTINUE, AUTH_SASL_FINAL]:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unsupported_authentication_metho_2, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyInt_From_int32_t(__pyx_v_status); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __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_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __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_2)) __PYX_ERR(6, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/coreproto.pyx":612
 *         else:
 *             self.result_type = RESULT_FAILED
 *             self.result = apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'unsupported authentication method requested by the '
 *                 'server: {}'.format(status))
 */
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->result);
    __Pyx_DECREF(__pyx_v_self->result);
    __pyx_v_self->result = __pyx_t_2;
    __pyx_t_2 = 0;
    break;
  }

  /* "asyncpg/protocol/coreproto.pyx":616
 *                 'server: {}'.format(status))
 * 
 *         if status not in [AUTH_SASL_CONTINUE, AUTH_SASL_FINAL]:             # <<<<<<<<<<<<<<
 *             self.buffer.discard_message()
 * 
 */
  switch (__pyx_v_status) {
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_CONTINUE:
    case __pyx_e_7asyncpg_8protocol_8protocol_AUTH_SASL_FINAL:
    __pyx_t_4 = 0;
    break;
    default:
    __pyx_t_4 = 1;
    break;
  }
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/coreproto.pyx":617
 * 
 *         if status not in [AUTH_SASL_CONTINUE, AUTH_SASL_FINAL]:
 *             self.buffer.discard_message()             # <<<<<<<<<<<<<<
 * 
 *     cdef _auth_password_message_cleartext(self):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->discard_message(__pyx_v_self->buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":616
 *                 'server: {}'.format(status))
 * 
 *         if status not in [AUTH_SASL_CONTINUE, AUTH_SASL_FINAL]:             # <<<<<<<<<<<<<<
 *             self.buffer.discard_message()
 * 
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":526
 *         self._on_notification(pid, channel, payload)
 * 
 *     cdef _parse_msg_authentication(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int32_t status
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_msg_authentication", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_md5_salt);
  __Pyx_XDECREF(__pyx_v_sasl_auth_methods);
  __Pyx_XDECREF(__pyx_v_unsupported_sasl_auth_methods);
  __Pyx_XDECREF(__pyx_v_auth_method);
  __Pyx_XDECREF(__pyx_v_server_response);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":619
 *             self.buffer.discard_message()
 * 
 *     cdef _auth_password_message_cleartext(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_cleartext(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_msg = 0;
  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("_auth_password_message_cleartext", 0);

  /* "asyncpg/protocol/coreproto.pyx":623
 *             WriteBuffer msg
 * 
 *         msg = WriteBuffer.new_message(b'p')             # <<<<<<<<<<<<<<
 *         msg.write_bytestring(self.password.encode('ascii'))
 *         msg.end_message()
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('p')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_msg = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":624
 * 
 *         msg = WriteBuffer.new_message(b'p')
 *         msg.write_bytestring(self.password.encode('ascii'))             # <<<<<<<<<<<<<<
 *         msg.end_message()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_password); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 624, __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_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_ascii);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 624, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->write_bytestring(__pyx_v_msg, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 624, __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;

  /* "asyncpg/protocol/coreproto.pyx":625
 *         msg = WriteBuffer.new_message(b'p')
 *         msg.write_bytestring(self.password.encode('ascii'))
 *         msg.end_message()             # <<<<<<<<<<<<<<
 * 
 *         return msg
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->end_message(__pyx_v_msg); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/coreproto.pyx":627
 *         msg.end_message()
 * 
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef _auth_password_message_md5(self, bytes salt):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  __pyx_r = ((PyObject *)__pyx_v_msg);
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":619
 *             self.buffer.discard_message()
 * 
 *     cdef _auth_password_message_cleartext(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._auth_password_message_cleartext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":629
 *         return msg
 * 
 *     cdef _auth_password_message_md5(self, bytes salt):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_md5(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_salt) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_msg = 0;
  PyObject *__pyx_v_userpass = NULL;
  PyObject *__pyx_v_hash = 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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_auth_password_message_md5", 0);

  /* "asyncpg/protocol/coreproto.pyx":633
 *             WriteBuffer msg
 * 
 *         msg = WriteBuffer.new_message(b'p')             # <<<<<<<<<<<<<<
 * 
 *         # 'md5' + md5(md5(password + username) + salt))
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('p')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_msg = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":636
 * 
 *         # 'md5' + md5(md5(password + username) + salt))
 *         userpass = ((self.password or '') + (self.user or '')).encode('ascii')             # <<<<<<<<<<<<<<
 *         hash = hashlib_md5(hashlib_md5(userpass).hexdigest().\
 *                 encode('ascii') + salt).hexdigest().encode('ascii')
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_password); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(6, 636, __pyx_L1_error)
  if (!__pyx_t_4) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_u__37);
  __pyx_t_2 = __pyx_kp_u__37;
  __pyx_L3_bool_binop_done:;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_user); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(6, 636, __pyx_L1_error)
  if (!__pyx_t_4) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_u__37);
  __pyx_t_3 = __pyx_kp_u__37;
  __pyx_L5_bool_binop_done:;
  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 636, __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_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __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_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_ascii);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_userpass = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":637
 *         # 'md5' + md5(md5(password + username) + salt))
 *         userpass = ((self.password or '') + (self.user or '')).encode('ascii')
 *         hash = hashlib_md5(hashlib_md5(userpass).hexdigest().\             # <<<<<<<<<<<<<<
 *                 encode('ascii') + salt).hexdigest().encode('ascii')
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_hashlib_md5); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asyncpg/protocol/coreproto.pyx":638
 *         userpass = ((self.password or '') + (self.user or '')).encode('ascii')
 *         hash = hashlib_md5(hashlib_md5(userpass).hexdigest().\
 *                 encode('ascii') + salt).hexdigest().encode('ascii')             # <<<<<<<<<<<<<<
 * 
 *         msg.write_bytestring(b'md5' + hash)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_hashlib_md5); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "asyncpg/protocol/coreproto.pyx":637
 *         # 'md5' + md5(md5(password + username) + salt))
 *         userpass = ((self.password or '') + (self.user or '')).encode('ascii')
 *         hash = hashlib_md5(hashlib_md5(userpass).hexdigest().\             # <<<<<<<<<<<<<<
 *                 encode('ascii') + salt).hexdigest().encode('ascii')
 * 
 */
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_userpass) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_userpass);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 637, __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_CallOneArg(__pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_n_u_ascii);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "asyncpg/protocol/coreproto.pyx":638
 *         userpass = ((self.password or '') + (self.user or '')).encode('ascii')
 *         hash = hashlib_md5(hashlib_md5(userpass).hexdigest().\
 *                 encode('ascii') + salt).hexdigest().encode('ascii')             # <<<<<<<<<<<<<<
 * 
 *         msg.write_bytestring(b'md5' + hash)
 */
  __pyx_t_9 = PyNumber_Add(__pyx_t_6, __pyx_v_salt); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  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_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 637, __pyx_L1_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_hexdigest); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __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_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 638, __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_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 638, __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_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_ascii);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hash = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":640
 *                 encode('ascii') + salt).hexdigest().encode('ascii')
 * 
 *         msg.write_bytestring(b'md5' + hash)             # <<<<<<<<<<<<<<
 *         msg.end_message()
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_n_b_md5, __pyx_v_hash); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 640, __pyx_L1_error)
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->write_bytestring(__pyx_v_msg, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 640, __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;

  /* "asyncpg/protocol/coreproto.pyx":641
 * 
 *         msg.write_bytestring(b'md5' + hash)
 *         msg.end_message()             # <<<<<<<<<<<<<<
 * 
 *         return msg
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->end_message(__pyx_v_msg); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":643
 *         msg.end_message()
 * 
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef _auth_password_message_sasl_initial(self, list sasl_auth_methods):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  __pyx_r = ((PyObject *)__pyx_v_msg);
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":629
 *         return msg
 * 
 *     cdef _auth_password_message_md5(self, bytes salt):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

  /* 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_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("asyncpg.protocol.protocol.CoreProtocol._auth_password_message_md5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_userpass);
  __Pyx_XDECREF(__pyx_v_hash);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":645
 *         return msg
 * 
 *     cdef _auth_password_message_sasl_initial(self, list sasl_auth_methods):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_initial(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_sasl_auth_methods) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_msg = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_auth_password_message_sasl_initial", 0);

  /* "asyncpg/protocol/coreproto.pyx":650
 * 
 *         # use the first supported advertized mechanism
 *         self.scram = SCRAMAuthentication(sasl_auth_methods[0])             # <<<<<<<<<<<<<<
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')
 */
  if (unlikely(__pyx_v_sasl_auth_methods == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(6, 650, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_sasl_auth_methods, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->scram);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->scram));
  __pyx_v_self->scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":652
 *         self.scram = SCRAMAuthentication(sasl_auth_methods[0])
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')             # <<<<<<<<<<<<<<
 *         msg.write_bytes(self.scram.create_client_first_message(self.user or ''))
 *         msg.end_message()
 */
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('p')); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_msg = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":653
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')
 *         msg.write_bytes(self.scram.create_client_first_message(self.user or ''))             # <<<<<<<<<<<<<<
 *         msg.end_message()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 653, __pyx_L1_error)
  if (!__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 653, __pyx_L1_error)
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_u__37);
  __pyx_t_2 = __pyx_kp_u__37;
  __pyx_L3_bool_binop_done:;
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_first_message(__pyx_v_self->scram, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 653, __pyx_L1_error)
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->write_bytes(__pyx_v_msg, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 653, __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;

  /* "asyncpg/protocol/coreproto.pyx":654
 *         msg = WriteBuffer.new_message(b'p')
 *         msg.write_bytes(self.scram.create_client_first_message(self.user or ''))
 *         msg.end_message()             # <<<<<<<<<<<<<<
 * 
 *         return msg
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->end_message(__pyx_v_msg); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":656
 *         msg.end_message()
 * 
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef _auth_password_message_sasl_continue(self, bytes server_response):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  __pyx_r = ((PyObject *)__pyx_v_msg);
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":645
 *         return msg
 * 
 *     cdef _auth_password_message_sasl_initial(self, list sasl_auth_methods):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._auth_password_message_sasl_initial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":658
 *         return msg
 * 
 *     cdef _auth_password_message_sasl_continue(self, bytes server_response):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_continue(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_server_response) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_msg = 0;
  PyObject *__pyx_v_client_final_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_auth_password_message_sasl_continue", 0);

  /* "asyncpg/protocol/coreproto.pyx":663
 * 
 *         # determine if there is a valid server response
 *         self.scram.parse_server_first_message(server_response)             # <<<<<<<<<<<<<<
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_parse_server_first_message(__pyx_v_self->scram, __pyx_v_server_response); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":665
 *         self.scram.parse_server_first_message(server_response)
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')             # <<<<<<<<<<<<<<
 *         client_final_message = self.scram.create_client_final_message(
 *             self.password or '')
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('p')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_msg = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":667
 *         msg = WriteBuffer.new_message(b'p')
 *         client_final_message = self.scram.create_client_final_message(
 *             self.password or '')             # <<<<<<<<<<<<<<
 *         msg.write_bytes(client_final_message)
 *         msg.end_message()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_password); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 667, __pyx_L1_error)
  if (!__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(6, 667, __pyx_L1_error)
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_u__37);
  __pyx_t_1 = __pyx_kp_u__37;
  __pyx_L3_bool_binop_done:;

  /* "asyncpg/protocol/coreproto.pyx":666
 *         # this involves a call and response with the server
 *         msg = WriteBuffer.new_message(b'p')
 *         client_final_message = self.scram.create_client_final_message(             # <<<<<<<<<<<<<<
 *             self.password or '')
 *         msg.write_bytes(client_final_message)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_final_message(__pyx_v_self->scram, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_client_final_message = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":668
 *         client_final_message = self.scram.create_client_final_message(
 *             self.password or '')
 *         msg.write_bytes(client_final_message)             # <<<<<<<<<<<<<<
 *         msg.end_message()
 * 
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_client_final_message))||((__pyx_v_client_final_message) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_client_final_message)->tp_name), 0))) __PYX_ERR(6, 668, __pyx_L1_error)
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->write_bytes(__pyx_v_msg, ((PyObject*)__pyx_v_client_final_message)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":669
 *             self.password or '')
 *         msg.write_bytes(client_final_message)
 *         msg.end_message()             # <<<<<<<<<<<<<<
 * 
 *         return msg
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_msg->__pyx_vtab)->end_message(__pyx_v_msg); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":671
 *         msg.end_message()
 * 
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_ready_for_query(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  __pyx_r = ((PyObject *)__pyx_v_msg);
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":658
 *         return msg
 * 
 *     cdef _auth_password_message_sasl_continue(self, bytes server_response):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer msg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._auth_password_message_sasl_continue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_client_final_message);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":673
 *         return msg
 * 
 *     cdef _parse_msg_ready_for_query(self):             # <<<<<<<<<<<<<<
 *         cdef char status = self.buffer.read_byte()
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_ready_for_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  char __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_msg_ready_for_query", 0);

  /* "asyncpg/protocol/coreproto.pyx":674
 * 
 *     cdef _parse_msg_ready_for_query(self):
 *         cdef char status = self.buffer.read_byte()             # <<<<<<<<<<<<<<
 * 
 *         if status == b'I':
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_byte(__pyx_v_self->buffer); if (unlikely(__pyx_t_1 == ((char)-1) && PyErr_Occurred())) __PYX_ERR(6, 674, __pyx_L1_error)
  __pyx_v_status = __pyx_t_1;

  /* "asyncpg/protocol/coreproto.pyx":676
 *         cdef char status = self.buffer.read_byte()
 * 
 *         if status == b'I':             # <<<<<<<<<<<<<<
 *             self.xact_status = PQTRANS_IDLE
 *         elif status == b'T':
 */
  switch (__pyx_v_status) {
    case 'I':

    /* "asyncpg/protocol/coreproto.pyx":677
 * 
 *         if status == b'I':
 *             self.xact_status = PQTRANS_IDLE             # <<<<<<<<<<<<<<
 *         elif status == b'T':
 *             self.xact_status = PQTRANS_INTRANS
 */
    __pyx_v_self->xact_status = __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_IDLE;

    /* "asyncpg/protocol/coreproto.pyx":676
 *         cdef char status = self.buffer.read_byte()
 * 
 *         if status == b'I':             # <<<<<<<<<<<<<<
 *             self.xact_status = PQTRANS_IDLE
 *         elif status == b'T':
 */
    break;
    case 'T':

    /* "asyncpg/protocol/coreproto.pyx":679
 *             self.xact_status = PQTRANS_IDLE
 *         elif status == b'T':
 *             self.xact_status = PQTRANS_INTRANS             # <<<<<<<<<<<<<<
 *         elif status == b'E':
 *             self.xact_status = PQTRANS_INERROR
 */
    __pyx_v_self->xact_status = __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INTRANS;

    /* "asyncpg/protocol/coreproto.pyx":678
 *         if status == b'I':
 *             self.xact_status = PQTRANS_IDLE
 *         elif status == b'T':             # <<<<<<<<<<<<<<
 *             self.xact_status = PQTRANS_INTRANS
 *         elif status == b'E':
 */
    break;
    case 'E':

    /* "asyncpg/protocol/coreproto.pyx":681
 *             self.xact_status = PQTRANS_INTRANS
 *         elif status == b'E':
 *             self.xact_status = PQTRANS_INERROR             # <<<<<<<<<<<<<<
 *         else:
 *             self.xact_status = PQTRANS_UNKNOWN
 */
    __pyx_v_self->xact_status = __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_INERROR;

    /* "asyncpg/protocol/coreproto.pyx":680
 *         elif status == b'T':
 *             self.xact_status = PQTRANS_INTRANS
 *         elif status == b'E':             # <<<<<<<<<<<<<<
 *             self.xact_status = PQTRANS_INERROR
 *         else:
 */
    break;
    default:

    /* "asyncpg/protocol/coreproto.pyx":683
 *             self.xact_status = PQTRANS_INERROR
 *         else:
 *             self.xact_status = PQTRANS_UNKNOWN             # <<<<<<<<<<<<<<
 * 
 *     cdef _parse_msg_error_response(self, is_error):
 */
    __pyx_v_self->xact_status = __pyx_e_7asyncpg_8protocol_8protocol_PQTRANS_UNKNOWN;
    break;
  }

  /* "asyncpg/protocol/coreproto.pyx":673
 *         return msg
 * 
 *     cdef _parse_msg_ready_for_query(self):             # <<<<<<<<<<<<<<
 *         cdef char status = self.buffer.read_byte()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_msg_ready_for_query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":685
 *             self.xact_status = PQTRANS_UNKNOWN
 * 
 *     cdef _parse_msg_error_response(self, is_error):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char code
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_error_response(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_is_error) {
  char __pyx_v_code;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_parsed = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_msg_error_response", 0);

  /* "asyncpg/protocol/coreproto.pyx":689
 *             char code
 *             bytes message
 *             dict parsed = {}             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_parsed = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":691
 *             dict parsed = {}
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             code = self.buffer.read_byte()
 *             if code == 0:
 */
  while (1) {

    /* "asyncpg/protocol/coreproto.pyx":692
 * 
 *         while True:
 *             code = self.buffer.read_byte()             # <<<<<<<<<<<<<<
 *             if code == 0:
 *                 break
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_byte(__pyx_v_self->buffer); if (unlikely(__pyx_t_2 == ((char)-1) && PyErr_Occurred())) __PYX_ERR(6, 692, __pyx_L1_error)
    __pyx_v_code = __pyx_t_2;

    /* "asyncpg/protocol/coreproto.pyx":693
 *         while True:
 *             code = self.buffer.read_byte()
 *             if code == 0:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_3 = ((__pyx_v_code == 0) != 0);
    if (__pyx_t_3) {

      /* "asyncpg/protocol/coreproto.pyx":694
 *             code = self.buffer.read_byte()
 *             if code == 0:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             message = self.buffer.read_null_str()
 */
      goto __pyx_L4_break;

      /* "asyncpg/protocol/coreproto.pyx":693
 *         while True:
 *             code = self.buffer.read_byte()
 *             if code == 0:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    }

    /* "asyncpg/protocol/coreproto.pyx":696
 *                 break
 * 
 *             message = self.buffer.read_null_str()             # <<<<<<<<<<<<<<
 * 
 *             parsed[chr(code)] = message.decode()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->buffer->__pyx_vtab)->read_null_str(__pyx_v_self->buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 696, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_message, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":698
 *             message = self.buffer.read_null_str()
 * 
 *             parsed[chr(code)] = message.decode()             # <<<<<<<<<<<<<<
 * 
 *         if is_error:
 */
    if (unlikely(__pyx_v_message == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
      __PYX_ERR(6, 698, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_message, 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_From_char(__pyx_v_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_parsed, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(6, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L4_break:;

  /* "asyncpg/protocol/coreproto.pyx":700
 *             parsed[chr(code)] = message.decode()
 * 
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.result_type = RESULT_FAILED
 *             self.result = parsed
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_error); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(6, 700, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "asyncpg/protocol/coreproto.pyx":701
 * 
 *         if is_error:
 *             self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *             self.result = parsed
 *         else:
 */
    __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

    /* "asyncpg/protocol/coreproto.pyx":702
 *         if is_error:
 *             self.result_type = RESULT_FAILED
 *             self.result = parsed             # <<<<<<<<<<<<<<
 *         else:
 *             return parsed
 */
    __Pyx_INCREF(__pyx_v_parsed);
    __Pyx_GIVEREF(__pyx_v_parsed);
    __Pyx_GOTREF(__pyx_v_self->result);
    __Pyx_DECREF(__pyx_v_self->result);
    __pyx_v_self->result = __pyx_v_parsed;

    /* "asyncpg/protocol/coreproto.pyx":700
 *             parsed[chr(code)] = message.decode()
 * 
 *         if is_error:             # <<<<<<<<<<<<<<
 *             self.result_type = RESULT_FAILED
 *             self.result = parsed
 */
    goto __pyx_L6;
  }

  /* "asyncpg/protocol/coreproto.pyx":704
 *             self.result = parsed
 *         else:
 *             return parsed             # <<<<<<<<<<<<<<
 * 
 *     cdef _push_result(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_parsed);
    __pyx_r = __pyx_v_parsed;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "asyncpg/protocol/coreproto.pyx":685
 *             self.xact_status = PQTRANS_UNKNOWN
 * 
 *     cdef _parse_msg_error_response(self, is_error):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char code
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._parse_msg_error_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_parsed);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":706
 *             return parsed
 * 
 *     cdef _push_result(self):             # <<<<<<<<<<<<<<
 *         try:
 *             self._on_result()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__push_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_push_result", 0);

  /* "asyncpg/protocol/coreproto.pyx":707
 * 
 *     cdef _push_result(self):
 *         try:             # <<<<<<<<<<<<<<
 *             self._on_result()
 *         finally:
 */
  /*try:*/ {

    /* "asyncpg/protocol/coreproto.pyx":708
 *     cdef _push_result(self):
 *         try:
 *             self._on_result()             # <<<<<<<<<<<<<<
 *         finally:
 *             self._set_state(PROTOCOL_IDLE)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 708, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asyncpg/protocol/coreproto.pyx":710
 *             self._on_result()
 *         finally:
 *             self._set_state(PROTOCOL_IDLE)             # <<<<<<<<<<<<<<
 *             self._reset_result()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 710, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/coreproto.pyx":711
 *         finally:
 *             self._set_state(PROTOCOL_IDLE)
 *             self._reset_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _reset_result(self):
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_reset_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __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_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename;
      {

        /* "asyncpg/protocol/coreproto.pyx":710
 *             self._on_result()
 *         finally:
 *             self._set_state(PROTOCOL_IDLE)             # <<<<<<<<<<<<<<
 *             self._reset_result()
 * 
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 710, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "asyncpg/protocol/coreproto.pyx":711
 *         finally:
 *             self._set_state(PROTOCOL_IDLE)
 *             self._reset_result()             # <<<<<<<<<<<<<<
 * 
 *     cdef _reset_result(self):
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_reset_result(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 711, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __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_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __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_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;
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "asyncpg/protocol/coreproto.pyx":706
 *             return parsed
 * 
 *     cdef _push_result(self):             # <<<<<<<<<<<<<<
 *         try:
 *             self._on_result()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._push_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":713
 *             self._reset_result()
 * 
 *     cdef _reset_result(self):             # <<<<<<<<<<<<<<
 *         self.result_type = RESULT_OK
 *         self.result = None
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__reset_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reset_result", 0);

  /* "asyncpg/protocol/coreproto.pyx":714
 * 
 *     cdef _reset_result(self):
 *         self.result_type = RESULT_OK             # <<<<<<<<<<<<<<
 *         self.result = None
 *         self.result_param_desc = None
 */
  __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_OK;

  /* "asyncpg/protocol/coreproto.pyx":715
 *     cdef _reset_result(self):
 *         self.result_type = RESULT_OK
 *         self.result = None             # <<<<<<<<<<<<<<
 *         self.result_param_desc = None
 *         self.result_row_desc = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = Py_None;

  /* "asyncpg/protocol/coreproto.pyx":716
 *         self.result_type = RESULT_OK
 *         self.result = None
 *         self.result_param_desc = None             # <<<<<<<<<<<<<<
 *         self.result_row_desc = None
 *         self.result_status_msg = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->result_param_desc);
  __Pyx_DECREF(__pyx_v_self->result_param_desc);
  __pyx_v_self->result_param_desc = ((PyObject*)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":717
 *         self.result = None
 *         self.result_param_desc = None
 *         self.result_row_desc = None             # <<<<<<<<<<<<<<
 *         self.result_status_msg = None
 *         self.result_execute_completed = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->result_row_desc);
  __Pyx_DECREF(__pyx_v_self->result_row_desc);
  __pyx_v_self->result_row_desc = ((PyObject*)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":718
 *         self.result_param_desc = None
 *         self.result_row_desc = None
 *         self.result_status_msg = None             # <<<<<<<<<<<<<<
 *         self.result_execute_completed = False
 *         self._discard_data = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->result_status_msg);
  __Pyx_DECREF(__pyx_v_self->result_status_msg);
  __pyx_v_self->result_status_msg = ((PyObject*)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":719
 *         self.result_row_desc = None
 *         self.result_status_msg = None
 *         self.result_execute_completed = False             # <<<<<<<<<<<<<<
 *         self._discard_data = False
 * 
 */
  __pyx_v_self->result_execute_completed = 0;

  /* "asyncpg/protocol/coreproto.pyx":720
 *         self.result_status_msg = None
 *         self.result_execute_completed = False
 *         self._discard_data = False             # <<<<<<<<<<<<<<
 * 
 *         # executemany support data
 */
  __pyx_v_self->_discard_data = 0;

  /* "asyncpg/protocol/coreproto.pyx":723
 * 
 *         # executemany support data
 *         self._execute_iter = None             # <<<<<<<<<<<<<<
 *         self._execute_portal_name = None
 *         self._execute_stmt_name = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_execute_iter);
  __Pyx_DECREF(__pyx_v_self->_execute_iter);
  __pyx_v_self->_execute_iter = Py_None;

  /* "asyncpg/protocol/coreproto.pyx":724
 *         # executemany support data
 *         self._execute_iter = None
 *         self._execute_portal_name = None             # <<<<<<<<<<<<<<
 *         self._execute_stmt_name = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_execute_portal_name);
  __Pyx_DECREF(__pyx_v_self->_execute_portal_name);
  __pyx_v_self->_execute_portal_name = ((PyObject*)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":725
 *         self._execute_iter = None
 *         self._execute_portal_name = None
 *         self._execute_stmt_name = None             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_state(self, ProtocolState new_state):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_execute_stmt_name);
  __Pyx_DECREF(__pyx_v_self->_execute_stmt_name);
  __pyx_v_self->_execute_stmt_name = ((PyObject*)Py_None);

  /* "asyncpg/protocol/coreproto.pyx":713
 *             self._reset_result()
 * 
 *     cdef _reset_result(self):             # <<<<<<<<<<<<<<
 *         self.result_type = RESULT_OK
 *         self.result = None
 */

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

/* "asyncpg/protocol/coreproto.pyx":727
 *         self._execute_stmt_name = None
 * 
 *     cdef _set_state(self, ProtocolState new_state):             # <<<<<<<<<<<<<<
 *         if new_state == PROTOCOL_IDLE:
 *             if self.state == PROTOCOL_FAILED:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_v_new_state) {
  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 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_state", 0);

  /* "asyncpg/protocol/coreproto.pyx":728
 * 
 *     cdef _set_state(self, ProtocolState new_state):
 *         if new_state == PROTOCOL_IDLE:             # <<<<<<<<<<<<<<
 *             if self.state == PROTOCOL_FAILED:
 *                 raise apg_exc.InternalClientError(
 */
  switch (__pyx_v_new_state) {
    case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE:

    /* "asyncpg/protocol/coreproto.pyx":729
 *     cdef _set_state(self, ProtocolState new_state):
 *         if new_state == PROTOCOL_IDLE:
 *             if self.state == PROTOCOL_FAILED:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to "idle" state; '
 */
    switch (__pyx_v_self->state) {
      case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED:

      /* "asyncpg/protocol/coreproto.pyx":730
 *         if new_state == PROTOCOL_IDLE:
 *             if self.state == PROTOCOL_FAILED:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'cannot switch to "idle" state; '
 *                     'protocol is in the "failed" state')
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 730, __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_kp_u_cannot_switch_to_idle_state_prot) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_cannot_switch_to_idle_state_prot);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 730, __pyx_L1_error)

      /* "asyncpg/protocol/coreproto.pyx":729
 *     cdef _set_state(self, ProtocolState new_state):
 *         if new_state == PROTOCOL_IDLE:
 *             if self.state == PROTOCOL_FAILED:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to "idle" state; '
 */
      break;
      case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE:

      /* "asyncpg/protocol/coreproto.pyx":733
 *                     'cannot switch to "idle" state; '
 *                     'protocol is in the "failed" state')
 *             elif self.state == PROTOCOL_IDLE:             # <<<<<<<<<<<<<<
 *                 pass
 *             else:
 */
      break;
      default:

      /* "asyncpg/protocol/coreproto.pyx":736
 *                 pass
 *             else:
 *                 self.state = new_state             # <<<<<<<<<<<<<<
 * 
 *         elif new_state == PROTOCOL_FAILED:
 */
      __pyx_v_self->state = __pyx_v_new_state;
      break;
    }

    /* "asyncpg/protocol/coreproto.pyx":728
 * 
 *     cdef _set_state(self, ProtocolState new_state):
 *         if new_state == PROTOCOL_IDLE:             # <<<<<<<<<<<<<<
 *             if self.state == PROTOCOL_FAILED:
 *                 raise apg_exc.InternalClientError(
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED:

    /* "asyncpg/protocol/coreproto.pyx":739
 * 
 *         elif new_state == PROTOCOL_FAILED:
 *             self.state = PROTOCOL_FAILED             # <<<<<<<<<<<<<<
 * 
 *         elif new_state == PROTOCOL_CANCELLED:
 */
    __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED;

    /* "asyncpg/protocol/coreproto.pyx":738
 *                 self.state = new_state
 * 
 *         elif new_state == PROTOCOL_FAILED:             # <<<<<<<<<<<<<<
 *             self.state = PROTOCOL_FAILED
 * 
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CANCELLED:

    /* "asyncpg/protocol/coreproto.pyx":742
 * 
 *         elif new_state == PROTOCOL_CANCELLED:
 *             self.state = PROTOCOL_CANCELLED             # <<<<<<<<<<<<<<
 * 
 *         elif new_state == PROTOCOL_TERMINATING:
 */
    __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CANCELLED;

    /* "asyncpg/protocol/coreproto.pyx":741
 *             self.state = PROTOCOL_FAILED
 * 
 *         elif new_state == PROTOCOL_CANCELLED:             # <<<<<<<<<<<<<<
 *             self.state = PROTOCOL_CANCELLED
 * 
 */
    break;
    case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING:

    /* "asyncpg/protocol/coreproto.pyx":745
 * 
 *         elif new_state == PROTOCOL_TERMINATING:
 *             self.state = PROTOCOL_TERMINATING             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_v_self->state = __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING;

    /* "asyncpg/protocol/coreproto.pyx":744
 *             self.state = PROTOCOL_CANCELLED
 * 
 *         elif new_state == PROTOCOL_TERMINATING:             # <<<<<<<<<<<<<<
 *             self.state = PROTOCOL_TERMINATING
 * 
 */
    break;
    default:

    /* "asyncpg/protocol/coreproto.pyx":748
 * 
 *         else:
 *             if self.state == PROTOCOL_IDLE:             # <<<<<<<<<<<<<<
 *                 self.state = new_state
 * 
 */
    __pyx_t_4 = ((__pyx_v_self->state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_IDLE) != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/coreproto.pyx":749
 *         else:
 *             if self.state == PROTOCOL_IDLE:
 *                 self.state = new_state             # <<<<<<<<<<<<<<
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT and
 */
      __pyx_v_self->state = __pyx_v_new_state;

      /* "asyncpg/protocol/coreproto.pyx":748
 * 
 *         else:
 *             if self.state == PROTOCOL_IDLE:             # <<<<<<<<<<<<<<
 *                 self.state = new_state
 * 
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/coreproto.pyx":751
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DATA):
 *                 self.state = new_state
 */
    __pyx_t_5 = ((__pyx_v_self->state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L4_bool_binop_done;
    }

    /* "asyncpg/protocol/coreproto.pyx":752
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT and
 *                     new_state == PROTOCOL_COPY_OUT_DATA):             # <<<<<<<<<<<<<<
 *                 self.state = new_state
 * 
 */
    __pyx_t_5 = ((__pyx_v_new_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L4_bool_binop_done:;

    /* "asyncpg/protocol/coreproto.pyx":751
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DATA):
 *                 self.state = new_state
 */
    if (__pyx_t_4) {

      /* "asyncpg/protocol/coreproto.pyx":753
 *             elif (self.state == PROTOCOL_COPY_OUT and
 *                     new_state == PROTOCOL_COPY_OUT_DATA):
 *                 self.state = new_state             # <<<<<<<<<<<<<<
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and
 */
      __pyx_v_self->state = __pyx_v_new_state;

      /* "asyncpg/protocol/coreproto.pyx":751
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DATA):
 *                 self.state = new_state
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/coreproto.pyx":755
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DONE):
 *                 self.state = new_state
 */
    __pyx_t_5 = ((__pyx_v_self->state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }

    /* "asyncpg/protocol/coreproto.pyx":756
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and
 *                     new_state == PROTOCOL_COPY_OUT_DONE):             # <<<<<<<<<<<<<<
 *                 self.state = new_state
 * 
 */
    __pyx_t_5 = ((__pyx_v_new_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;

    /* "asyncpg/protocol/coreproto.pyx":755
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DONE):
 *                 self.state = new_state
 */
    if (__pyx_t_4) {

      /* "asyncpg/protocol/coreproto.pyx":757
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and
 *                     new_state == PROTOCOL_COPY_OUT_DONE):
 *                 self.state = new_state             # <<<<<<<<<<<<<<
 * 
 *             elif (self.state == PROTOCOL_COPY_IN and
 */
      __pyx_v_self->state = __pyx_v_new_state;

      /* "asyncpg/protocol/coreproto.pyx":755
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_OUT_DONE):
 *                 self.state = new_state
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/coreproto.pyx":759
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_IN and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_IN_DATA):
 *                 self.state = new_state
 */
    __pyx_t_5 = ((__pyx_v_self->state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }

    /* "asyncpg/protocol/coreproto.pyx":760
 * 
 *             elif (self.state == PROTOCOL_COPY_IN and
 *                     new_state == PROTOCOL_COPY_IN_DATA):             # <<<<<<<<<<<<<<
 *                 self.state = new_state
 * 
 */
    __pyx_t_5 = ((__pyx_v_new_state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN_DATA) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;

    /* "asyncpg/protocol/coreproto.pyx":759
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_IN and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_IN_DATA):
 *                 self.state = new_state
 */
    if (__pyx_t_4) {

      /* "asyncpg/protocol/coreproto.pyx":761
 *             elif (self.state == PROTOCOL_COPY_IN and
 *                     new_state == PROTOCOL_COPY_IN_DATA):
 *                 self.state = new_state             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_FAILED:
 */
      __pyx_v_self->state = __pyx_v_new_state;

      /* "asyncpg/protocol/coreproto.pyx":759
 *                 self.state = new_state
 * 
 *             elif (self.state == PROTOCOL_COPY_IN and             # <<<<<<<<<<<<<<
 *                     new_state == PROTOCOL_COPY_IN_DATA):
 *                 self.state = new_state
 */
      goto __pyx_L3;
    }

    /* "asyncpg/protocol/coreproto.pyx":763
 *                 self.state = new_state
 * 
 *             elif self.state == PROTOCOL_FAILED:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to state {}; '
 */
    __pyx_t_4 = ((__pyx_v_self->state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "asyncpg/protocol/coreproto.pyx":764
 * 
 *             elif self.state == PROTOCOL_FAILED:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'cannot switch to state {}; '
 *                     'protocol is in the "failed" state'.format(new_state))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/coreproto.pyx":766
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to state {}; '
 *                     'protocol is in the "failed" state'.format(new_state))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise apg_exc.InternalClientError(
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_switch_to_state_protocol, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_new_state); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      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_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(6, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 764, __pyx_L1_error)

      /* "asyncpg/protocol/coreproto.pyx":763
 *                 self.state = new_state
 * 
 *             elif self.state == PROTOCOL_FAILED:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to state {}; '
 */
    }

    /* "asyncpg/protocol/coreproto.pyx":768
 *                     'protocol is in the "failed" state'.format(new_state))
 *             else:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'cannot switch to state {}; '
 *                     'another operation ({}) is in progress'.format(
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asyncpg/protocol/coreproto.pyx":770
 *                 raise apg_exc.InternalClientError(
 *                     'cannot switch to state {}; '
 *                     'another operation ({}) is in progress'.format(             # <<<<<<<<<<<<<<
 *                         new_state, self.state))
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_switch_to_state_another_o, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "asyncpg/protocol/coreproto.pyx":771
 *                     'cannot switch to state {}; '
 *                     'another operation ({}) is in progress'.format(
 *                         new_state, self.state))             # <<<<<<<<<<<<<<
 * 
 *     cdef _ensure_connected(self):
 */
      __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_new_state); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_self->state); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 770, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 770, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 770, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 770, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 768, __pyx_L1_error)
    }
    __pyx_L3:;
    break;
  }

  /* "asyncpg/protocol/coreproto.pyx":727
 *         self._execute_stmt_name = None
 * 
 *     cdef _set_state(self, ProtocolState new_state):             # <<<<<<<<<<<<<<
 *         if new_state == PROTOCOL_IDLE:
 *             if self.state == PROTOCOL_FAILED:
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":773
 *                         new_state, self.state))
 * 
 *     cdef _ensure_connected(self):             # <<<<<<<<<<<<<<
 *         if self.con_status != CONNECTION_OK:
 *             raise apg_exc.InternalClientError('not connected')
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__ensure_connected(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__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("_ensure_connected", 0);

  /* "asyncpg/protocol/coreproto.pyx":774
 * 
 *     cdef _ensure_connected(self):
 *         if self.con_status != CONNECTION_OK:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('not connected')
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->con_status != __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_OK) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/coreproto.pyx":775
 *     cdef _ensure_connected(self):
 *         if self.con_status != CONNECTION_OK:
 *             raise apg_exc.InternalClientError('not connected')             # <<<<<<<<<<<<<<
 * 
 *     cdef WriteBuffer _build_parse_message(self, str stmt_name, str query):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 775, __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 && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_not_connected) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_not_connected);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 775, __pyx_L1_error)

    /* "asyncpg/protocol/coreproto.pyx":774
 * 
 *     cdef _ensure_connected(self):
 *         if self.con_status != CONNECTION_OK:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('not connected')
 * 
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":773
 *                         new_state, self.state))
 * 
 *     cdef _ensure_connected(self):             # <<<<<<<<<<<<<<
 *         if self.con_status != CONNECTION_OK:
 *             raise apg_exc.InternalClientError('not connected')
 */

  /* 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("asyncpg.protocol.protocol.CoreProtocol._ensure_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":777
 *             raise apg_exc.InternalClientError('not connected')
 * 
 *     cdef WriteBuffer _build_parse_message(self, str stmt_name, str query):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_parse_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_parse_message", 0);

  /* "asyncpg/protocol/coreproto.pyx":780
 *         cdef WriteBuffer buf
 * 
 *         buf = WriteBuffer.new_message(b'P')             # <<<<<<<<<<<<<<
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.write_str(query, self.encoding)
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('P')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":781
 * 
 *         buf = WriteBuffer.new_message(b'P')
 *         buf.write_str(stmt_name, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.write_str(query, self.encoding)
 *         buf.write_int16(0)
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_stmt_name, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 781, __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;

  /* "asyncpg/protocol/coreproto.pyx":782
 *         buf = WriteBuffer.new_message(b'P')
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.write_str(query, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.write_int16(0)
 * 
 */
  __pyx_t_2 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_query, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 782, __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;

  /* "asyncpg/protocol/coreproto.pyx":783
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.write_str(query, self.encoding)
 *         buf.write_int16(0)             # <<<<<<<<<<<<<<
 * 
 *         buf.end_message()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":785
 *         buf.write_int16(0)
 * 
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":786
 * 
 *         buf.end_message()
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     cdef WriteBuffer _build_bind_message(self, str portal_name,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":777
 *             raise apg_exc.InternalClientError('not connected')
 * 
 *     cdef WriteBuffer _build_parse_message(self, str stmt_name, str query):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._build_parse_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":788
 *         return buf
 * 
 *     cdef WriteBuffer _build_bind_message(self, str portal_name,             # <<<<<<<<<<<<<<
 *                                          str stmt_name,
 *                                          WriteBuffer bind_data):
 */

static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_bind_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_bind_message", 0);

  /* "asyncpg/protocol/coreproto.pyx":793
 *         cdef WriteBuffer buf
 * 
 *         buf = WriteBuffer.new_message(b'B')             # <<<<<<<<<<<<<<
 *         buf.write_str(portal_name, self.encoding)
 *         buf.write_str(stmt_name, self.encoding)
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('B')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":794
 * 
 *         buf = WriteBuffer.new_message(b'B')
 *         buf.write_str(portal_name, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.write_str(stmt_name, self.encoding)
 * 
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_portal_name, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 794, __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;

  /* "asyncpg/protocol/coreproto.pyx":795
 *         buf = WriteBuffer.new_message(b'B')
 *         buf.write_str(portal_name, self.encoding)
 *         buf.write_str(stmt_name, self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         # Arguments
 */
  __pyx_t_2 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_stmt_name, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 795, __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;

  /* "asyncpg/protocol/coreproto.pyx":798
 * 
 *         # Arguments
 *         buf.write_buffer(bind_data)             # <<<<<<<<<<<<<<
 * 
 *         buf.end_message()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, __pyx_v_bind_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":800
 *         buf.write_buffer(bind_data)
 * 
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":801
 * 
 *         buf.end_message()
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     cdef WriteBuffer _build_empty_bind_data(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":788
 *         return buf
 * 
 *     cdef WriteBuffer _build_bind_message(self, str portal_name,             # <<<<<<<<<<<<<<
 *                                          str stmt_name,
 *                                          WriteBuffer bind_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._build_bind_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":803
 *         return buf
 * 
 *     cdef WriteBuffer _build_empty_bind_data(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 */

static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_empty_bind_data(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__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("_build_empty_bind_data", 0);

  /* "asyncpg/protocol/coreproto.pyx":805
 *     cdef WriteBuffer _build_empty_bind_data(self):
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *         buf.write_int16(0)  # The number of parameter format codes
 *         buf.write_int16(0)  # The number of parameter values
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":806
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 *         buf.write_int16(0)  # The number of parameter format codes             # <<<<<<<<<<<<<<
 *         buf.write_int16(0)  # The number of parameter values
 *         buf.write_int16(0)  # The number of result-column format codes
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":807
 *         buf = WriteBuffer.new()
 *         buf.write_int16(0)  # The number of parameter format codes
 *         buf.write_int16(0)  # The number of parameter values             # <<<<<<<<<<<<<<
 *         buf.write_int16(0)  # The number of result-column format codes
 *         return buf
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":808
 *         buf.write_int16(0)  # The number of parameter format codes
 *         buf.write_int16(0)  # The number of parameter values
 *         buf.write_int16(0)  # The number of result-column format codes             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":809
 *         buf.write_int16(0)  # The number of parameter values
 *         buf.write_int16(0)  # The number of result-column format codes
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     cdef WriteBuffer _build_execute_message(self, str portal_name,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":803
 *         return buf
 * 
 *     cdef WriteBuffer _build_empty_bind_data(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 */

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

/* "asyncpg/protocol/coreproto.pyx":811
 *         return buf
 * 
 *     cdef WriteBuffer _build_execute_message(self, str portal_name,             # <<<<<<<<<<<<<<
 *                                             int32_t limit):
 *         cdef WriteBuffer buf
 */

static struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_execute_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, int32_t __pyx_v_limit) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_build_execute_message", 0);

  /* "asyncpg/protocol/coreproto.pyx":815
 *         cdef WriteBuffer buf
 * 
 *         buf = WriteBuffer.new_message(b'E')             # <<<<<<<<<<<<<<
 *         buf.write_str(portal_name, self.encoding)  # name of the portal
 *         buf.write_int32(limit)  # number of rows to return; 0 - all
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('E')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":816
 * 
 *         buf = WriteBuffer.new_message(b'E')
 *         buf.write_str(portal_name, self.encoding)  # name of the portal             # <<<<<<<<<<<<<<
 *         buf.write_int32(limit)  # number of rows to return; 0 - all
 * 
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_portal_name, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 816, __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;

  /* "asyncpg/protocol/coreproto.pyx":817
 *         buf = WriteBuffer.new_message(b'E')
 *         buf.write_str(portal_name, self.encoding)  # name of the portal
 *         buf.write_int32(limit)  # number of rows to return; 0 - all             # <<<<<<<<<<<<<<
 * 
 *         buf.end_message()
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int32(__pyx_v_buf, __pyx_v_limit); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":819
 *         buf.write_int32(limit)  # number of rows to return; 0 - all
 * 
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":820
 * 
 *         buf.end_message()
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     # API for subclasses
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":811
 *         return buf
 * 
 *     cdef WriteBuffer _build_execute_message(self, str portal_name,             # <<<<<<<<<<<<<<
 *                                             int32_t limit):
 *         cdef WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._build_execute_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":824
 *     # API for subclasses
 * 
 *     cdef _connect(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__connect(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_outbuf = 0;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  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;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int32_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_connect", 0);

  /* "asyncpg/protocol/coreproto.pyx":829
 *             WriteBuffer outbuf
 * 
 *         if self.con_status != CONNECTION_BAD:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('already connected')
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->con_status != __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/coreproto.pyx":830
 * 
 *         if self.con_status != CONNECTION_BAD:
 *             raise apg_exc.InternalClientError('already connected')             # <<<<<<<<<<<<<<
 * 
 *         self._set_state(PROTOCOL_AUTH)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 830, __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 && 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_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_u_already_connected) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_already_connected);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 830, __pyx_L1_error)

    /* "asyncpg/protocol/coreproto.pyx":829
 *             WriteBuffer outbuf
 * 
 *         if self.con_status != CONNECTION_BAD:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('already connected')
 * 
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":832
 *             raise apg_exc.InternalClientError('already connected')
 * 
 *         self._set_state(PROTOCOL_AUTH)             # <<<<<<<<<<<<<<
 *         self.con_status = CONNECTION_STARTED
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_AUTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":833
 * 
 *         self._set_state(PROTOCOL_AUTH)
 *         self.con_status = CONNECTION_STARTED             # <<<<<<<<<<<<<<
 * 
 *         # Assemble a startup message
 */
  __pyx_v_self->con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_STARTED;

  /* "asyncpg/protocol/coreproto.pyx":836
 * 
 *         # Assemble a startup message
 *         buf = WriteBuffer()             # <<<<<<<<<<<<<<
 * 
 *         # protocol version
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":839
 * 
 *         # protocol version
 *         buf.write_int16(3)             # <<<<<<<<<<<<<<
 *         buf.write_int16(0)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":840
 *         # protocol version
 *         buf.write_int16(3)
 *         buf.write_int16(0)             # <<<<<<<<<<<<<<
 * 
 *         buf.write_bytestring(b'client_encoding')
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_int16(__pyx_v_buf, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":842
 *         buf.write_int16(0)
 * 
 *         buf.write_bytestring(b'client_encoding')             # <<<<<<<<<<<<<<
 *         buf.write_bytestring("'{}'".format(self.encoding).encode('ascii'))
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytestring(__pyx_v_buf, __pyx_n_b_client_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":843
 * 
 *         buf.write_bytestring(b'client_encoding')
 *         buf.write_bytestring("'{}'".format(self.encoding).encode('ascii'))             # <<<<<<<<<<<<<<
 * 
 *         buf.write_str('user', self.encoding)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u__42, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 843, __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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_self->encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->encoding);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 843, __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_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __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_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_ascii);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(6, 843, __pyx_L1_error)
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytestring(__pyx_v_buf, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 843, __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;

  /* "asyncpg/protocol/coreproto.pyx":845
 *         buf.write_bytestring("'{}'".format(self.encoding).encode('ascii'))
 * 
 *         buf.write_str('user', self.encoding)             # <<<<<<<<<<<<<<
 *         buf.write_str(self.con_params.user, self.encoding)
 * 
 */
  __pyx_t_3 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_n_u_user, ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 845, __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;

  /* "asyncpg/protocol/coreproto.pyx":846
 * 
 *         buf.write_str('user', self.encoding)
 *         buf.write_str(self.con_params.user, self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         buf.write_str('database', self.encoding)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->con_params, __pyx_n_s_user); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(6, 846, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":848
 *         buf.write_str(self.con_params.user, self.encoding)
 * 
 *         buf.write_str('database', self.encoding)             # <<<<<<<<<<<<<<
 *         buf.write_str(self.con_params.database, self.encoding)
 * 
 */
  __pyx_t_4 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_n_u_database, ((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 848, __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;

  /* "asyncpg/protocol/coreproto.pyx":849
 * 
 *         buf.write_str('database', self.encoding)
 *         buf.write_str(self.con_params.database, self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         if self.con_params.server_settings is not None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->con_params, __pyx_n_s_database); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(6, 849, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":851
 *         buf.write_str(self.con_params.database, self.encoding)
 * 
 *         if self.con_params.server_settings is not None:             # <<<<<<<<<<<<<<
 *             for k, v in self.con_params.server_settings.items():
 *                 buf.write_str(k, self.encoding)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->con_params, __pyx_n_s_server_settings); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "asyncpg/protocol/coreproto.pyx":852
 * 
 *         if self.con_params.server_settings is not None:
 *             for k, v in self.con_params.server_settings.items():             # <<<<<<<<<<<<<<
 *                 buf.write_str(k, self.encoding)
 *                 buf.write_str(v, self.encoding)
 */
    __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->con_params, __pyx_n_s_server_settings); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_t_4 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(6, 852, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_dict_iterator(__pyx_t_4, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
    while (1) {
      __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_8, &__pyx_t_7, &__pyx_t_3, &__pyx_t_4, NULL, __pyx_t_9);
      if (unlikely(__pyx_t_10 == 0)) break;
      if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(6, 852, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/coreproto.pyx":853
 *         if self.con_params.server_settings is not None:
 *             for k, v in self.con_params.server_settings.items():
 *                 buf.write_str(k, self.encoding)             # <<<<<<<<<<<<<<
 *                 buf.write_str(v, self.encoding)
 * 
 */
      if (!(likely(PyUnicode_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_k)->tp_name), 0))) __PYX_ERR(6, 853, __pyx_L1_error)
      __pyx_t_4 = __pyx_v_self->encoding;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, ((PyObject*)__pyx_v_k), ((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 853, __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;

      /* "asyncpg/protocol/coreproto.pyx":854
 *             for k, v in self.con_params.server_settings.items():
 *                 buf.write_str(k, self.encoding)
 *                 buf.write_str(v, self.encoding)             # <<<<<<<<<<<<<<
 * 
 *         buf.write_bytestring(b'')
 */
      if (!(likely(PyUnicode_CheckExact(__pyx_v_v))||((__pyx_v_v) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_v)->tp_name), 0))) __PYX_ERR(6, 854, __pyx_L1_error)
      __pyx_t_3 = __pyx_v_self->encoding;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, ((PyObject*)__pyx_v_v), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":851
 *         buf.write_str(self.con_params.database, self.encoding)
 * 
 *         if self.con_params.server_settings is not None:             # <<<<<<<<<<<<<<
 *             for k, v in self.con_params.server_settings.items():
 *                 buf.write_str(k, self.encoding)
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":856
 *                 buf.write_str(v, self.encoding)
 * 
 *         buf.write_bytestring(b'')             # <<<<<<<<<<<<<<
 * 
 *         # Send the buffer
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytestring(__pyx_v_buf, __pyx_kp_b__37); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":859
 * 
 *         # Send the buffer
 *         outbuf = WriteBuffer()             # <<<<<<<<<<<<<<
 *         outbuf.write_int32(buf.len() + 4)
 *         outbuf.write_buffer(buf)
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_outbuf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":860
 *         # Send the buffer
 *         outbuf = WriteBuffer()
 *         outbuf.write_int32(buf.len() + 4)             # <<<<<<<<<<<<<<
 *         outbuf.write_buffer(buf)
 *         self._write(outbuf)
 */
  __pyx_t_2 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int32_t(__pyx_t_4); if (unlikely((__pyx_t_11 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(6, 860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_outbuf->__pyx_vtab)->write_int32(__pyx_v_outbuf, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":861
 *         outbuf = WriteBuffer()
 *         outbuf.write_int32(buf.len() + 4)
 *         outbuf.write_buffer(buf)             # <<<<<<<<<<<<<<
 *         self._write(outbuf)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_outbuf->__pyx_vtab)->write_buffer(__pyx_v_outbuf, __pyx_v_buf); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":862
 *         outbuf.write_int32(buf.len() + 4)
 *         outbuf.write_buffer(buf)
 *         self._write(outbuf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _prepare(self, str stmt_name, str query):
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_outbuf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/coreproto.pyx":824
 *     # API for subclasses
 * 
 *     cdef _connect(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":864
 *         self._write(outbuf)
 * 
 *     cdef _prepare(self, str stmt_name, str query):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer packet
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_packet = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prepare", 0);

  /* "asyncpg/protocol/coreproto.pyx":869
 *             WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_PREPARE)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":870
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_PREPARE)             # <<<<<<<<<<<<<<
 * 
 *         packet = self._build_parse_message(stmt_name, query)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_PREPARE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":872
 *         self._set_state(PROTOCOL_PREPARE)
 * 
 *         packet = self._build_parse_message(stmt_name, query)             # <<<<<<<<<<<<<<
 * 
 *         buf = WriteBuffer.new_message(b'D')
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_parse_message(__pyx_v_self, __pyx_v_stmt_name, __pyx_v_query)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_packet = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":874
 *         packet = self._build_parse_message(stmt_name, query)
 * 
 *         buf = WriteBuffer.new_message(b'D')             # <<<<<<<<<<<<<<
 *         buf.write_byte(b'S')
 *         buf.write_str(stmt_name, self.encoding)
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('D')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":875
 * 
 *         buf = WriteBuffer.new_message(b'D')
 *         buf.write_byte(b'S')             # <<<<<<<<<<<<<<
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.end_message()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_byte(__pyx_v_buf, 'S'); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":876
 *         buf = WriteBuffer.new_message(b'D')
 *         buf.write_byte(b'S')
 *         buf.write_str(stmt_name, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         packet.write_buffer(buf)
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_stmt_name, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 876, __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;

  /* "asyncpg/protocol/coreproto.pyx":877
 *         buf.write_byte(b'S')
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         packet.write_buffer(buf)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":878
 *         buf.write_str(stmt_name, self.encoding)
 *         buf.end_message()
 *         packet.write_buffer(buf)             # <<<<<<<<<<<<<<
 * 
 *         packet.write_bytes(FLUSH_MESSAGE)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_buffer(__pyx_v_packet, __pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":880
 *         packet.write_buffer(buf)
 * 
 *         packet.write_bytes(FLUSH_MESSAGE)             # <<<<<<<<<<<<<<
 * 
 *         self._write(packet)
 */
  __pyx_t_2 = __pyx_v_7asyncpg_8protocol_8protocol_FLUSH_MESSAGE;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_bytes(__pyx_v_packet, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 880, __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;

  /* "asyncpg/protocol/coreproto.pyx":882
 *         packet.write_bytes(FLUSH_MESSAGE)
 * 
 *         self._write(packet)             # <<<<<<<<<<<<<<
 * 
 *     cdef _send_bind_message(self, str portal_name, str stmt_name,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":864
 *         self._write(outbuf)
 * 
 *     cdef _prepare(self, str stmt_name, str query):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer packet
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_packet);
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":884
 *         self._write(packet)
 * 
 *     cdef _send_bind_message(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                             WriteBuffer bind_data, int32_t limit):
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__send_bind_message(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data, int32_t __pyx_v_limit) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_packet = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_send_bind_message", 0);

  /* "asyncpg/protocol/coreproto.pyx":891
 *             WriteBuffer buf
 * 
 *         buf = self._build_bind_message(portal_name, stmt_name, bind_data)             # <<<<<<<<<<<<<<
 *         packet = buf
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_bind_message(__pyx_v_self, __pyx_v_portal_name, __pyx_v_stmt_name, __pyx_v_bind_data)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":892
 * 
 *         buf = self._build_bind_message(portal_name, stmt_name, bind_data)
 *         packet = buf             # <<<<<<<<<<<<<<
 * 
 *         buf = self._build_execute_message(portal_name, limit)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_v_packet = __pyx_v_buf;

  /* "asyncpg/protocol/coreproto.pyx":894
 *         packet = buf
 * 
 *         buf = self._build_execute_message(portal_name, limit)             # <<<<<<<<<<<<<<
 *         packet.write_buffer(buf)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_execute_message(__pyx_v_self, __pyx_v_portal_name, __pyx_v_limit)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_buf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":895
 * 
 *         buf = self._build_execute_message(portal_name, limit)
 *         packet.write_buffer(buf)             # <<<<<<<<<<<<<<
 * 
 *         packet.write_bytes(SYNC_MESSAGE)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_buffer(__pyx_v_packet, __pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":897
 *         packet.write_buffer(buf)
 * 
 *         packet.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 * 
 *         self._write(packet)
 */
  __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_bytes(__pyx_v_packet, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 897, __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;

  /* "asyncpg/protocol/coreproto.pyx":899
 *         packet.write_bytes(SYNC_MESSAGE)
 * 
 *         self._write(packet)             # <<<<<<<<<<<<<<
 * 
 *     cdef _bind_execute(self, str portal_name, str stmt_name,
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":884
 *         self._write(packet)
 * 
 *     cdef _send_bind_message(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                             WriteBuffer bind_data, int32_t limit):
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._send_bind_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_packet);
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":901
 *         self._write(packet)
 * 
 *     cdef _bind_execute(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                        WriteBuffer bind_data, int32_t limit):
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data, int32_t __pyx_v_limit) {
  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("_bind_execute", 0);

  /* "asyncpg/protocol/coreproto.pyx":906
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_BIND_EXECUTE)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":907
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_BIND_EXECUTE)             # <<<<<<<<<<<<<<
 * 
 *         self.result = []
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":909
 *         self._set_state(PROTOCOL_BIND_EXECUTE)
 * 
 *         self.result = []             # <<<<<<<<<<<<<<
 * 
 *         self._send_bind_message(portal_name, stmt_name, bind_data, limit)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":911
 *         self.result = []
 * 
 *         self._send_bind_message(portal_name, stmt_name, bind_data, limit)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _bind_execute_many(self, str portal_name, str stmt_name,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_send_bind_message(__pyx_v_self, __pyx_v_portal_name, __pyx_v_stmt_name, __pyx_v_bind_data, __pyx_v_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":901
 *         self._write(packet)
 * 
 *     cdef _bind_execute(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                        WriteBuffer bind_data, int32_t limit):
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":913
 *         self._send_bind_message(portal_name, stmt_name, bind_data, limit)
 * 
 *     cdef bint _bind_execute_many(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                                  object bind_data):
 *         self._ensure_connected()
 */

static int __pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_bind_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_bind_execute_many", 0);

  /* "asyncpg/protocol/coreproto.pyx":915
 *     cdef bint _bind_execute_many(self, str portal_name, str stmt_name,
 *                                  object bind_data):
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_BIND_EXECUTE_MANY)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":916
 *                                  object bind_data):
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_BIND_EXECUTE_MANY)             # <<<<<<<<<<<<<<
 * 
 *         self.result = None
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE_MANY); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":918
 *         self._set_state(PROTOCOL_BIND_EXECUTE_MANY)
 * 
 *         self.result = None             # <<<<<<<<<<<<<<
 *         self._discard_data = True
 *         self._execute_iter = bind_data
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = Py_None;

  /* "asyncpg/protocol/coreproto.pyx":919
 * 
 *         self.result = None
 *         self._discard_data = True             # <<<<<<<<<<<<<<
 *         self._execute_iter = bind_data
 *         self._execute_portal_name = portal_name
 */
  __pyx_v_self->_discard_data = 1;

  /* "asyncpg/protocol/coreproto.pyx":920
 *         self.result = None
 *         self._discard_data = True
 *         self._execute_iter = bind_data             # <<<<<<<<<<<<<<
 *         self._execute_portal_name = portal_name
 *         self._execute_stmt_name = stmt_name
 */
  __Pyx_INCREF(__pyx_v_bind_data);
  __Pyx_GIVEREF(__pyx_v_bind_data);
  __Pyx_GOTREF(__pyx_v_self->_execute_iter);
  __Pyx_DECREF(__pyx_v_self->_execute_iter);
  __pyx_v_self->_execute_iter = __pyx_v_bind_data;

  /* "asyncpg/protocol/coreproto.pyx":921
 *         self._discard_data = True
 *         self._execute_iter = bind_data
 *         self._execute_portal_name = portal_name             # <<<<<<<<<<<<<<
 *         self._execute_stmt_name = stmt_name
 *         return self._bind_execute_many_more(True)
 */
  __Pyx_INCREF(__pyx_v_portal_name);
  __Pyx_GIVEREF(__pyx_v_portal_name);
  __Pyx_GOTREF(__pyx_v_self->_execute_portal_name);
  __Pyx_DECREF(__pyx_v_self->_execute_portal_name);
  __pyx_v_self->_execute_portal_name = __pyx_v_portal_name;

  /* "asyncpg/protocol/coreproto.pyx":922
 *         self._execute_iter = bind_data
 *         self._execute_portal_name = portal_name
 *         self._execute_stmt_name = stmt_name             # <<<<<<<<<<<<<<
 *         return self._bind_execute_many_more(True)
 * 
 */
  __Pyx_INCREF(__pyx_v_stmt_name);
  __Pyx_GIVEREF(__pyx_v_stmt_name);
  __Pyx_GOTREF(__pyx_v_self->_execute_stmt_name);
  __Pyx_DECREF(__pyx_v_self->_execute_stmt_name);
  __pyx_v_self->_execute_stmt_name = __pyx_v_stmt_name;

  /* "asyncpg/protocol/coreproto.pyx":923
 *         self._execute_portal_name = portal_name
 *         self._execute_stmt_name = stmt_name
 *         return self._bind_execute_many_more(True)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _bind_execute_many_more(self, bint first=False):
 */
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.first = 1;
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_bind_execute_many_more(__pyx_v_self, &__pyx_t_3); 
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":913
 *         self._send_bind_message(portal_name, stmt_name, bind_data, limit)
 * 
 *     cdef bint _bind_execute_many(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                                  object bind_data):
 *         self._ensure_connected()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("asyncpg.protocol.protocol.CoreProtocol._bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":925
 *         return self._bind_execute_many_more(True)
 * 
 *     cdef bint _bind_execute_many_more(self, bint first=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer packet
 */

static int __pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more *__pyx_optional_args) {
  int __pyx_v_first = ((int)0);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_packet = 0;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_v_buffers = 0;
  PyObject *__pyx_v_ex = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail __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;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_bind_execute_many_more", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_first = __pyx_optional_args->first;
    }
  }

  /* "asyncpg/protocol/coreproto.pyx":929
 *             WriteBuffer packet
 *             WriteBuffer buf
 *             list buffers = []             # <<<<<<<<<<<<<<
 * 
 *         # as we keep sending, the server may return an error early
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buffers = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":932
 * 
 *         # as we keep sending, the server may return an error early
 *         if self.result_type == RESULT_FAILED:             # <<<<<<<<<<<<<<
 *             self._write(SYNC_MESSAGE)
 *             return False
 */
  __pyx_t_2 = ((__pyx_v_self->result_type == __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/coreproto.pyx":933
 *         # as we keep sending, the server may return an error early
 *         if self.result_type == RESULT_FAILED:
 *             self._write(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 933, __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;

    /* "asyncpg/protocol/coreproto.pyx":934
 *         if self.result_type == RESULT_FAILED:
 *             self._write(SYNC_MESSAGE)
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # collect up to four 32KB buffers to send
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "asyncpg/protocol/coreproto.pyx":932
 * 
 *         # as we keep sending, the server may return an error early
 *         if self.result_type == RESULT_FAILED:             # <<<<<<<<<<<<<<
 *             self._write(SYNC_MESSAGE)
 *             return False
 */
  }

  /* "asyncpg/protocol/coreproto.pyx":938
 *         # collect up to four 32KB buffers to send
 *         # https://github.com/MagicStack/asyncpg/pull/289#issuecomment-391215051
 *         while len(buffers) < _EXECUTE_MANY_BUF_NUM:             # <<<<<<<<<<<<<<
 *             packet = WriteBuffer.new()
 * 
 */
  while (1) {
    __pyx_t_4 = PyList_GET_SIZE(__pyx_v_buffers); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(6, 938, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_t_4 < 4) != 0);
    if (!__pyx_t_2) break;

    /* "asyncpg/protocol/coreproto.pyx":939
 *         # https://github.com/MagicStack/asyncpg/pull/289#issuecomment-391215051
 *         while len(buffers) < _EXECUTE_MANY_BUF_NUM:
 *             packet = WriteBuffer.new()             # <<<<<<<<<<<<<<
 * 
 *             # fill one 32KB buffer
 */
    __pyx_t_3 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_packet, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/coreproto.pyx":942
 * 
 *             # fill one 32KB buffer
 *             while packet.len() < _EXECUTE_MANY_BUF_SIZE:             # <<<<<<<<<<<<<<
 *                 try:
 *                     # grab one item from the input
 */
    while (1) {
      __pyx_t_3 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_v_packet); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_32768, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 942, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 942, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!__pyx_t_2) break;

      /* "asyncpg/protocol/coreproto.pyx":943
 *             # fill one 32KB buffer
 *             while packet.len() < _EXECUTE_MANY_BUF_SIZE:
 *                 try:             # <<<<<<<<<<<<<<
 *                     # grab one item from the input
 *                     buf = <WriteBuffer>next(self._execute_iter)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "asyncpg/protocol/coreproto.pyx":945
 *                 try:
 *                     # grab one item from the input
 *                     buf = <WriteBuffer>next(self._execute_iter)             # <<<<<<<<<<<<<<
 * 
 *                 # reached the end of the input
 */
          __pyx_t_1 = __pyx_v_self->_execute_iter;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 945, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __pyx_t_3;
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF_SET(__pyx_v_buf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1));
          __pyx_t_1 = 0;

          /* "asyncpg/protocol/coreproto.pyx":943
 *             # fill one 32KB buffer
 *             while packet.len() < _EXECUTE_MANY_BUF_SIZE:
 *                 try:             # <<<<<<<<<<<<<<
 *                     # grab one item from the input
 *                     buf = <WriteBuffer>next(self._execute_iter)
 */
        }
        __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;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/coreproto.pyx":948
 * 
 *                 # reached the end of the input
 *                 except StopIteration:             # <<<<<<<<<<<<<<
 *                     if first:
 *                         # if we never send anything, simply set the result
 */
        __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
        if (__pyx_t_8) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._bind_execute_many_more", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(6, 948, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_9);

          /* "asyncpg/protocol/coreproto.pyx":949
 *                 # reached the end of the input
 *                 except StopIteration:
 *                     if first:             # <<<<<<<<<<<<<<
 *                         # if we never send anything, simply set the result
 *                         self._push_result()
 */
          __pyx_t_2 = (__pyx_v_first != 0);
          if (__pyx_t_2) {

            /* "asyncpg/protocol/coreproto.pyx":951
 *                     if first:
 *                         # if we never send anything, simply set the result
 *                         self._push_result()             # <<<<<<<<<<<<<<
 *                     else:
 *                         # otherwise, append SYNC and send the buffers
 */
            __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 951, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

            /* "asyncpg/protocol/coreproto.pyx":949
 *                 # reached the end of the input
 *                 except StopIteration:
 *                     if first:             # <<<<<<<<<<<<<<
 *                         # if we never send anything, simply set the result
 *                         self._push_result()
 */
            goto __pyx_L18;
          }

          /* "asyncpg/protocol/coreproto.pyx":954
 *                     else:
 *                         # otherwise, append SYNC and send the buffers
 *                         packet.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *                         buffers.append(memoryview(packet))
 *                         self._writelines(buffers)
 */
          /*else*/ {
            __pyx_t_10 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
            __Pyx_INCREF(__pyx_t_10);
            __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_bytes(__pyx_v_packet, ((PyObject*)__pyx_t_10)); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 954, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

            /* "asyncpg/protocol/coreproto.pyx":955
 *                         # otherwise, append SYNC and send the buffers
 *                         packet.write_bytes(SYNC_MESSAGE)
 *                         buffers.append(memoryview(packet))             # <<<<<<<<<<<<<<
 *                         self._writelines(buffers)
 *                     return False
 */
            __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 955, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_11, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 955, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_buffers, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(6, 955, __pyx_L10_except_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

            /* "asyncpg/protocol/coreproto.pyx":956
 *                         packet.write_bytes(SYNC_MESSAGE)
 *                         buffers.append(memoryview(packet))
 *                         self._writelines(buffers)             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
            __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_writelines(__pyx_v_self, __pyx_v_buffers); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 956, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __pyx_L18:;

          /* "asyncpg/protocol/coreproto.pyx":957
 *                         buffers.append(memoryview(packet))
 *                         self._writelines(buffers)
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 # error in input, give up the buffers and cleanup
 */
          __pyx_r = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L11_except_return;
        }

        /* "asyncpg/protocol/coreproto.pyx":960
 * 
 *                 # error in input, give up the buffers and cleanup
 *                 except Exception as ex:             # <<<<<<<<<<<<<<
 *                     self._bind_execute_many_fail(ex, first)
 *                     return False
 */
        __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_8) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._bind_execute_many_more", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(6, 960, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_v_ex = __pyx_t_3;
          /*try:*/ {

            /* "asyncpg/protocol/coreproto.pyx":961
 *                 # error in input, give up the buffers and cleanup
 *                 except Exception as ex:
 *                     self._bind_execute_many_fail(ex, first)             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
            __pyx_t_13.__pyx_n = 1;
            __pyx_t_13.first = __pyx_v_first;
            __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_bind_execute_many_fail(__pyx_v_self, __pyx_v_ex, &__pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 961, __pyx_L24_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

            /* "asyncpg/protocol/coreproto.pyx":962
 *                 except Exception as ex:
 *                     self._bind_execute_many_fail(ex, first)
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 # all good, write to the buffer
 */
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L23_return;
          }

          /* "asyncpg/protocol/coreproto.pyx":960
 * 
 *                 # error in input, give up the buffers and cleanup
 *                 except Exception as ex:             # <<<<<<<<<<<<<<
 *                     self._bind_execute_many_fail(ex, first)
 *                     return False
 */
          /*finally:*/ {
            __pyx_L24_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
              __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_XGOTREF(__pyx_t_21);
              __pyx_t_8 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_ex);
                __pyx_v_ex = NULL;
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_19);
                __Pyx_XGIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_21);
                __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
              }
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_XGIVEREF(__pyx_t_18);
              __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
              __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
              __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
              goto __pyx_L10_except_error;
            }
            __pyx_L23_return: {
              __pyx_t_2 = __pyx_r;
              __Pyx_DECREF(__pyx_v_ex);
              __pyx_v_ex = NULL;
              __pyx_r = __pyx_t_2;
              goto __pyx_L11_except_return;
            }
          }
        }
        goto __pyx_L10_except_error;
        __pyx_L10_except_error:;

        /* "asyncpg/protocol/coreproto.pyx":943
 *             # fill one 32KB buffer
 *             while packet.len() < _EXECUTE_MANY_BUF_SIZE:
 *                 try:             # <<<<<<<<<<<<<<
 *                     # grab one item from the input
 *                     buf = <WriteBuffer>next(self._execute_iter)
 */
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L11_except_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L15_try_end:;
      }

      /* "asyncpg/protocol/coreproto.pyx":965
 * 
 *                 # all good, write to the buffer
 *                 first = False             # <<<<<<<<<<<<<<
 *                 packet.write_buffer(
 *                     self._build_bind_message(
 */
      __pyx_v_first = 0;

      /* "asyncpg/protocol/coreproto.pyx":968
 *                 packet.write_buffer(
 *                     self._build_bind_message(
 *                         self._execute_portal_name,             # <<<<<<<<<<<<<<
 *                         self._execute_stmt_name,
 *                         buf,
 */
      __pyx_t_1 = __pyx_v_self->_execute_portal_name;
      __Pyx_INCREF(__pyx_t_1);

      /* "asyncpg/protocol/coreproto.pyx":969
 *                     self._build_bind_message(
 *                         self._execute_portal_name,
 *                         self._execute_stmt_name,             # <<<<<<<<<<<<<<
 *                         buf,
 *                     )
 */
      __pyx_t_3 = __pyx_v_self->_execute_stmt_name;
      __Pyx_INCREF(__pyx_t_3);

      /* "asyncpg/protocol/coreproto.pyx":967
 *                 first = False
 *                 packet.write_buffer(
 *                     self._build_bind_message(             # <<<<<<<<<<<<<<
 *                         self._execute_portal_name,
 *                         self._execute_stmt_name,
 */
      __pyx_t_9 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_bind_message(__pyx_v_self, ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_3), __pyx_v_buf)); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/coreproto.pyx":966
 *                 # all good, write to the buffer
 *                 first = False
 *                 packet.write_buffer(             # <<<<<<<<<<<<<<
 *                     self._build_bind_message(
 *                         self._execute_portal_name,
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_buffer(__pyx_v_packet, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/coreproto.pyx":974
 *                 )
 *                 packet.write_buffer(
 *                     self._build_execute_message(self._execute_portal_name, 0,             # <<<<<<<<<<<<<<
 *                     )
 *                 )
 */
      __pyx_t_3 = __pyx_v_self->_execute_portal_name;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_9 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_execute_message(__pyx_v_self, ((PyObject*)__pyx_t_3), 0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 974, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/coreproto.pyx":973
 *                     )
 *                 )
 *                 packet.write_buffer(             # <<<<<<<<<<<<<<
 *                     self._build_execute_message(self._execute_portal_name, 0,
 *                     )
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_packet->__pyx_vtab)->write_buffer(__pyx_v_packet, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }

    /* "asyncpg/protocol/coreproto.pyx":979
 * 
 *             # collected one buffer
 *             buffers.append(memoryview(packet))             # <<<<<<<<<<<<<<
 * 
 *         # write to the wire, and signal the caller for more to send
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_buffers, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(6, 979, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }

  /* "asyncpg/protocol/coreproto.pyx":982
 * 
 *         # write to the wire, and signal the caller for more to send
 *         self._writelines(buffers)             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_9 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_writelines(__pyx_v_self, __pyx_v_buffers); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "asyncpg/protocol/coreproto.pyx":983
 *         # write to the wire, and signal the caller for more to send
 *         self._writelines(buffers)
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     cdef _bind_execute_many_fail(self, object error, bint first=False):
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "asyncpg/protocol/coreproto.pyx":925
 *         return self._bind_execute_many_more(True)
 * 
 *     cdef bint _bind_execute_many_more(self, bint first=False):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer packet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_WriteUnraisable("asyncpg.protocol.protocol.CoreProtocol._bind_execute_many_more", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_packet);
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_buffers);
  __Pyx_XDECREF(__pyx_v_ex);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":985
 *         return True
 * 
 *     cdef _bind_execute_many_fail(self, object error, bint first=False):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_error, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail *__pyx_optional_args) {
  int __pyx_v_first = ((int)0);
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __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("_bind_execute_many_fail", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_first = __pyx_optional_args->first;
    }
  }

  /* "asyncpg/protocol/coreproto.pyx":988
 *         cdef WriteBuffer buf
 * 
 *         self.result_type = RESULT_FAILED             # <<<<<<<<<<<<<<
 *         self.result = error
 *         if first:
 */
  __pyx_v_self->result_type = __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED;

  /* "asyncpg/protocol/coreproto.pyx":989
 * 
 *         self.result_type = RESULT_FAILED
 *         self.result = error             # <<<<<<<<<<<<<<
 *         if first:
 *             self._push_result()
 */
  __Pyx_INCREF(__pyx_v_error);
  __Pyx_GIVEREF(__pyx_v_error);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = __pyx_v_error;

  /* "asyncpg/protocol/coreproto.pyx":990
 *         self.result_type = RESULT_FAILED
 *         self.result = error
 *         if first:             # <<<<<<<<<<<<<<
 *             self._push_result()
 *         elif self.is_in_transaction():
 */
  __pyx_t_1 = (__pyx_v_first != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/coreproto.pyx":991
 *         self.result = error
 *         if first:
 *             self._push_result()             # <<<<<<<<<<<<<<
 *         elif self.is_in_transaction():
 *             # we're in an explicit transaction, just SYNC
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_push_result(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/coreproto.pyx":990
 *         self.result_type = RESULT_FAILED
 *         self.result = error
 *         if first:             # <<<<<<<<<<<<<<
 *             self._push_result()
 *         elif self.is_in_transaction():
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/coreproto.pyx":992
 *         if first:
 *             self._push_result()
 *         elif self.is_in_transaction():             # <<<<<<<<<<<<<<
 *             # we're in an explicit transaction, just SYNC
 *             self._write(SYNC_MESSAGE)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->is_in_transaction(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(6, 992, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/coreproto.pyx":994
 *         elif self.is_in_transaction():
 *             # we're in an explicit transaction, just SYNC
 *             self._write(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *         else:
 *             # In an implicit transaction, if `ignore_till_sync` is set,
 */
    __pyx_t_2 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 994, __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;

    /* "asyncpg/protocol/coreproto.pyx":992
 *         if first:
 *             self._push_result()
 *         elif self.is_in_transaction():             # <<<<<<<<<<<<<<
 *             # we're in an explicit transaction, just SYNC
 *             self._write(SYNC_MESSAGE)
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/coreproto.pyx":1003
 *             # GOTCHA: cannot use simple query message here, because it is
 *             # ignored if `ignore_till_sync` is set.
 *             buf = self._build_parse_message('', 'ROLLBACK')             # <<<<<<<<<<<<<<
 *             buf.write_buffer(self._build_bind_message(
 *                 '', '', self._build_empty_bind_data()))
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_parse_message(__pyx_v_self, __pyx_kp_u__37, __pyx_n_u_ROLLBACK)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/coreproto.pyx":1005
 *             buf = self._build_parse_message('', 'ROLLBACK')
 *             buf.write_buffer(self._build_bind_message(
 *                 '', '', self._build_empty_bind_data()))             # <<<<<<<<<<<<<<
 *             buf.write_buffer(self._build_execute_message('', 0))
 *             buf.write_bytes(SYNC_MESSAGE)
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_empty_bind_data(__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/coreproto.pyx":1004
 *             # ignored if `ignore_till_sync` is set.
 *             buf = self._build_parse_message('', 'ROLLBACK')
 *             buf.write_buffer(self._build_bind_message(             # <<<<<<<<<<<<<<
 *                 '', '', self._build_empty_bind_data()))
 *             buf.write_buffer(self._build_execute_message('', 0))
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_bind_message(__pyx_v_self, __pyx_kp_u__37, __pyx_kp_u__37, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1004, __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;

    /* "asyncpg/protocol/coreproto.pyx":1006
 *             buf.write_buffer(self._build_bind_message(
 *                 '', '', self._build_empty_bind_data()))
 *             buf.write_buffer(self._build_execute_message('', 0))             # <<<<<<<<<<<<<<
 *             buf.write_bytes(SYNC_MESSAGE)
 *             self._write(buf)
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_execute_message(__pyx_v_self, __pyx_kp_u__37, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_buffer(__pyx_v_buf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1006, __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;

    /* "asyncpg/protocol/coreproto.pyx":1007
 *                 '', '', self._build_empty_bind_data()))
 *             buf.write_buffer(self._build_execute_message('', 0))
 *             buf.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *             self._write(buf)
 * 
 */
    __pyx_t_2 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytes(__pyx_v_buf, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1007, __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;

    /* "asyncpg/protocol/coreproto.pyx":1008
 *             buf.write_buffer(self._build_execute_message('', 0))
 *             buf.write_bytes(SYNC_MESSAGE)
 *             self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _execute(self, str portal_name, int32_t limit):
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/coreproto.pyx":985
 *         return True
 * 
 *     cdef _bind_execute_many_fail(self, object error, bint first=False):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._bind_execute_many_fail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1010
 *             self._write(buf)
 * 
 *     cdef _execute(self, str portal_name, int32_t limit):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, int32_t __pyx_v_limit) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_execute", 0);

  /* "asyncpg/protocol/coreproto.pyx":1013
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_EXECUTE)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1014
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_EXECUTE)             # <<<<<<<<<<<<<<
 * 
 *         self.result = []
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_EXECUTE); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1016
 *         self._set_state(PROTOCOL_EXECUTE)
 * 
 *         self.result = []             # <<<<<<<<<<<<<<
 * 
 *         buf = self._build_execute_message(portal_name, limit)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->result);
  __Pyx_DECREF(__pyx_v_self->result);
  __pyx_v_self->result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1018
 *         self.result = []
 * 
 *         buf = self._build_execute_message(portal_name, limit)             # <<<<<<<<<<<<<<
 * 
 *         buf.write_bytes(SYNC_MESSAGE)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_execute_message(__pyx_v_self, __pyx_v_portal_name, __pyx_v_limit)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1020
 *         buf = self._build_execute_message(portal_name, limit)
 * 
 *         buf.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 * 
 *         self._write(buf)
 */
  __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytes(__pyx_v_buf, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1020, __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;

  /* "asyncpg/protocol/coreproto.pyx":1022
 *         buf.write_bytes(SYNC_MESSAGE)
 * 
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _bind(self, str portal_name, str stmt_name,
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1010
 *             self._write(buf)
 * 
 *     cdef _execute(self, str portal_name, int32_t limit):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1024
 *         self._write(buf)
 * 
 *     cdef _bind(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                WriteBuffer bind_data):
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_stmt_name, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_bind_data) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_bind", 0);

  /* "asyncpg/protocol/coreproto.pyx":1029
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_BIND)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1030
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_BIND)             # <<<<<<<<<<<<<<
 * 
 *         buf = self._build_bind_message(portal_name, stmt_name, bind_data)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1032
 *         self._set_state(PROTOCOL_BIND)
 * 
 *         buf = self._build_bind_message(portal_name, stmt_name, bind_data)             # <<<<<<<<<<<<<<
 * 
 *         buf.write_bytes(SYNC_MESSAGE)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_build_bind_message(__pyx_v_self, __pyx_v_portal_name, __pyx_v_stmt_name, __pyx_v_bind_data)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1034
 *         buf = self._build_bind_message(portal_name, stmt_name, bind_data)
 * 
 *         buf.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 * 
 *         self._write(buf)
 */
  __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytes(__pyx_v_buf, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1034, __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;

  /* "asyncpg/protocol/coreproto.pyx":1036
 *         buf.write_bytes(SYNC_MESSAGE)
 * 
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _close(self, str name, bint is_portal):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1024
 *         self._write(buf)
 * 
 *     cdef _bind(self, str portal_name, str stmt_name,             # <<<<<<<<<<<<<<
 *                WriteBuffer bind_data):
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1038
 *         self._write(buf)
 * 
 *     cdef _close(self, str name, bint is_portal):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__close(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_is_portal) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close", 0);

  /* "asyncpg/protocol/coreproto.pyx":1041
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_CLOSE_STMT_PORTAL)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1042
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_CLOSE_STMT_PORTAL)             # <<<<<<<<<<<<<<
 * 
 *         buf = WriteBuffer.new_message(b'C')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CLOSE_STMT_PORTAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1044
 *         self._set_state(PROTOCOL_CLOSE_STMT_PORTAL)
 * 
 *         buf = WriteBuffer.new_message(b'C')             # <<<<<<<<<<<<<<
 * 
 *         if is_portal:
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('C')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1046
 *         buf = WriteBuffer.new_message(b'C')
 * 
 *         if is_portal:             # <<<<<<<<<<<<<<
 *             buf.write_byte(b'P')
 *         else:
 */
  __pyx_t_2 = (__pyx_v_is_portal != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/coreproto.pyx":1047
 * 
 *         if is_portal:
 *             buf.write_byte(b'P')             # <<<<<<<<<<<<<<
 *         else:
 *             buf.write_byte(b'S')
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_byte(__pyx_v_buf, 'P'); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/coreproto.pyx":1046
 *         buf = WriteBuffer.new_message(b'C')
 * 
 *         if is_portal:             # <<<<<<<<<<<<<<
 *             buf.write_byte(b'P')
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/coreproto.pyx":1049
 *             buf.write_byte(b'P')
 *         else:
 *             buf.write_byte(b'S')             # <<<<<<<<<<<<<<
 * 
 *         buf.write_str(name, self.encoding)
 */
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_byte(__pyx_v_buf, 'S'); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/coreproto.pyx":1051
 *             buf.write_byte(b'S')
 * 
 *         buf.write_str(name, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 * 
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_name, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1051, __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;

  /* "asyncpg/protocol/coreproto.pyx":1052
 * 
 *         buf.write_str(name, self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 * 
 *         buf.write_bytes(SYNC_MESSAGE)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1054
 *         buf.end_message()
 * 
 *         buf.write_bytes(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 * 
 *         self._write(buf)
 */
  __pyx_t_3 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_bytes(__pyx_v_buf, ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1054, __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;

  /* "asyncpg/protocol/coreproto.pyx":1056
 *         buf.write_bytes(SYNC_MESSAGE)
 * 
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _simple_query(self, str query):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1038
 *         self._write(buf)
 * 
 *     cdef _close(self, str name, bint is_portal):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1058
 *         self._write(buf)
 * 
 *     cdef _simple_query(self, str query):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_query) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_simple_query", 0);

  /* "asyncpg/protocol/coreproto.pyx":1060
 *     cdef _simple_query(self, str query):
 *         cdef WriteBuffer buf
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_SIMPLE_QUERY)
 *         buf = WriteBuffer.new_message(b'Q')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1061
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_SIMPLE_QUERY)             # <<<<<<<<<<<<<<
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(query, self.encoding)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_SIMPLE_QUERY); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1062
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_SIMPLE_QUERY)
 *         buf = WriteBuffer.new_message(b'Q')             # <<<<<<<<<<<<<<
 *         buf.write_str(query, self.encoding)
 *         buf.end_message()
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('Q')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1063
 *         self._set_state(PROTOCOL_SIMPLE_QUERY)
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(query, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_query, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1063, __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;

  /* "asyncpg/protocol/coreproto.pyx":1064
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(query, self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1065
 *         buf.write_str(query, self.encoding)
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _copy_out(self, str copy_stmt):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1058
 *         self._write(buf)
 * 
 *     cdef _simple_query(self, str query):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._simple_query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1067
 *         self._write(buf)
 * 
 *     cdef _copy_out(self, str copy_stmt):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy_out", 0);

  /* "asyncpg/protocol/coreproto.pyx":1070
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_COPY_OUT)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1071
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_COPY_OUT)             # <<<<<<<<<<<<<<
 * 
 *         # Send the COPY .. TO STDOUT using the SimpleQuery protocol.
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1074
 * 
 *         # Send the COPY .. TO STDOUT using the SimpleQuery protocol.
 *         buf = WriteBuffer.new_message(b'Q')             # <<<<<<<<<<<<<<
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('Q')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1075
 *         # Send the COPY .. TO STDOUT using the SimpleQuery protocol.
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(copy_stmt, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_copy_stmt, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1075, __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;

  /* "asyncpg/protocol/coreproto.pyx":1076
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1077
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _copy_in(self, str copy_stmt):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1067
 *         self._write(buf)
 * 
 *     cdef _copy_out(self, str copy_stmt):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1079
 *         self._write(buf)
 * 
 *     cdef _copy_in(self, str copy_stmt):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy_in", 0);

  /* "asyncpg/protocol/coreproto.pyx":1082
 *         cdef WriteBuffer buf
 * 
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_COPY_IN)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1083
 * 
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_COPY_IN)             # <<<<<<<<<<<<<<
 * 
 *         buf = WriteBuffer.new_message(b'Q')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1085
 *         self._set_state(PROTOCOL_COPY_IN)
 * 
 *         buf = WriteBuffer.new_message(b'Q')             # <<<<<<<<<<<<<<
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('Q')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1086
 * 
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(copy_stmt, self.encoding)             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->write_str(__pyx_v_buf, __pyx_v_copy_stmt, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1086, __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;

  /* "asyncpg/protocol/coreproto.pyx":1087
 *         buf = WriteBuffer.new_message(b'Q')
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1088
 *         buf.write_str(copy_stmt, self.encoding)
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _terminate(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1079
 *         self._write(buf)
 * 
 *     cdef _copy_in(self, str copy_stmt):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 * 
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1090
 *         self._write(buf)
 * 
 *     cdef _terminate(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__terminate(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_buf = 0;
  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("_terminate", 0);

  /* "asyncpg/protocol/coreproto.pyx":1092
 *     cdef _terminate(self):
 *         cdef WriteBuffer buf
 *         self._ensure_connected()             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_TERMINATING)
 *         buf = WriteBuffer.new_message(b'X')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_ensure_connected(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1093
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_TERMINATING)             # <<<<<<<<<<<<<<
 *         buf = WriteBuffer.new_message(b'X')
 *         buf.end_message()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_set_state(__pyx_v_self, __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1094
 *         self._ensure_connected()
 *         self._set_state(PROTOCOL_TERMINATING)
 *         buf = WriteBuffer.new_message(b'X')             # <<<<<<<<<<<<<<
 *         buf.end_message()
 *         self._write(buf)
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('X')); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1095
 *         self._set_state(PROTOCOL_TERMINATING)
 *         buf = WriteBuffer.new_message(b'X')
 *         buf.end_message()             # <<<<<<<<<<<<<<
 *         self._write(buf)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_buf->__pyx_vtab)->end_message(__pyx_v_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1096
 *         buf = WriteBuffer.new_message(b'X')
 *         buf.end_message()
 *         self._write(buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write(self, buf):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_write(__pyx_v_self, ((PyObject *)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1090
 *         self._write(buf)
 * 
 *     cdef _terminate(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         self._ensure_connected()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._terminate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1098
 *         self._write(buf)
 * 
 *     cdef _write(self, buf):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_buf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_write", 0);

  /* "asyncpg/protocol/coreproto.pyx":1099
 * 
 *     cdef _write(self, buf):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     cdef _writelines(self, list buffers):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(6, 1099, __pyx_L1_error)

  /* "asyncpg/protocol/coreproto.pyx":1098
 *         self._write(buf)
 * 
 *     cdef _write(self, buf):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1101
 *         raise NotImplementedError
 * 
 *     cdef _writelines(self, list buffers):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__writelines(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_buffers) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_writelines", 0);

  /* "asyncpg/protocol/coreproto.pyx":1102
 * 
 *     cdef _writelines(self, list buffers):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(6, 1102, __pyx_L1_error)

  /* "asyncpg/protocol/coreproto.pyx":1101
 *         raise NotImplementedError
 * 
 *     cdef _writelines(self, list buffers):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol._writelines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pyx":1104
 *         raise NotImplementedError
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__decode_row(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED char const *__pyx_v_buf, CYTHON_UNUSED Py_ssize_t __pyx_v_buf_len) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decode_row", 0);

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

/* "asyncpg/protocol/coreproto.pyx":1107
 *         pass
 * 
 *     cdef _set_server_parameter(self, name, val):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_server_parameter(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *__pyx_v_val) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_server_parameter", 0);

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

/* "asyncpg/protocol/coreproto.pyx":1110
 *         pass
 * 
 *     cdef _on_result(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_result(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_result", 0);

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

/* "asyncpg/protocol/coreproto.pyx":1113
 *         pass
 * 
 *     cdef _on_notice(self, parsed):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notice(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_parsed) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_notice", 0);

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

/* "asyncpg/protocol/coreproto.pyx":1116
 *         pass
 * 
 *     cdef _on_notification(self, pid, channel, payload):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notification(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_pid, CYTHON_UNUSED PyObject *__pyx_v_channel, CYTHON_UNUSED PyObject *__pyx_v_payload) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_notification", 0);

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

/* "asyncpg/protocol/coreproto.pyx":1119
 *         pass
 * 
 *     cdef _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_connection_lost(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_connection_lost", 0);

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

/* "asyncpg/protocol/coreproto.pxd":104
 *         SCRAMAuthentication scram
 * 
 *         readonly int32_t backend_pid             # <<<<<<<<<<<<<<
 *         readonly int32_t backend_secret
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->backend_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.backend_pid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/coreproto.pxd":105
 * 
 *         readonly int32_t backend_pid
 *         readonly int32_t backend_secret             # <<<<<<<<<<<<<<
 * 
 *         ## Result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->backend_secret); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.backend_secret.__get__", __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):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_5__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_7asyncpg_8protocol_8protocol_12CoreProtocol_4__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_4__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._skip_discard, self.backend_pid, self.backend_secret, self.buffer, self.con_params, self.con_status, self.encoding, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.scram, self.state, self.transport, self.xact_status)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_discard_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->_skip_discard); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_self->backend_pid); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_self->backend_secret); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(__pyx_v_self->con_status); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->result_execute_completed); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(__pyx_v_self->result_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_self->state); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(__pyx_v_self->xact_status); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(21); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_execute_iter);
  __Pyx_GIVEREF(__pyx_v_self->_execute_iter);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_self->_execute_iter);
  __Pyx_INCREF(__pyx_v_self->_execute_portal_name);
  __Pyx_GIVEREF(__pyx_v_self->_execute_portal_name);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_self->_execute_portal_name);
  __Pyx_INCREF(__pyx_v_self->_execute_stmt_name);
  __Pyx_GIVEREF(__pyx_v_self->_execute_stmt_name);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_self->_execute_stmt_name);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->buffer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->buffer));
  PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_self->buffer));
  __Pyx_INCREF(__pyx_v_self->con_params);
  __Pyx_GIVEREF(__pyx_v_self->con_params);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_v_self->con_params);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 9, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->encoding);
  __Pyx_GIVEREF(__pyx_v_self->encoding);
  PyTuple_SET_ITEM(__pyx_t_10, 10, __pyx_v_self->encoding);
  __Pyx_INCREF(__pyx_v_self->result);
  __Pyx_GIVEREF(__pyx_v_self->result);
  PyTuple_SET_ITEM(__pyx_t_10, 11, __pyx_v_self->result);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->result_param_desc);
  __Pyx_GIVEREF(__pyx_v_self->result_param_desc);
  PyTuple_SET_ITEM(__pyx_t_10, 13, __pyx_v_self->result_param_desc);
  __Pyx_INCREF(__pyx_v_self->result_row_desc);
  __Pyx_GIVEREF(__pyx_v_self->result_row_desc);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_v_self->result_row_desc);
  __Pyx_INCREF(__pyx_v_self->result_status_msg);
  __Pyx_GIVEREF(__pyx_v_self->result_status_msg);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->result_status_msg);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->scram));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->scram));
  PyTuple_SET_ITEM(__pyx_t_10, 17, ((PyObject *)__pyx_v_self->scram));
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->transport);
  __Pyx_GIVEREF(__pyx_v_self->transport);
  PyTuple_SET_ITEM(__pyx_t_10, 19, __pyx_v_self->transport);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 20, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._skip_discard, self.backend_pid, self.backend_secret, self.buffer, self.con_params, self.con_status, self.encoding, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.scram, self.state, self.transport, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":7
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._skip_discard, self.backend_pid, self.backend_secret, self.buffer, self.con_params, self.con_status, self.encoding, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.scram, self.state, self.transport, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.buffer is not None or self.con_params is not None or self.encoding is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.transport is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._skip_discard, self.backend_pid, self.backend_secret, self.buffer, self.con_params, self.con_status, self.encoding, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.scram, self.state, self.transport, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.buffer is not None or self.con_params is not None or self.encoding is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.transport is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, None), state
 */
  /*else*/ {
    __pyx_t_11 = (__pyx_v_self->_execute_iter != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->_execute_portal_name != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->_execute_stmt_name != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->buffer) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->con_params != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->encoding != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->result != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->result_param_desc != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->result_row_desc != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->result_status_msg != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->scram) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->transport != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    __pyx_t_12 = __pyx_t_11;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.buffer is not None or self.con_params is not None or self.encoding is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.transport is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":13
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.buffer is not None or self.con_params is not None or self.encoding is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.transport is not None
 *     if use_setstate:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pyx_unpickle_CoreProtocol); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_263996099);
    __Pyx_GIVEREF(__pyx_int_263996099);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_263996099);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.buffer is not None or self.con_params is not None or self.encoding is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.transport is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, None), state
 *     else:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoreProtocol__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pyx_unpickle_CoreProtocol); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_263996099);
    __Pyx_GIVEREF(__pyx_int_263996099);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_263996099);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoreProtocol__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_7__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_7asyncpg_8protocol_8protocol_12CoreProtocol_6__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12CoreProtocol_6__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v_self, 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)":17
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CoreProtocol__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_CoreProtocol__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_CoreProtocol, (type(self), 0xfbc42c3, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CoreProtocol__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.CoreProtocol.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":14
 * cdef class PreparedStatementState:
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         str name,
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_query = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_protocol = 0;
  PyTypeObject *__pyx_v_record_class = 0;
  int __pyx_v_ignore_custom_codec;
  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_name,&__pyx_n_s_query,&__pyx_n_s_protocol,&__pyx_n_s_record_class,&__pyx_n_s_ignore_custom_codec,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_name)) != 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_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); __PYX_ERR(7, 14, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_protocol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); __PYX_ERR(7, 14, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_record_class)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); __PYX_ERR(7, 14, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_custom_codec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); __PYX_ERR(7, 14, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(7, 14, __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_name = ((PyObject*)values[0]);
    __pyx_v_query = ((PyObject*)values[1]);
    __pyx_v_protocol = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)values[2]);
    __pyx_v_record_class = ((PyTypeObject*)values[3]);
    __pyx_v_ignore_custom_codec = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_ignore_custom_codec == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 20, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(7, 14, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(7, 16, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyUnicode_Type), 1, "query", 1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_protocol), __pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol, 1, "protocol", 0))) __PYX_ERR(7, 18, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record_class), (&PyType_Type), 1, "record_class", 1))) __PYX_ERR(7, 19, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState___cinit__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self), __pyx_v_name, __pyx_v_query, __pyx_v_protocol, __pyx_v_record_class, __pyx_v_ignore_custom_codec);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState___cinit__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_query, struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_protocol, PyTypeObject *__pyx_v_record_class, int __pyx_v_ignore_custom_codec) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":22
 *         bint ignore_custom_codec
 *     ):
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.query = query
 *         self.settings = protocol.settings
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "asyncpg/protocol/prepared_stmt.pyx":23
 *     ):
 *         self.name = name
 *         self.query = query             # <<<<<<<<<<<<<<
 *         self.settings = protocol.settings
 *         self.row_desc = self.parameters_desc = None
 */
  __Pyx_INCREF(__pyx_v_query);
  __Pyx_GIVEREF(__pyx_v_query);
  __Pyx_GOTREF(__pyx_v_self->query);
  __Pyx_DECREF(__pyx_v_self->query);
  __pyx_v_self->query = __pyx_v_query;

  /* "asyncpg/protocol/prepared_stmt.pyx":24
 *         self.name = name
 *         self.query = query
 *         self.settings = protocol.settings             # <<<<<<<<<<<<<<
 *         self.row_desc = self.parameters_desc = None
 *         self.args_codecs = self.rows_codecs = None
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_protocol->settings);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->settings);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->settings));
  __pyx_v_self->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":25
 *         self.query = query
 *         self.settings = protocol.settings
 *         self.row_desc = self.parameters_desc = None             # <<<<<<<<<<<<<<
 *         self.args_codecs = self.rows_codecs = None
 *         self.args_num = self.cols_num = 0
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->row_desc);
  __Pyx_DECREF(__pyx_v_self->row_desc);
  __pyx_v_self->row_desc = ((PyObject*)Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->parameters_desc);
  __Pyx_DECREF(__pyx_v_self->parameters_desc);
  __pyx_v_self->parameters_desc = ((PyObject*)Py_None);

  /* "asyncpg/protocol/prepared_stmt.pyx":26
 *         self.settings = protocol.settings
 *         self.row_desc = self.parameters_desc = None
 *         self.args_codecs = self.rows_codecs = None             # <<<<<<<<<<<<<<
 *         self.args_num = self.cols_num = 0
 *         self.cols_desc = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->args_codecs);
  __Pyx_DECREF(__pyx_v_self->args_codecs);
  __pyx_v_self->args_codecs = ((PyObject*)Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->rows_codecs);
  __Pyx_DECREF(__pyx_v_self->rows_codecs);
  __pyx_v_self->rows_codecs = ((PyObject*)Py_None);

  /* "asyncpg/protocol/prepared_stmt.pyx":27
 *         self.row_desc = self.parameters_desc = None
 *         self.args_codecs = self.rows_codecs = None
 *         self.args_num = self.cols_num = 0             # <<<<<<<<<<<<<<
 *         self.cols_desc = None
 *         self.closed = False
 */
  __pyx_v_self->args_num = 0;
  __pyx_v_self->cols_num = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":28
 *         self.args_codecs = self.rows_codecs = None
 *         self.args_num = self.cols_num = 0
 *         self.cols_desc = None             # <<<<<<<<<<<<<<
 *         self.closed = False
 *         self.refs = 0
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->cols_desc);
  __Pyx_DECREF(__pyx_v_self->cols_desc);
  __pyx_v_self->cols_desc = Py_None;

  /* "asyncpg/protocol/prepared_stmt.pyx":29
 *         self.args_num = self.cols_num = 0
 *         self.cols_desc = None
 *         self.closed = False             # <<<<<<<<<<<<<<
 *         self.refs = 0
 *         self.record_class = record_class
 */
  __pyx_v_self->closed = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":30
 *         self.cols_desc = None
 *         self.closed = False
 *         self.refs = 0             # <<<<<<<<<<<<<<
 *         self.record_class = record_class
 *         self.ignore_custom_codec = ignore_custom_codec
 */
  __pyx_v_self->refs = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":31
 *         self.closed = False
 *         self.refs = 0
 *         self.record_class = record_class             # <<<<<<<<<<<<<<
 *         self.ignore_custom_codec = ignore_custom_codec
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_record_class));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_record_class));
  __Pyx_GOTREF(__pyx_v_self->record_class);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->record_class));
  __pyx_v_self->record_class = __pyx_v_record_class;

  /* "asyncpg/protocol/prepared_stmt.pyx":32
 *         self.refs = 0
 *         self.record_class = record_class
 *         self.ignore_custom_codec = ignore_custom_codec             # <<<<<<<<<<<<<<
 * 
 *     def _get_parameters(self):
 */
  __pyx_v_self->ignore_custom_codec = __pyx_v_ignore_custom_codec;

  /* "asyncpg/protocol/prepared_stmt.pyx":14
 * cdef class PreparedStatementState:
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         str name,
 */

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

/* "asyncpg/protocol/prepared_stmt.pyx":34
 *         self.ignore_custom_codec = ignore_custom_codec
 * 
 *     def _get_parameters(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_3_get_parameters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_3_get_parameters(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_parameters (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_2_get_parameters(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_2_get_parameters(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_parameters", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":37
 *         cdef Codec codec
 * 
 *         result = []             # <<<<<<<<<<<<<<
 *         for oid in self.parameters_desc:
 *             codec = self.settings.get_data_codec(oid)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":38
 * 
 *         result = []
 *         for oid in self.parameters_desc:             # <<<<<<<<<<<<<<
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:
 */
  if (unlikely(__pyx_v_self->parameters_desc == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(7, 38, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->parameters_desc; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(7, 38, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":39
 *         result = []
 *         for oid in self.parameters_desc:
 *             codec = self.settings.get_data_codec(oid)             # <<<<<<<<<<<<<<
 *             if codec is None:
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 39, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(__pyx_v_self->settings, __pyx_t_4, 0, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":40
 *         for oid in self.parameters_desc:
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (unlikely(__pyx_t_6)) {

      /* "asyncpg/protocol/prepared_stmt.pyx":41
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'missing codec information for OID {}'.format(oid))
 *             result.append(apg_types.Type(
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":42
 *             if codec is None:
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))             # <<<<<<<<<<<<<<
 *             result.append(apg_types.Type(
 *                 oid, codec.name, codec.kind, codec.schema))
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_missing_codec_information_for_OI, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 42, __pyx_L1_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_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_oid) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_oid);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(7, 41, __pyx_L1_error)

      /* "asyncpg/protocol/prepared_stmt.pyx":40
 *         for oid in self.parameters_desc:
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":43
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 *             result.append(apg_types.Type(             # <<<<<<<<<<<<<<
 *                 oid, codec.name, codec.kind, codec.schema))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_apg_types); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Type); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":44
 *                     'missing codec information for OID {}'.format(oid))
 *             result.append(apg_types.Type(
 *                 oid, codec.name, codec.kind, codec.schema))             # <<<<<<<<<<<<<<
 * 
 *         return tuple(result)
 */
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    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_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_oid, __pyx_v_codec->name, __pyx_v_codec->kind, __pyx_v_codec->schema};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 43, __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_7)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_oid, __pyx_v_codec->name, __pyx_v_codec->kind, __pyx_v_codec->schema};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 43, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_v_oid);
      __Pyx_INCREF(__pyx_v_codec->name);
      __Pyx_GIVEREF(__pyx_v_codec->name);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_v_codec->name);
      __Pyx_INCREF(__pyx_v_codec->kind);
      __Pyx_GIVEREF(__pyx_v_codec->kind);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_11, __pyx_v_codec->kind);
      __Pyx_INCREF(__pyx_v_codec->schema);
      __Pyx_GIVEREF(__pyx_v_codec->schema);
      PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_11, __pyx_v_codec->schema);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":43
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 *             result.append(apg_types.Type(             # <<<<<<<<<<<<<<
 *                 oid, codec.name, codec.kind, codec.schema))
 * 
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(7, 43, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":38
 * 
 *         result = []
 *         for oid in self.parameters_desc:             # <<<<<<<<<<<<<<
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":46
 *                 oid, codec.name, codec.kind, codec.schema))
 * 
 *         return tuple(result)             # <<<<<<<<<<<<<<
 * 
 *     def _get_attributes(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":34
 *         self.ignore_custom_codec = ignore_custom_codec
 * 
 *     def _get_parameters(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._get_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":48
 *         return tuple(result)
 * 
 *     def _get_attributes(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5_get_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5_get_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_attributes (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4_get_attributes(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4_get_attributes(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_oid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  uint32_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_attributes", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":51
 *         cdef Codec codec
 * 
 *         if not self.row_desc:             # <<<<<<<<<<<<<<
 *             return ()
 * 
 */
  __pyx_t_1 = (__pyx_v_self->row_desc != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->row_desc) != 0);
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":52
 * 
 *         if not self.row_desc:
 *             return ()             # <<<<<<<<<<<<<<
 * 
 *         result = []
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;

    /* "asyncpg/protocol/prepared_stmt.pyx":51
 *         cdef Codec codec
 * 
 *         if not self.row_desc:             # <<<<<<<<<<<<<<
 *             return ()
 * 
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":54
 *             return ()
 * 
 *         result = []             # <<<<<<<<<<<<<<
 *         for d in self.row_desc:
 *             name = d[0]
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":55
 * 
 *         result = []
 *         for d in self.row_desc:             # <<<<<<<<<<<<<<
 *             name = d[0]
 *             oid = d[3]
 */
  if (unlikely(__pyx_v_self->row_desc == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(7, 55, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_self->row_desc; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= 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_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(7, 55, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":56
 *         result = []
 *         for d in self.row_desc:
 *             name = d[0]             # <<<<<<<<<<<<<<
 *             oid = d[3]
 * 
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":57
 *         for d in self.row_desc:
 *             name = d[0]
 *             oid = d[3]             # <<<<<<<<<<<<<<
 * 
 *             codec = self.settings.get_data_codec(oid)
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_d, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 57, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_oid, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":59
 *             oid = d[3]
 * 
 *             codec = self.settings.get_data_codec(oid)             # <<<<<<<<<<<<<<
 *             if codec is None:
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_v_oid); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 59, __pyx_L1_error)
    __pyx_t_5 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(__pyx_v_self->settings, __pyx_t_6, 0, NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":60
 * 
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (unlikely(__pyx_t_1)) {

      /* "asyncpg/protocol/prepared_stmt.pyx":61
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'missing codec information for OID {}'.format(oid))
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":62
 *             if codec is None:
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))             # <<<<<<<<<<<<<<
 * 
 *             name = name.decode(self.settings._encoding)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_missing_codec_information_for_OI, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 62, __pyx_L1_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_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_oid) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_oid);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(7, 61, __pyx_L1_error)

      /* "asyncpg/protocol/prepared_stmt.pyx":60
 * 
 *             codec = self.settings.get_data_codec(oid)
 *             if codec is None:             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'missing codec information for OID {}'.format(oid))
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":64
 *                     'missing codec information for OID {}'.format(oid))
 * 
 *             name = name.decode(self.settings._encoding)             # <<<<<<<<<<<<<<
 * 
 *             result.append(
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_decode); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_self->settings->_encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_self->settings->_encoding);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":67
 * 
 *             result.append(
 *                 apg_types.Attribute(name,             # <<<<<<<<<<<<<<
 *                     apg_types.Type(oid, codec.name, codec.kind, codec.schema)))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_apg_types); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":68
 *             result.append(
 *                 apg_types.Attribute(name,
 *                     apg_types.Type(oid, codec.name, codec.kind, codec.schema)))             # <<<<<<<<<<<<<<
 * 
 *         return tuple(result)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_apg_types); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_Type); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(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_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_oid, __pyx_v_codec->name, __pyx_v_codec->kind, __pyx_v_codec->schema};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 68, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_8);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_oid, __pyx_v_codec->name, __pyx_v_codec->kind, __pyx_v_codec->schema};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 68, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_8);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 68, __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_v_oid);
      __Pyx_GIVEREF(__pyx_v_oid);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_oid);
      __Pyx_INCREF(__pyx_v_codec->name);
      __Pyx_GIVEREF(__pyx_v_codec->name);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_codec->name);
      __Pyx_INCREF(__pyx_v_codec->kind);
      __Pyx_GIVEREF(__pyx_v_codec->kind);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_codec->kind);
      __Pyx_INCREF(__pyx_v_codec->schema);
      __Pyx_GIVEREF(__pyx_v_codec->schema);
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_v_codec->schema);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 68, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_name, __pyx_t_8};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 67, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_name, __pyx_t_8};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 67, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(7, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":66
 *             name = name.decode(self.settings._encoding)
 * 
 *             result.append(             # <<<<<<<<<<<<<<
 *                 apg_types.Attribute(name,
 *                     apg_types.Type(oid, codec.name, codec.kind, codec.schema)))
 */
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_5); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(7, 66, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":55
 * 
 *         result = []
 *         for d in self.row_desc:             # <<<<<<<<<<<<<<
 *             name = d[0]
 *             oid = d[3]
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":70
 *                     apg_types.Type(oid, codec.name, codec.kind, codec.schema)))
 * 
 *         return tuple(result)             # <<<<<<<<<<<<<<
 * 
 *     def _init_types(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":48
 *         return tuple(result)
 * 
 *     def _get_attributes(self):             # <<<<<<<<<<<<<<
 *         cdef Codec codec
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __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("asyncpg.protocol.protocol.PreparedStatementState._get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_oid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":72
 *         return tuple(result)
 * 
 *     def _init_types(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec codec
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_7_init_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_7_init_types(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_types (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6_init_types(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6_init_types(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_missing = 0;
  PyObject *__pyx_v_p_oid = NULL;
  PyObject *__pyx_v_rdesc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_init_types", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":75
 *         cdef:
 *             Codec codec
 *             set missing = set()             # <<<<<<<<<<<<<<
 * 
 *         if self.parameters_desc:
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_missing = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":77
 *             set missing = set()
 * 
 *         if self.parameters_desc:             # <<<<<<<<<<<<<<
 *             for p_oid in self.parameters_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 */
  __pyx_t_2 = (__pyx_v_self->parameters_desc != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->parameters_desc) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":78
 * 
 *         if self.parameters_desc:
 *             for p_oid in self.parameters_desc:             # <<<<<<<<<<<<<<
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 *                 if codec is None or not codec.has_encoder():
 */
    if (unlikely(__pyx_v_self->parameters_desc == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(7, 78, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_self->parameters_desc; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= 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_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(7, 78, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_p_oid, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":79
 *         if self.parameters_desc:
 *             for p_oid in self.parameters_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)             # <<<<<<<<<<<<<<
 *                 if codec is None or not codec.has_encoder():
 *                     missing.add(p_oid)
 */
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_p_oid); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 79, __pyx_L1_error)
      __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(__pyx_v_self->settings, ((uint32_t)__pyx_t_5), 0, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":80
 *             for p_oid in self.parameters_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 *                 if codec is None or not codec.has_encoder():             # <<<<<<<<<<<<<<
 *                     missing.add(p_oid)
 * 
 */
      __pyx_t_6 = (((PyObject *)__pyx_v_codec) == Py_None);
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (!__pyx_t_7) {
      } else {
        __pyx_t_2 = __pyx_t_7;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(__pyx_v_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(7, 80, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = ((!__pyx_t_7) != 0);
      __pyx_t_2 = __pyx_t_6;
      __pyx_L7_bool_binop_done:;
      if (__pyx_t_2) {

        /* "asyncpg/protocol/prepared_stmt.pyx":81
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 *                 if codec is None or not codec.has_encoder():
 *                     missing.add(p_oid)             # <<<<<<<<<<<<<<
 * 
 *         if self.row_desc:
 */
        __pyx_t_8 = PySet_Add(__pyx_v_missing, __pyx_v_p_oid); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 81, __pyx_L1_error)

        /* "asyncpg/protocol/prepared_stmt.pyx":80
 *             for p_oid in self.parameters_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 *                 if codec is None or not codec.has_encoder():             # <<<<<<<<<<<<<<
 *                     missing.add(p_oid)
 * 
 */
      }

      /* "asyncpg/protocol/prepared_stmt.pyx":78
 * 
 *         if self.parameters_desc:
 *             for p_oid in self.parameters_desc:             # <<<<<<<<<<<<<<
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 *                 if codec is None or not codec.has_encoder():
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":77
 *             set missing = set()
 * 
 *         if self.parameters_desc:             # <<<<<<<<<<<<<<
 *             for p_oid in self.parameters_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>p_oid)
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":83
 *                     missing.add(p_oid)
 * 
 *         if self.row_desc:             # <<<<<<<<<<<<<<
 *             for rdesc in self.row_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 */
  __pyx_t_2 = (__pyx_v_self->row_desc != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->row_desc) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":84
 * 
 *         if self.row_desc:
 *             for rdesc in self.row_desc:             # <<<<<<<<<<<<<<
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 *                 if codec is None or not codec.has_decoder():
 */
    if (unlikely(__pyx_v_self->row_desc == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(7, 84, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_self->row_desc; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= 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_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(7, 84, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_rdesc, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":85
 *         if self.row_desc:
 *             for rdesc in self.row_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))             # <<<<<<<<<<<<<<
 *                 if codec is None or not codec.has_decoder():
 *                     missing.add(rdesc[3])
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_rdesc, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 85, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 85, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = ((PyObject *)__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec(__pyx_v_self->settings, ((uint32_t)__pyx_t_5), 0, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 85, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":86
 *             for rdesc in self.row_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 *                 if codec is None or not codec.has_decoder():             # <<<<<<<<<<<<<<
 *                     missing.add(rdesc[3])
 * 
 */
      __pyx_t_6 = (((PyObject *)__pyx_v_codec) == Py_None);
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (!__pyx_t_7) {
      } else {
        __pyx_t_2 = __pyx_t_7;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(__pyx_v_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(7, 86, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = ((!__pyx_t_7) != 0);
      __pyx_t_2 = __pyx_t_6;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_2) {

        /* "asyncpg/protocol/prepared_stmt.pyx":87
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 *                 if codec is None or not codec.has_decoder():
 *                     missing.add(rdesc[3])             # <<<<<<<<<<<<<<
 * 
 *         return missing
 */
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_rdesc, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = PySet_Add(__pyx_v_missing, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(7, 87, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/prepared_stmt.pyx":86
 *             for rdesc in self.row_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 *                 if codec is None or not codec.has_decoder():             # <<<<<<<<<<<<<<
 *                     missing.add(rdesc[3])
 * 
 */
      }

      /* "asyncpg/protocol/prepared_stmt.pyx":84
 * 
 *         if self.row_desc:
 *             for rdesc in self.row_desc:             # <<<<<<<<<<<<<<
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 *                 if codec is None or not codec.has_decoder():
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":83
 *                     missing.add(p_oid)
 * 
 *         if self.row_desc:             # <<<<<<<<<<<<<<
 *             for rdesc in self.row_desc:
 *                 codec = self.settings.get_data_codec(<uint32_t>(rdesc[3]))
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":89
 *                     missing.add(rdesc[3])
 * 
 *         return missing             # <<<<<<<<<<<<<<
 * 
 *     cpdef _init_codecs(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_missing);
  __pyx_r = __pyx_v_missing;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":72
 *         return tuple(result)
 * 
 *     def _init_types(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec codec
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._init_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_missing);
  __Pyx_XDECREF(__pyx_v_p_oid);
  __Pyx_XDECREF(__pyx_v_rdesc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":91
 *         return missing
 * 
 *     cpdef _init_codecs(self):             # <<<<<<<<<<<<<<
 *         self._ensure_args_encoder()
 *         self._ensure_rows_decoder()
 */

static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_9_init_codecs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__init_codecs(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  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_codecs", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":92
 * 
 *     cpdef _init_codecs(self):
 *         self._ensure_args_encoder()             # <<<<<<<<<<<<<<
 *         self._ensure_rows_decoder()
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_args_encoder(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":93
 *     cpdef _init_codecs(self):
 *         self._ensure_args_encoder()
 *         self._ensure_rows_decoder()             # <<<<<<<<<<<<<<
 * 
 *     def attach(self):
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":91
 *         return missing
 * 
 *     cpdef _init_codecs(self):             # <<<<<<<<<<<<<<
 *         self._ensure_args_encoder()
 *         self._ensure_rows_decoder()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._init_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_9_init_codecs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_9_init_codecs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init_codecs (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_8_init_codecs(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_8_init_codecs(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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("_init_codecs", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__init_codecs(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._init_codecs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":95
 *         self._ensure_rows_decoder()
 * 
 *     def attach(self):             # <<<<<<<<<<<<<<
 *         self.refs += 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_11attach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_11attach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("attach (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_10attach(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_10attach(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("attach", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":96
 * 
 *     def attach(self):
 *         self.refs += 1             # <<<<<<<<<<<<<<
 * 
 *     def detach(self):
 */
  __pyx_v_self->refs = (__pyx_v_self->refs + 1);

  /* "asyncpg/protocol/prepared_stmt.pyx":95
 *         self._ensure_rows_decoder()
 * 
 *     def attach(self):             # <<<<<<<<<<<<<<
 *         self.refs += 1
 * 
 */

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

/* "asyncpg/protocol/prepared_stmt.pyx":98
 *         self.refs += 1
 * 
 *     def detach(self):             # <<<<<<<<<<<<<<
 *         self.refs -= 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_13detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_13detach(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("detach (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12detach(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12detach(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("detach", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":99
 * 
 *     def detach(self):
 *         self.refs -= 1             # <<<<<<<<<<<<<<
 * 
 *     def mark_closed(self):
 */
  __pyx_v_self->refs = (__pyx_v_self->refs - 1);

  /* "asyncpg/protocol/prepared_stmt.pyx":98
 *         self.refs += 1
 * 
 *     def detach(self):             # <<<<<<<<<<<<<<
 *         self.refs -= 1
 * 
 */

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

/* "asyncpg/protocol/prepared_stmt.pyx":101
 *         self.refs -= 1
 * 
 *     def mark_closed(self):             # <<<<<<<<<<<<<<
 *         self.closed = True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_15mark_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_15mark_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mark_closed (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_14mark_closed(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_14mark_closed(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mark_closed", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":102
 * 
 *     def mark_closed(self):
 *         self.closed = True             # <<<<<<<<<<<<<<
 * 
 *     cdef _encode_bind_msg(self, args):
 */
  __pyx_v_self->closed = 1;

  /* "asyncpg/protocol/prepared_stmt.pyx":101
 *         self.refs -= 1
 * 
 *     def mark_closed(self):             # <<<<<<<<<<<<<<
 *         self.closed = True
 * 
 */

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

/* "asyncpg/protocol/prepared_stmt.pyx":104
 *         self.closed = True
 * 
 *     cdef _encode_bind_msg(self, args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int idx
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_idx;
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_writer = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  Py_ssize_t __pyx_v_num_args_passed;
  PyObject *__pyx_v_hint = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_value_repr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __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;
  int16_t __pyx_t_7;
  int16_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  Py_UCS4 __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  char const *__pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  char const *__pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encode_bind_msg", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":110
 *             Codec codec
 * 
 *         if len(args) > 32767:             # <<<<<<<<<<<<<<
 *             raise exceptions.InterfaceError(
 *                 'the number of query arguments cannot exceed 32767')
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 110, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 > 0x7FFF) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/prepared_stmt.pyx":111
 * 
 *         if len(args) > 32767:
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'the number of query arguments cannot exceed 32767')
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 111, __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 && unlikely(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_u_the_number_of_query_arguments_ca) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_the_number_of_query_arguments_ca);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(7, 111, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":110
 *             Codec codec
 * 
 *         if len(args) > 32767:             # <<<<<<<<<<<<<<
 *             raise exceptions.InterfaceError(
 *                 'the number of query arguments cannot exceed 32767')
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":114
 *                 'the number of query arguments cannot exceed 32767')
 * 
 *         writer = WriteBuffer.new()             # <<<<<<<<<<<<<<
 * 
 *         num_args_passed = len(args)
 */
  __pyx_t_3 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_writer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":116
 *         writer = WriteBuffer.new()
 * 
 *         num_args_passed = len(args)             # <<<<<<<<<<<<<<
 *         if self.args_num != num_args_passed:
 *             hint = 'Check the query against the passed list of arguments.'
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 116, __pyx_L1_error)
  __pyx_v_num_args_passed = __pyx_t_1;

  /* "asyncpg/protocol/prepared_stmt.pyx":117
 * 
 *         num_args_passed = len(args)
 *         if self.args_num != num_args_passed:             # <<<<<<<<<<<<<<
 *             hint = 'Check the query against the passed list of arguments.'
 * 
 */
  __pyx_t_2 = ((__pyx_v_self->args_num != __pyx_v_num_args_passed) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":118
 *         num_args_passed = len(args)
 *         if self.args_num != num_args_passed:
 *             hint = 'Check the query against the passed list of arguments.'             # <<<<<<<<<<<<<<
 * 
 *             if self.args_num == 0:
 */
    __Pyx_INCREF(__pyx_kp_u_Check_the_query_against_the_pass);
    __pyx_v_hint = __pyx_kp_u_Check_the_query_against_the_pass;

    /* "asyncpg/protocol/prepared_stmt.pyx":120
 *             hint = 'Check the query against the passed list of arguments.'
 * 
 *             if self.args_num == 0:             # <<<<<<<<<<<<<<
 *                 # If the server was expecting zero arguments, it is likely
 *                 # that the user tried to parametrize a statement that does
 */
    __pyx_t_2 = ((__pyx_v_self->args_num == 0) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/prepared_stmt.pyx":124
 *                 # that the user tried to parametrize a statement that does
 *                 # not support parameters.
 *                 hint += (r'  Note that parameters are supported only in'             # <<<<<<<<<<<<<<
 *                          r' SELECT, INSERT, UPDATE, DELETE, and VALUES'
 *                          r' statements, and will *not* work in statements '
 */
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_v_hint, __pyx_kp_u_Note_that_parameters_are_suppor); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_hint, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":120
 *             hint = 'Check the query against the passed list of arguments.'
 * 
 *             if self.args_num == 0:             # <<<<<<<<<<<<<<
 *                 # If the server was expecting zero arguments, it is likely
 *                 # that the user tried to parametrize a statement that does
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":129
 *                          r' like CREATE VIEW or DECLARE CURSOR.')
 * 
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":131
 *             raise exceptions.InterfaceError(
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(             # <<<<<<<<<<<<<<
 *                     x=self.args_num, s='s' if self.args_num != 1 else '',
 *                     y=num_args_passed,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_the_server_expects_x_argument_s, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/prepared_stmt.pyx":132
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(
 *                     x=self.args_num, s='s' if self.args_num != 1 else '',             # <<<<<<<<<<<<<<
 *                     y=num_args_passed,
 *                     w='was' if num_args_passed == 1 else 'were'),
 */
    __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyInt_From_int16_t(__pyx_v_self->args_num); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x, __pyx_t_6) < 0) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (((__pyx_v_self->args_num != 1) != 0)) {
      __Pyx_INCREF(__pyx_n_u_s_2);
      __pyx_t_6 = __pyx_n_u_s_2;
    } else {
      __Pyx_INCREF(__pyx_kp_u__37);
      __pyx_t_6 = __pyx_kp_u__37;
    }
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_s_2, __pyx_t_6) < 0) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":133
 *                 '{y} {w} passed'.format(
 *                     x=self.args_num, s='s' if self.args_num != 1 else '',
 *                     y=num_args_passed,             # <<<<<<<<<<<<<<
 *                     w='was' if num_args_passed == 1 else 'were'),
 *                 hint=hint)
 */
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_num_args_passed); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_y, __pyx_t_6) < 0) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":134
 *                     x=self.args_num, s='s' if self.args_num != 1 else '',
 *                     y=num_args_passed,
 *                     w='was' if num_args_passed == 1 else 'were'),             # <<<<<<<<<<<<<<
 *                 hint=hint)
 * 
 */
    if (((__pyx_v_num_args_passed == 1) != 0)) {
      __Pyx_INCREF(__pyx_n_u_was);
      __pyx_t_6 = __pyx_n_u_was;
    } else {
      __Pyx_INCREF(__pyx_n_u_were);
      __pyx_t_6 = __pyx_n_u_were;
    }
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_w, __pyx_t_6) < 0) __PYX_ERR(7, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":131
 *             raise exceptions.InterfaceError(
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(             # <<<<<<<<<<<<<<
 *                     x=self.args_num, s='s' if self.args_num != 1 else '',
 *                     y=num_args_passed,
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":129
 *                          r' like CREATE VIEW or DECLARE CURSOR.')
 * 
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":135
 *                     y=num_args_passed,
 *                     w='was' if num_args_passed == 1 else 'were'),
 *                 hint=hint)             # <<<<<<<<<<<<<<
 * 
 *         if self.have_text_args:
 */
    __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_hint, __pyx_v_hint) < 0) __PYX_ERR(7, 135, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":129
 *                          r' like CREATE VIEW or DECLARE CURSOR.')
 * 
 *             raise exceptions.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'the server expects {x} argument{s} for this query, '
 *                 '{y} {w} passed'.format(
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(7, 129, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":117
 * 
 *         num_args_passed = len(args)
 *         if self.args_num != num_args_passed:             # <<<<<<<<<<<<<<
 *             hint = 'Check the query against the passed list of arguments.'
 * 
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":137
 *                 hint=hint)
 * 
 *         if self.have_text_args:             # <<<<<<<<<<<<<<
 *             writer.write_int16(self.args_num)
 *             for idx in range(self.args_num):
 */
  __pyx_t_2 = (__pyx_v_self->have_text_args != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":138
 * 
 *         if self.have_text_args:
 *             writer.write_int16(self.args_num)             # <<<<<<<<<<<<<<
 *             for idx in range(self.args_num):
 *                 codec = <Codec>(self.args_codecs[idx])
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int16(__pyx_v_writer, __pyx_v_self->args_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":139
 *         if self.have_text_args:
 *             writer.write_int16(self.args_num)
 *             for idx in range(self.args_num):             # <<<<<<<<<<<<<<
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 writer.write_int16(codec.format)
 */
    __pyx_t_7 = __pyx_v_self->args_num;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_idx = __pyx_t_9;

      /* "asyncpg/protocol/prepared_stmt.pyx":140
 *             writer.write_int16(self.args_num)
 *             for idx in range(self.args_num):
 *                 codec = <Codec>(self.args_codecs[idx])             # <<<<<<<<<<<<<<
 *                 writer.write_int16(codec.format)
 *         else:
 */
      if (unlikely(__pyx_v_self->args_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(7, 140, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_self->args_codecs, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __pyx_t_3;
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":141
 *             for idx in range(self.args_num):
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 writer.write_int16(codec.format)             # <<<<<<<<<<<<<<
 *         else:
 *             # All arguments are in binary format
 */
      __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int16(__pyx_v_writer, __pyx_v_codec->format); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":137
 *                 hint=hint)
 * 
 *         if self.have_text_args:             # <<<<<<<<<<<<<<
 *             writer.write_int16(self.args_num)
 *             for idx in range(self.args_num):
 */
    goto __pyx_L6;
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":144
 *         else:
 *             # All arguments are in binary format
 *             writer.write_int32(0x00010001)             # <<<<<<<<<<<<<<
 * 
 *         writer.write_int16(self.args_num)
 */
  /*else*/ {
    __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int32(__pyx_v_writer, 0x00010001); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L6:;

  /* "asyncpg/protocol/prepared_stmt.pyx":146
 *             writer.write_int32(0x00010001)
 * 
 *         writer.write_int16(self.args_num)             # <<<<<<<<<<<<<<
 * 
 *         for idx in range(self.args_num):
 */
  __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int16(__pyx_v_writer, __pyx_v_self->args_num); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":148
 *         writer.write_int16(self.args_num)
 * 
 *         for idx in range(self.args_num):             # <<<<<<<<<<<<<<
 *             arg = args[idx]
 *             if arg is None:
 */
  __pyx_t_7 = __pyx_v_self->args_num;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_idx = __pyx_t_9;

    /* "asyncpg/protocol/prepared_stmt.pyx":149
 * 
 *         for idx in range(self.args_num):
 *             arg = args[idx]             # <<<<<<<<<<<<<<
 *             if arg is None:
 *                 writer.write_int32(-1)
 */
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":150
 *         for idx in range(self.args_num):
 *             arg = args[idx]
 *             if arg is None:             # <<<<<<<<<<<<<<
 *                 writer.write_int32(-1)
 *             else:
 */
    __pyx_t_2 = (__pyx_v_arg == Py_None);
    __pyx_t_10 = (__pyx_t_2 != 0);
    if (__pyx_t_10) {

      /* "asyncpg/protocol/prepared_stmt.pyx":151
 *             arg = args[idx]
 *             if arg is None:
 *                 writer.write_int32(-1)             # <<<<<<<<<<<<<<
 *             else:
 *                 codec = <Codec>(self.args_codecs[idx])
 */
      __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int32(__pyx_v_writer, -1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":150
 *         for idx in range(self.args_num):
 *             arg = args[idx]
 *             if arg is None:             # <<<<<<<<<<<<<<
 *                 writer.write_int32(-1)
 *             else:
 */
      goto __pyx_L11;
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":153
 *                 writer.write_int32(-1)
 *             else:
 *                 codec = <Codec>(self.args_codecs[idx])             # <<<<<<<<<<<<<<
 *                 try:
 *                     codec.encode(self.settings, writer, arg)
 */
    /*else*/ {
      if (unlikely(__pyx_v_self->args_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(7, 153, __pyx_L1_error)
      }
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_self->args_codecs, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":154
 *             else:
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 try:             # <<<<<<<<<<<<<<
 *                     codec.encode(self.settings, writer, arg)
 *                 except (AssertionError, exceptions.InternalClientError):
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        /*try:*/ {

          /* "asyncpg/protocol/prepared_stmt.pyx":155
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 try:
 *                     codec.encode(self.settings, writer, arg)             # <<<<<<<<<<<<<<
 *                 except (AssertionError, exceptions.InternalClientError):
 *                     # These are internal errors and should raise as-is.
 */
          __pyx_t_3 = ((PyObject *)__pyx_v_self->settings);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_6 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_3), __pyx_v_writer, __pyx_v_arg); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 155, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "asyncpg/protocol/prepared_stmt.pyx":154
 *             else:
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 try:             # <<<<<<<<<<<<<<
 *                     codec.encode(self.settings, writer, arg)
 *                 except (AssertionError, exceptions.InternalClientError):
 */
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L19_try_end;
        __pyx_L12_error:;
        __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_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/prepared_stmt.pyx":156
 *                 try:
 *                     codec.encode(self.settings, writer, arg)
 *                 except (AssertionError, exceptions.InternalClientError):             # <<<<<<<<<<<<<<
 *                     # These are internal errors and should raise as-is.
 *                     raise
 */
        __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_3, &__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 156, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 156, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_builtin_AssertionError) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_14);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_ErrRestore(__pyx_t_6, __pyx_t_3, __pyx_t_4);
        __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
        if (__pyx_t_15) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(7, 156, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_6);

          /* "asyncpg/protocol/prepared_stmt.pyx":158
 *                 except (AssertionError, exceptions.InternalClientError):
 *                     # These are internal errors and should raise as-is.
 *                     raise             # <<<<<<<<<<<<<<
 *                 except exceptions.InterfaceError as e:
 *                     # This is already a descriptive error, but annotate
 */
          __Pyx_GIVEREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_3, __pyx_t_6);
          __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0; 
          __PYX_ERR(7, 158, __pyx_L14_except_error)
        }

        /* "asyncpg/protocol/prepared_stmt.pyx":159
 *                     # These are internal errors and should raise as-is.
 *                     raise
 *                 except exceptions.InterfaceError as e:             # <<<<<<<<<<<<<<
 *                     # This is already a descriptive error, but annotate
 *                     # with argument name for clarity.
 */
        __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_3, &__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 159, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 159, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_ErrRestore(__pyx_t_6, __pyx_t_3, __pyx_t_4);
        __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0;
        if (__pyx_t_15) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(7, 159, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_v_e = __pyx_t_3;
          /*try:*/ {

            /* "asyncpg/protocol/prepared_stmt.pyx":162
 *                     # This is already a descriptive error, but annotate
 *                     # with argument name for clarity.
 *                     raise e.with_msg(             # <<<<<<<<<<<<<<
 *                         f'query argument ${idx + 1}: {e.args[0]}') from None
 *                 except Exception as e:
 */
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_with_msg); if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 162, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_14);

            /* "asyncpg/protocol/prepared_stmt.pyx":163
 *                     # with argument name for clarity.
 *                     raise e.with_msg(
 *                         f'query argument ${idx + 1}: {e.args[0]}') from None             # <<<<<<<<<<<<<<
 *                 except Exception as e:
 *                     # Everything else is assumed to be an encoding error
 */
            __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_1 = 0;
            __pyx_t_17 = 127;
            __Pyx_INCREF(__pyx_kp_u_query_argument);
            __pyx_t_1 += 16;
            __Pyx_GIVEREF(__pyx_kp_u_query_argument);
            PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_kp_u_query_argument);
            __pyx_t_18 = __Pyx_PyUnicode_From_long((__pyx_v_idx + 1), 0, ' ', 'd'); if (unlikely(!__pyx_t_18)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_18);
            __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18);
            __Pyx_GIVEREF(__pyx_t_18);
            PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
            __pyx_t_18 = 0;
            __Pyx_INCREF(__pyx_kp_u__43);
            __pyx_t_1 += 2;
            __Pyx_GIVEREF(__pyx_kp_u__43);
            PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_kp_u__43);
            __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_18)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_18);
            __pyx_t_19 = __Pyx_GetItemInt(__pyx_t_18, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_t_19, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __pyx_t_17 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_17) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_17;
            __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18);
            __Pyx_GIVEREF(__pyx_t_18);
            PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_18);
            __pyx_t_18 = 0;
            __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, __pyx_t_1, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(7, 163, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __pyx_t_16 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
              __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
              if (likely(__pyx_t_16)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                __Pyx_INCREF(__pyx_t_16);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_14, function);
              }
            }
            __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_16, __pyx_t_18) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_18);
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 162, __pyx_L27_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_Raise(__pyx_t_5, 0, 0, Py_None);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __PYX_ERR(7, 162, __pyx_L27_error)
          }

          /* "asyncpg/protocol/prepared_stmt.pyx":159
 *                     # These are internal errors and should raise as-is.
 *                     raise
 *                 except exceptions.InterfaceError as e:             # <<<<<<<<<<<<<<
 *                     # This is already a descriptive error, but annotate
 *                     # with argument name for clarity.
 */
          /*finally:*/ {
            __pyx_L27_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
              __Pyx_XGOTREF(__pyx_t_22);
              __Pyx_XGOTREF(__pyx_t_23);
              __Pyx_XGOTREF(__pyx_t_24);
              __Pyx_XGOTREF(__pyx_t_25);
              __Pyx_XGOTREF(__pyx_t_26);
              __Pyx_XGOTREF(__pyx_t_27);
              __pyx_t_15 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_e);
                __pyx_v_e = NULL;
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_25);
                __Pyx_XGIVEREF(__pyx_t_26);
                __Pyx_XGIVEREF(__pyx_t_27);
                __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27);
              }
              __Pyx_XGIVEREF(__pyx_t_22);
              __Pyx_XGIVEREF(__pyx_t_23);
              __Pyx_XGIVEREF(__pyx_t_24);
              __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24);
              __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0;
              __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
              goto __pyx_L14_except_error;
            }
          }
        }

        /* "asyncpg/protocol/prepared_stmt.pyx":164
 *                     raise e.with_msg(
 *                         f'query argument ${idx + 1}: {e.args[0]}') from None
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     # Everything else is assumed to be an encoding error
 *                     # due to invalid input.
 */
        __pyx_t_20 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_20) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(7, 164, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_v_e = __pyx_t_3;
          /*try:*/ {

            /* "asyncpg/protocol/prepared_stmt.pyx":167
 *                     # Everything else is assumed to be an encoding error
 *                     # due to invalid input.
 *                     value_repr = repr(arg)             # <<<<<<<<<<<<<<
 *                     if len(value_repr) > 40:
 *                         value_repr = value_repr[:40] + '...'
 */
            __pyx_t_5 = PyObject_Repr(__pyx_v_arg); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 167, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_v_value_repr = __pyx_t_5;
            __pyx_t_5 = 0;

            /* "asyncpg/protocol/prepared_stmt.pyx":168
 *                     # due to invalid input.
 *                     value_repr = repr(arg)
 *                     if len(value_repr) > 40:             # <<<<<<<<<<<<<<
 *                         value_repr = value_repr[:40] + '...'
 * 
 */
            __pyx_t_1 = PyObject_Length(__pyx_v_value_repr); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(7, 168, __pyx_L38_error)
            __pyx_t_10 = ((__pyx_t_1 > 40) != 0);
            if (__pyx_t_10) {

              /* "asyncpg/protocol/prepared_stmt.pyx":169
 *                     value_repr = repr(arg)
 *                     if len(value_repr) > 40:
 *                         value_repr = value_repr[:40] + '...'             # <<<<<<<<<<<<<<
 * 
 *                     raise exceptions.DataError(
 */
              __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_value_repr, 0, 40, NULL, NULL, &__pyx_slice__44, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 169, __pyx_L38_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_14 = PyNumber_Add(__pyx_t_5, __pyx_kp_u__45); if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 169, __pyx_L38_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF_SET(__pyx_v_value_repr, __pyx_t_14);
              __pyx_t_14 = 0;

              /* "asyncpg/protocol/prepared_stmt.pyx":168
 *                     # due to invalid input.
 *                     value_repr = repr(arg)
 *                     if len(value_repr) > 40:             # <<<<<<<<<<<<<<
 *                         value_repr = value_repr[:40] + '...'
 * 
 */
            }

            /* "asyncpg/protocol/prepared_stmt.pyx":171
 *                         value_repr = value_repr[:40] + '...'
 * 
 *                     raise exceptions.DataError(             # <<<<<<<<<<<<<<
 *                         'invalid input for query argument'
 *                         ' ${n}: {v} ({msg})'.format(
 */
            __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 171, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DataError); if (unlikely(!__pyx_t_18)) __PYX_ERR(7, 171, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "asyncpg/protocol/prepared_stmt.pyx":173
 *                     raise exceptions.DataError(
 *                         'invalid input for query argument'
 *                         ' ${n}: {v} ({msg})'.format(             # <<<<<<<<<<<<<<
 *                             n=idx + 1, v=value_repr, msg=e)) from e
 * 
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_input_for_query_argument, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 173, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_5);

            /* "asyncpg/protocol/prepared_stmt.pyx":174
 *                         'invalid input for query argument'
 *                         ' ${n}: {v} ({msg})'.format(
 *                             n=idx + 1, v=value_repr, msg=e)) from e             # <<<<<<<<<<<<<<
 * 
 *         if self.have_text_cols:
 */
            __pyx_t_16 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(7, 174, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_19 = __Pyx_PyInt_From_long((__pyx_v_idx + 1)); if (unlikely(!__pyx_t_19)) __PYX_ERR(7, 174, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_19);
            if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_n_3, __pyx_t_19) < 0) __PYX_ERR(7, 174, __pyx_L38_error)
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_v_2, __pyx_v_value_repr) < 0) __PYX_ERR(7, 174, __pyx_L38_error)
            if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_msg, __pyx_v_e) < 0) __PYX_ERR(7, 174, __pyx_L38_error)

            /* "asyncpg/protocol/prepared_stmt.pyx":173
 *                     raise exceptions.DataError(
 *                         'invalid input for query argument'
 *                         ' ${n}: {v} ({msg})'.format(             # <<<<<<<<<<<<<<
 *                             n=idx + 1, v=value_repr, msg=e)) from e
 * 
 */
            __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(7, 173, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __pyx_t_16 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
              __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_18);
              if (likely(__pyx_t_16)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
                __Pyx_INCREF(__pyx_t_16);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_18, function);
              }
            }
            __pyx_t_14 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_16, __pyx_t_19) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_19);
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            if (unlikely(!__pyx_t_14)) __PYX_ERR(7, 171, __pyx_L38_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

            /* "asyncpg/protocol/prepared_stmt.pyx":174
 *                         'invalid input for query argument'
 *                         ' ${n}: {v} ({msg})'.format(
 *                             n=idx + 1, v=value_repr, msg=e)) from e             # <<<<<<<<<<<<<<
 * 
 *         if self.have_text_cols:
 */
            __Pyx_Raise(__pyx_t_14, 0, 0, __pyx_v_e);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __PYX_ERR(7, 171, __pyx_L38_error)
          }

          /* "asyncpg/protocol/prepared_stmt.pyx":164
 *                     raise e.with_msg(
 *                         f'query argument ${idx + 1}: {e.args[0]}') from None
 *                 except Exception as e:             # <<<<<<<<<<<<<<
 *                     # Everything else is assumed to be an encoding error
 *                     # due to invalid input.
 */
          /*finally:*/ {
            __pyx_L38_error:;
            /*exception exit:*/{
              __Pyx_PyThreadState_declare
              __Pyx_PyThreadState_assign
              __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
              if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25);
              __Pyx_XGOTREF(__pyx_t_27);
              __Pyx_XGOTREF(__pyx_t_26);
              __Pyx_XGOTREF(__pyx_t_25);
              __Pyx_XGOTREF(__pyx_t_24);
              __Pyx_XGOTREF(__pyx_t_23);
              __Pyx_XGOTREF(__pyx_t_22);
              __pyx_t_20 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_28 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_e);
                __pyx_v_e = NULL;
              }
              if (PY_MAJOR_VERSION >= 3) {
                __Pyx_XGIVEREF(__pyx_t_24);
                __Pyx_XGIVEREF(__pyx_t_23);
                __Pyx_XGIVEREF(__pyx_t_22);
                __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
              }
              __Pyx_XGIVEREF(__pyx_t_27);
              __Pyx_XGIVEREF(__pyx_t_26);
              __Pyx_XGIVEREF(__pyx_t_25);
              __Pyx_ErrRestore(__pyx_t_27, __pyx_t_26, __pyx_t_25);
              __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0;
              __pyx_lineno = __pyx_t_20; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_28;
              goto __pyx_L14_except_error;
            }
          }
        }
        goto __pyx_L14_except_error;
        __pyx_L14_except_error:;

        /* "asyncpg/protocol/prepared_stmt.pyx":154
 *             else:
 *                 codec = <Codec>(self.args_codecs[idx])
 *                 try:             # <<<<<<<<<<<<<<
 *                     codec.encode(self.settings, writer, arg)
 *                 except (AssertionError, exceptions.InternalClientError):
 */
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        goto __pyx_L1_error;
        __pyx_L19_try_end:;
      }
    }
    __pyx_L11:;
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":176
 *                             n=idx + 1, v=value_repr, msg=e)) from e
 * 
 *         if self.have_text_cols:             # <<<<<<<<<<<<<<
 *             writer.write_int16(self.cols_num)
 *             for idx in range(self.cols_num):
 */
  __pyx_t_10 = (__pyx_v_self->have_text_cols != 0);
  if (__pyx_t_10) {

    /* "asyncpg/protocol/prepared_stmt.pyx":177
 * 
 *         if self.have_text_cols:
 *             writer.write_int16(self.cols_num)             # <<<<<<<<<<<<<<
 *             for idx in range(self.cols_num):
 *                 codec = <Codec>(self.rows_codecs[idx])
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int16(__pyx_v_writer, __pyx_v_self->cols_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":178
 *         if self.have_text_cols:
 *             writer.write_int16(self.cols_num)
 *             for idx in range(self.cols_num):             # <<<<<<<<<<<<<<
 *                 codec = <Codec>(self.rows_codecs[idx])
 *                 writer.write_int16(codec.format)
 */
    __pyx_t_7 = __pyx_v_self->cols_num;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_idx = __pyx_t_9;

      /* "asyncpg/protocol/prepared_stmt.pyx":179
 *             writer.write_int16(self.cols_num)
 *             for idx in range(self.cols_num):
 *                 codec = <Codec>(self.rows_codecs[idx])             # <<<<<<<<<<<<<<
 *                 writer.write_int16(codec.format)
 *         else:
 */
      if (unlikely(__pyx_v_self->rows_codecs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(7, 179, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->rows_codecs, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":180
 *             for idx in range(self.cols_num):
 *                 codec = <Codec>(self.rows_codecs[idx])
 *                 writer.write_int16(codec.format)             # <<<<<<<<<<<<<<
 *         else:
 *             # All columns are in binary format
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int16(__pyx_v_writer, __pyx_v_codec->format); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":176
 *                             n=idx + 1, v=value_repr, msg=e)) from e
 * 
 *         if self.have_text_cols:             # <<<<<<<<<<<<<<
 *             writer.write_int16(self.cols_num)
 *             for idx in range(self.cols_num):
 */
    goto __pyx_L45;
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":183
 *         else:
 *             # All columns are in binary format
 *             writer.write_int32(0x00010001)             # <<<<<<<<<<<<<<
 * 
 *         return writer
 */
  /*else*/ {
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_writer->__pyx_vtab)->write_int32(__pyx_v_writer, 0x00010001); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L45:;

  /* "asyncpg/protocol/prepared_stmt.pyx":185
 *             writer.write_int32(0x00010001)
 * 
 *         return writer             # <<<<<<<<<<<<<<
 * 
 *     cdef _ensure_rows_decoder(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_writer));
  __pyx_r = ((PyObject *)__pyx_v_writer);
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":104
 *         self.closed = True
 * 
 *     cdef _encode_bind_msg(self, args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int idx
 */

  /* 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_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_writer);
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_hint);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_value_repr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":187
 *         return writer
 * 
 *     cdef _ensure_rows_decoder(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list cols_names
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_v_cols_names = 0;
  PyObject *__pyx_v_cols_mapping = 0;
  PyObject *__pyx_v_row = 0;
  uint32_t __pyx_v_oid;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_codecs = 0;
  long __pyx_v_i;
  PyObject *__pyx_v_col_name = 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;
  int16_t __pyx_t_6;
  int __pyx_t_7;
  uint32_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  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("_ensure_rows_decoder", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":196
 *             list codecs
 * 
 *         if self.cols_desc is not None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (__pyx_v_self->cols_desc != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":197
 * 
 *         if self.cols_desc is not None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if self.cols_num == 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/prepared_stmt.pyx":196
 *             list codecs
 * 
 *         if self.cols_desc is not None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":199
 *             return
 * 
 *         if self.cols_num == 0:             # <<<<<<<<<<<<<<
 *             self.cols_desc = record.ApgRecordDesc_New({}, ())
 *             return
 */
  __pyx_t_2 = ((__pyx_v_self->cols_num == 0) != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":200
 * 
 *         if self.cols_num == 0:
 *             self.cols_desc = record.ApgRecordDesc_New({}, ())             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ApgRecordDesc_New(__pyx_t_3, __pyx_empty_tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->cols_desc);
    __Pyx_DECREF(__pyx_v_self->cols_desc);
    __pyx_v_self->cols_desc = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":201
 *         if self.cols_num == 0:
 *             self.cols_desc = record.ApgRecordDesc_New({}, ())
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cols_mapping = collections.OrderedDict()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/prepared_stmt.pyx":199
 *             return
 * 
 *         if self.cols_num == 0:             # <<<<<<<<<<<<<<
 *             self.cols_desc = record.ApgRecordDesc_New({}, ())
 *             return
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":203
 *             return
 * 
 *         cols_mapping = collections.OrderedDict()             # <<<<<<<<<<<<<<
 *         cols_names = []
 *         codecs = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_cols_mapping = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":204
 * 
 *         cols_mapping = collections.OrderedDict()
 *         cols_names = []             # <<<<<<<<<<<<<<
 *         codecs = []
 *         for i from 0 <= i < self.cols_num:
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_cols_names = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":205
 *         cols_mapping = collections.OrderedDict()
 *         cols_names = []
 *         codecs = []             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < self.cols_num:
 *             row = self.row_desc[i]
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_codecs = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":206
 *         cols_names = []
 *         codecs = []
 *         for i from 0 <= i < self.cols_num:             # <<<<<<<<<<<<<<
 *             row = self.row_desc[i]
 *             col_name = row[0].decode(self.settings._encoding)
 */
  __pyx_t_6 = __pyx_v_self->cols_num;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "asyncpg/protocol/prepared_stmt.pyx":207
 *         codecs = []
 *         for i from 0 <= i < self.cols_num:
 *             row = self.row_desc[i]             # <<<<<<<<<<<<<<
 *             col_name = row[0].decode(self.settings._encoding)
 *             cols_mapping[col_name] = i
 */
    if (unlikely(__pyx_v_self->row_desc == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(7, 207, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->row_desc, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(7, 207, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_row, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":208
 *         for i from 0 <= i < self.cols_num:
 *             row = self.row_desc[i]
 *             col_name = row[0].decode(self.settings._encoding)             # <<<<<<<<<<<<<<
 *             cols_mapping[col_name] = i
 *             cols_names.append(col_name)
 */
    if (unlikely(__pyx_v_row == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(7, 208, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_row, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_self->settings->_encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->settings->_encoding);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_col_name, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":209
 *             row = self.row_desc[i]
 *             col_name = row[0].decode(self.settings._encoding)
 *             cols_mapping[col_name] = i             # <<<<<<<<<<<<<<
 *             cols_names.append(col_name)
 *             oid = row[3]
 */
    __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_v_cols_mapping, __pyx_v_col_name, __pyx_t_4) < 0)) __PYX_ERR(7, 209, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":210
 *             col_name = row[0].decode(self.settings._encoding)
 *             cols_mapping[col_name] = i
 *             cols_names.append(col_name)             # <<<<<<<<<<<<<<
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(
 */
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_cols_names, __pyx_v_col_name); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 210, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":211
 *             cols_mapping[col_name] = i
 *             cols_names.append(col_name)
 *             oid = row[3]             # <<<<<<<<<<<<<<
 *             codec = self.settings.get_data_codec(
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 */
    if (unlikely(__pyx_v_row == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(7, 211, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_row, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_8 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_oid = __pyx_t_8;

    /* "asyncpg/protocol/prepared_stmt.pyx":212
 *             cols_names.append(col_name)
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->settings), __pyx_n_s_get_data_codec); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/prepared_stmt.pyx":213
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)             # <<<<<<<<<<<<<<
 *             if codec is None or not codec.has_decoder():
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/prepared_stmt.pyx":212
 *             cols_names.append(col_name)
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":213
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)             # <<<<<<<<<<<<<<
 *             if codec is None or not codec.has_decoder():
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->ignore_custom_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_ignore_custom_codec, __pyx_t_9) < 0) __PYX_ERR(7, 213, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":212
 *             cols_names.append(col_name)
 *             oid = row[3]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(7, 212, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":214
 *             codec = self.settings.get_data_codec(
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for OID {}'.format(oid))
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_10 = (__pyx_t_1 != 0);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_2 = __pyx_t_10;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_9 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder(__pyx_v_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 214, __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(7, 214, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_1 = ((!__pyx_t_10) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L8_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/prepared_stmt.pyx":215
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'no decoder for OID {}'.format(oid))
 *             if not codec.is_binary():
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":216
 *             if codec is None or not codec.has_decoder():
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for OID {}'.format(oid))             # <<<<<<<<<<<<<<
 *             if not codec.is_binary():
 *                 self.have_text_cols = True
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_no_decoder_for_OID, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyInt_From_uint32_t(__pyx_v_oid); if (unlikely(!__pyx_t_11)) __PYX_ERR(7, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(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_9 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __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_9)) __PYX_ERR(7, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(7, 215, __pyx_L1_error)

      /* "asyncpg/protocol/prepared_stmt.pyx":214
 *             codec = self.settings.get_data_codec(
 *                 oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_decoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for OID {}'.format(oid))
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":217
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for OID {}'.format(oid))
 *             if not codec.is_binary():             # <<<<<<<<<<<<<<
 *                 self.have_text_cols = True
 * 
 */
    __pyx_t_9 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_is_binary(__pyx_v_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_1 = ((!__pyx_t_2) != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/prepared_stmt.pyx":218
 *                     'no decoder for OID {}'.format(oid))
 *             if not codec.is_binary():
 *                 self.have_text_cols = True             # <<<<<<<<<<<<<<
 * 
 *             codecs.append(codec)
 */
      __pyx_v_self->have_text_cols = 1;

      /* "asyncpg/protocol/prepared_stmt.pyx":217
 *                 raise exceptions.InternalClientError(
 *                     'no decoder for OID {}'.format(oid))
 *             if not codec.is_binary():             # <<<<<<<<<<<<<<
 *                 self.have_text_cols = True
 * 
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":220
 *                 self.have_text_cols = True
 * 
 *             codecs.append(codec)             # <<<<<<<<<<<<<<
 * 
 *         self.cols_desc = record.ApgRecordDesc_New(
 */
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_codecs, ((PyObject *)__pyx_v_codec)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(7, 220, __pyx_L1_error)
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":223
 * 
 *         self.cols_desc = record.ApgRecordDesc_New(
 *             cols_mapping, tuple(cols_names))             # <<<<<<<<<<<<<<
 * 
 *         self.rows_codecs = tuple(codecs)
 */
  __pyx_t_9 = PyList_AsTuple(__pyx_v_cols_names); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);

  /* "asyncpg/protocol/prepared_stmt.pyx":222
 *             codecs.append(codec)
 * 
 *         self.cols_desc = record.ApgRecordDesc_New(             # <<<<<<<<<<<<<<
 *             cols_mapping, tuple(cols_names))
 * 
 */
  __pyx_t_5 = ApgRecordDesc_New(__pyx_v_cols_mapping, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->cols_desc);
  __Pyx_DECREF(__pyx_v_self->cols_desc);
  __pyx_v_self->cols_desc = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":225
 *             cols_mapping, tuple(cols_names))
 * 
 *         self.rows_codecs = tuple(codecs)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ensure_args_encoder(self):
 */
  __pyx_t_5 = PyList_AsTuple(__pyx_v_codecs); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->rows_codecs);
  __Pyx_DECREF(__pyx_v_self->rows_codecs);
  __pyx_v_self->rows_codecs = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":187
 *         return writer
 * 
 *     cdef _ensure_rows_decoder(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list cols_names
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._ensure_rows_decoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cols_names);
  __Pyx_XDECREF(__pyx_v_cols_mapping);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_codecs);
  __Pyx_XDECREF(__pyx_v_col_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":227
 *         self.rows_codecs = tuple(codecs)
 * 
 *     cdef _ensure_args_encoder(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t p_oid
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_args_encoder(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  uint32_t __pyx_v_p_oid;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  PyObject *__pyx_v_codecs = 0;
  long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int16_t __pyx_t_5;
  uint32_t __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;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ensure_args_encoder", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":231
 *             uint32_t p_oid
 *             Codec codec
 *             list codecs = []             # <<<<<<<<<<<<<<
 * 
 *         if self.args_num == 0 or self.args_codecs is not None:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":233
 *             list codecs = []
 * 
 *         if self.args_num == 0 or self.args_codecs is not None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_3 = ((__pyx_v_self->args_num == 0) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->args_codecs != ((PyObject*)Py_None));
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "asyncpg/protocol/prepared_stmt.pyx":234
 * 
 *         if self.args_num == 0 or self.args_codecs is not None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         for i from 0 <= i < self.args_num:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/prepared_stmt.pyx":233
 *             list codecs = []
 * 
 *         if self.args_num == 0 or self.args_codecs is not None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":236
 *             return
 * 
 *         for i from 0 <= i < self.args_num:             # <<<<<<<<<<<<<<
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(
 */
  __pyx_t_5 = __pyx_v_self->args_num;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

    /* "asyncpg/protocol/prepared_stmt.pyx":237
 * 
 *         for i from 0 <= i < self.args_num:
 *             p_oid = self.parameters_desc[i]             # <<<<<<<<<<<<<<
 *             codec = self.settings.get_data_codec(
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 */
    if (unlikely(__pyx_v_self->parameters_desc == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(7, 237, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->parameters_desc, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(7, 237, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_p_oid = __pyx_t_6;

    /* "asyncpg/protocol/prepared_stmt.pyx":238
 *         for i from 0 <= i < self.args_num:
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->settings), __pyx_n_s_get_data_codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "asyncpg/protocol/prepared_stmt.pyx":239
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)             # <<<<<<<<<<<<<<
 *             if codec is None or not codec.has_encoder():
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_p_oid); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "asyncpg/protocol/prepared_stmt.pyx":238
 *         for i from 0 <= i < self.args_num:
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":239
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)             # <<<<<<<<<<<<<<
 *             if codec is None or not codec.has_encoder():
 *                 raise exceptions.InternalClientError(
 */
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->ignore_custom_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_ignore_custom_codec, __pyx_t_9) < 0) __PYX_ERR(7, 239, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":238
 *         for i from 0 <= i < self.args_num:
 *             p_oid = self.parameters_desc[i]
 *             codec = self.settings.get_data_codec(             # <<<<<<<<<<<<<<
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(7, 238, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":240
 *             codec = self.settings.get_data_codec(
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no encoder for OID {}'.format(p_oid))
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_codec) == Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_9 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(__pyx_v_codec); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(7, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = ((!__pyx_t_3) != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/prepared_stmt.pyx":241
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():
 *                 raise exceptions.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'no encoder for OID {}'.format(p_oid))
 *             if codec.type not in {}:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 241, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 241, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":242
 *             if codec is None or not codec.has_encoder():
 *                 raise exceptions.InternalClientError(
 *                     'no encoder for OID {}'.format(p_oid))             # <<<<<<<<<<<<<<
 *             if codec.type not in {}:
 *                 self.have_text_args = True
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_no_encoder_for_OID, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyInt_From_uint32_t(__pyx_v_p_oid); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_7 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 242, __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 && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 241, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(7, 241, __pyx_L1_error)

      /* "asyncpg/protocol/prepared_stmt.pyx":240
 *             codec = self.settings.get_data_codec(
 *                 p_oid, ignore_custom_codec=self.ignore_custom_codec)
 *             if codec is None or not codec.has_encoder():             # <<<<<<<<<<<<<<
 *                 raise exceptions.InternalClientError(
 *                     'no encoder for OID {}'.format(p_oid))
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":243
 *                 raise exceptions.InternalClientError(
 *                     'no encoder for OID {}'.format(p_oid))
 *             if codec.type not in {}:             # <<<<<<<<<<<<<<
 *                 self.have_text_args = True
 * 
 */
    __pyx_t_9 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_CodecType(__pyx_v_codec->type); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_t_9, __pyx_t_8, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(7, 243, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "asyncpg/protocol/prepared_stmt.pyx":244
 *                     'no encoder for OID {}'.format(p_oid))
 *             if codec.type not in {}:
 *                 self.have_text_args = True             # <<<<<<<<<<<<<<
 * 
 *             codecs.append(codec)
 */
      __pyx_v_self->have_text_args = 1;

      /* "asyncpg/protocol/prepared_stmt.pyx":243
 *                 raise exceptions.InternalClientError(
 *                     'no encoder for OID {}'.format(p_oid))
 *             if codec.type not in {}:             # <<<<<<<<<<<<<<
 *                 self.have_text_args = True
 * 
 */
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":246
 *                 self.have_text_args = True
 * 
 *             codecs.append(codec)             # <<<<<<<<<<<<<<
 * 
 *         self.args_codecs = tuple(codecs)
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_codecs, ((PyObject *)__pyx_v_codec)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(7, 246, __pyx_L1_error)
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":248
 *             codecs.append(codec)
 * 
 *         self.args_codecs = tuple(codecs)             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_row_desc(self, object desc):
 */
  __pyx_t_8 = PyList_AsTuple(__pyx_v_codecs); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(__pyx_v_self->args_codecs);
  __Pyx_DECREF(__pyx_v_self->args_codecs);
  __pyx_v_self->args_codecs = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":227
 *         self.rows_codecs = tuple(codecs)
 * 
 *     cdef _ensure_args_encoder(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t p_oid
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._ensure_args_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_codecs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":250
 *         self.args_codecs = tuple(codecs)
 * 
 *     cdef _set_row_desc(self, object desc):             # <<<<<<<<<<<<<<
 *         self.row_desc = _decode_row_desc(desc)
 *         self.cols_num = <int16_t>(len(self.row_desc))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_row_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_desc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_row_desc", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":251
 * 
 *     cdef _set_row_desc(self, object desc):
 *         self.row_desc = _decode_row_desc(desc)             # <<<<<<<<<<<<<<
 *         self.cols_num = <int16_t>(len(self.row_desc))
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol__decode_row_desc(__pyx_v_desc); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(7, 251, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->row_desc);
  __Pyx_DECREF(__pyx_v_self->row_desc);
  __pyx_v_self->row_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":252
 *     cdef _set_row_desc(self, object desc):
 *         self.row_desc = _decode_row_desc(desc)
 *         self.cols_num = <int16_t>(len(self.row_desc))             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_args_desc(self, object desc):
 */
  __pyx_t_1 = __pyx_v_self->row_desc;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(7, 252, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(7, 252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->cols_num = ((int16_t)__pyx_t_2);

  /* "asyncpg/protocol/prepared_stmt.pyx":250
 *         self.args_codecs = tuple(codecs)
 * 
 *     cdef _set_row_desc(self, object desc):             # <<<<<<<<<<<<<<
 *         self.row_desc = _decode_row_desc(desc)
 *         self.cols_num = <int16_t>(len(self.row_desc))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._set_row_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":254
 *         self.cols_num = <int16_t>(len(self.row_desc))
 * 
 *     cdef _set_args_desc(self, object desc):             # <<<<<<<<<<<<<<
 *         self.parameters_desc = _decode_parameters_desc(desc)
 *         self.args_num = <int16_t>(len(self.parameters_desc))
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_args_desc(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, PyObject *__pyx_v_desc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_args_desc", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":255
 * 
 *     cdef _set_args_desc(self, object desc):
 *         self.parameters_desc = _decode_parameters_desc(desc)             # <<<<<<<<<<<<<<
 *         self.args_num = <int16_t>(len(self.parameters_desc))
 * 
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol__decode_parameters_desc(__pyx_v_desc); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(7, 255, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->parameters_desc);
  __Pyx_DECREF(__pyx_v_self->parameters_desc);
  __pyx_v_self->parameters_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":256
 *     cdef _set_args_desc(self, object desc):
 *         self.parameters_desc = _decode_parameters_desc(desc)
 *         self.args_num = <int16_t>(len(self.parameters_desc))             # <<<<<<<<<<<<<<
 * 
 *     cdef _decode_row(self, const char* cbuf, ssize_t buf_len):
 */
  __pyx_t_1 = __pyx_v_self->parameters_desc;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(7, 256, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(7, 256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->args_num = ((int16_t)__pyx_t_2);

  /* "asyncpg/protocol/prepared_stmt.pyx":254
 *         self.cols_num = <int16_t>(len(self.row_desc))
 * 
 *     cdef _set_args_desc(self, object desc):             # <<<<<<<<<<<<<<
 *         self.parameters_desc = _decode_parameters_desc(desc)
 *         self.args_num = <int16_t>(len(self.parameters_desc))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._set_args_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":258
 *         self.args_num = <int16_t>(len(self.parameters_desc))
 * 
 *     cdef _decode_row(self, const char* cbuf, ssize_t buf_len):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec codec
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__decode_row(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self, char const *__pyx_v_cbuf, Py_ssize_t __pyx_v_buf_len) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *__pyx_v_codec = 0;
  int16_t __pyx_v_fnum;
  int32_t __pyx_v_flen;
  PyObject *__pyx_v_dec_row = 0;
  PyObject *__pyx_v_rows_codecs = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *__pyx_v_settings = 0;
  int32_t __pyx_v_i;
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer __pyx_v_rbuf;
  Py_ssize_t __pyx_v_bl;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__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;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int16_t __pyx_t_12;
  int16_t __pyx_t_13;
  int32_t __pyx_t_14;
  PyObject *__pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decode_row", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":264
 *             int32_t flen
 *             object dec_row
 *             tuple rows_codecs = self.rows_codecs             # <<<<<<<<<<<<<<
 *             ConnectionSettings settings = self.settings
 *             int32_t i
 */
  __pyx_t_1 = __pyx_v_self->rows_codecs;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_rows_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":265
 *             object dec_row
 *             tuple rows_codecs = self.rows_codecs
 *             ConnectionSettings settings = self.settings             # <<<<<<<<<<<<<<
 *             int32_t i
 *             FRBuffer rbuf
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->settings);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":270
 *             ssize_t bl
 * 
 *         frb_init(&rbuf, cbuf, buf_len)             # <<<<<<<<<<<<<<
 * 
 *         fnum = hton.unpack_int16(frb_read(&rbuf, 2))
 */
  __pyx_f_7asyncpg_7pgproto_7pgproto_frb_init((&__pyx_v_rbuf), __pyx_v_cbuf, __pyx_v_buf_len);

  /* "asyncpg/protocol/prepared_stmt.pyx":272
 *         frb_init(&rbuf, cbuf, buf_len)
 * 
 *         fnum = hton.unpack_int16(frb_read(&rbuf, 2))             # <<<<<<<<<<<<<<
 * 
 *         if fnum != self.cols_num:
 */
  __pyx_t_2 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read((&__pyx_v_rbuf), 2); if (unlikely(__pyx_t_2 == ((char const *)NULL))) __PYX_ERR(7, 272, __pyx_L1_error)
  __pyx_v_fnum = unpack_int16(__pyx_t_2);

  /* "asyncpg/protocol/prepared_stmt.pyx":274
 *         fnum = hton.unpack_int16(frb_read(&rbuf, 2))
 * 
 *         if fnum != self.cols_num:             # <<<<<<<<<<<<<<
 *             raise exceptions.ProtocolError(
 *                 'the number of columns in the result row ({}) is '
 */
  __pyx_t_3 = ((__pyx_v_fnum != __pyx_v_self->cols_num) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/prepared_stmt.pyx":275
 * 
 *         if fnum != self.cols_num:
 *             raise exceptions.ProtocolError(             # <<<<<<<<<<<<<<
 *                 'the number of columns in the result row ({}) is '
 *                 'different from what was described ({})'.format(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ProtocolError); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":277
 *             raise exceptions.ProtocolError(
 *                 'the number of columns in the result row ({}) is '
 *                 'different from what was described ({})'.format(             # <<<<<<<<<<<<<<
 *                     fnum, self.cols_num))
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_the_number_of_columns_in_the_res, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/prepared_stmt.pyx":278
 *                 'the number of columns in the result row ({}) is '
 *                 'different from what was described ({})'.format(
 *                     fnum, self.cols_num))             # <<<<<<<<<<<<<<
 * 
 *         dec_row = record.ApgRecord_New(self.record_class, self.cols_desc, fnum)
 */
    __pyx_t_7 = __Pyx_PyInt_From_int16_t(__pyx_v_fnum); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_From_int16_t(__pyx_v_self->cols_num); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 277, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 277, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(7, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(7, 275, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":274
 *         fnum = hton.unpack_int16(frb_read(&rbuf, 2))
 * 
 *         if fnum != self.cols_num:             # <<<<<<<<<<<<<<
 *             raise exceptions.ProtocolError(
 *                 'the number of columns in the result row ({}) is '
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":280
 *                     fnum, self.cols_num))
 * 
 *         dec_row = record.ApgRecord_New(self.record_class, self.cols_desc, fnum)             # <<<<<<<<<<<<<<
 *         for i in range(fnum):
 *             flen = hton.unpack_int32(frb_read(&rbuf, 4))
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->record_class);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __pyx_v_self->cols_desc;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_4 = ApgRecord_New(((PyTypeObject*)__pyx_t_1), __pyx_t_5, __pyx_v_fnum); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_dec_row = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":281
 * 
 *         dec_row = record.ApgRecord_New(self.record_class, self.cols_desc, fnum)
 *         for i in range(fnum):             # <<<<<<<<<<<<<<
 *             flen = hton.unpack_int32(frb_read(&rbuf, 4))
 * 
 */
  __pyx_t_12 = __pyx_v_fnum;
  __pyx_t_13 = __pyx_t_12;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "asyncpg/protocol/prepared_stmt.pyx":282
 *         dec_row = record.ApgRecord_New(self.record_class, self.cols_desc, fnum)
 *         for i in range(fnum):
 *             flen = hton.unpack_int32(frb_read(&rbuf, 4))             # <<<<<<<<<<<<<<
 * 
 *             if flen == -1:
 */
    __pyx_t_2 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read((&__pyx_v_rbuf), 4); if (unlikely(__pyx_t_2 == ((char const *)NULL))) __PYX_ERR(7, 282, __pyx_L1_error)
    __pyx_v_flen = unpack_int32(__pyx_t_2);

    /* "asyncpg/protocol/prepared_stmt.pyx":284
 *             flen = hton.unpack_int32(frb_read(&rbuf, 4))
 * 
 *             if flen == -1:             # <<<<<<<<<<<<<<
 *                 val = None
 *             else:
 */
    __pyx_t_3 = ((__pyx_v_flen == -1L) != 0);
    if (__pyx_t_3) {

      /* "asyncpg/protocol/prepared_stmt.pyx":285
 * 
 *             if flen == -1:
 *                 val = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # Clamp buffer size to that of the reported field length
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_val, Py_None);

      /* "asyncpg/protocol/prepared_stmt.pyx":284
 *             flen = hton.unpack_int32(frb_read(&rbuf, 4))
 * 
 *             if flen == -1:             # <<<<<<<<<<<<<<
 *                 val = None
 *             else:
 */
      goto __pyx_L6;
    }

    /* "asyncpg/protocol/prepared_stmt.pyx":290
 *                 # to make sure that codecs can rely on read_all() working
 *                 # properly.
 *                 bl = frb_get_len(&rbuf)             # <<<<<<<<<<<<<<
 *                 if flen > bl:
 *                     frb_check(&rbuf, flen)
 */
    /*else*/ {
      __pyx_v_bl = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len((&__pyx_v_rbuf));

      /* "asyncpg/protocol/prepared_stmt.pyx":291
 *                 # properly.
 *                 bl = frb_get_len(&rbuf)
 *                 if flen > bl:             # <<<<<<<<<<<<<<
 *                     frb_check(&rbuf, flen)
 *                 frb_set_len(&rbuf, flen)
 */
      __pyx_t_3 = ((__pyx_v_flen > __pyx_v_bl) != 0);
      if (__pyx_t_3) {

        /* "asyncpg/protocol/prepared_stmt.pyx":292
 *                 bl = frb_get_len(&rbuf)
 *                 if flen > bl:
 *                     frb_check(&rbuf, flen)             # <<<<<<<<<<<<<<
 *                 frb_set_len(&rbuf, flen)
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)
 */
        __pyx_t_4 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_check((&__pyx_v_rbuf), __pyx_v_flen); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/prepared_stmt.pyx":291
 *                 # properly.
 *                 bl = frb_get_len(&rbuf)
 *                 if flen > bl:             # <<<<<<<<<<<<<<
 *                     frb_check(&rbuf, flen)
 *                 frb_set_len(&rbuf, flen)
 */
      }

      /* "asyncpg/protocol/prepared_stmt.pyx":293
 *                 if flen > bl:
 *                     frb_check(&rbuf, flen)
 *                 frb_set_len(&rbuf, flen)             # <<<<<<<<<<<<<<
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)
 *                 val = codec.decode(settings, &rbuf)
 */
      __pyx_f_7asyncpg_7pgproto_7pgproto_frb_set_len((&__pyx_v_rbuf), __pyx_v_flen);

      /* "asyncpg/protocol/prepared_stmt.pyx":294
 *                     frb_check(&rbuf, flen)
 *                 frb_set_len(&rbuf, flen)
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)             # <<<<<<<<<<<<<<
 *                 val = codec.decode(settings, &rbuf)
 *                 if frb_get_len(&rbuf) != 0:
 */
      __pyx_t_15 = PyTuple_GET_ITEM(__pyx_v_rows_codecs, __pyx_v_i);
      __pyx_t_4 = ((PyObject *)__pyx_t_15);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":295
 *                 frb_set_len(&rbuf, flen)
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)
 *                 val = codec.decode(settings, &rbuf)             # <<<<<<<<<<<<<<
 *                 if frb_get_len(&rbuf) != 0:
 *                     raise BufferError(
 */
      __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode(__pyx_v_codec, __pyx_v_settings, (&__pyx_v_rbuf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "asyncpg/protocol/prepared_stmt.pyx":296
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)
 *                 val = codec.decode(settings, &rbuf)
 *                 if frb_get_len(&rbuf) != 0:             # <<<<<<<<<<<<<<
 *                     raise BufferError(
 *                         'unexpected trailing {} bytes in buffer'.format(
 */
      __pyx_t_3 = ((__pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len((&__pyx_v_rbuf)) != 0) != 0);
      if (unlikely(__pyx_t_3)) {

        /* "asyncpg/protocol/prepared_stmt.pyx":298
 *                 if frb_get_len(&rbuf) != 0:
 *                     raise BufferError(
 *                         'unexpected trailing {} bytes in buffer'.format(             # <<<<<<<<<<<<<<
 *                             frb_get_len(&rbuf)))
 *                 frb_set_len(&rbuf, bl - flen)
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_trailing_bytes_in_buf, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "asyncpg/protocol/prepared_stmt.pyx":299
 *                     raise BufferError(
 *                         'unexpected trailing {} bytes in buffer'.format(
 *                             frb_get_len(&rbuf)))             # <<<<<<<<<<<<<<
 *                 frb_set_len(&rbuf, bl - flen)
 * 
 */
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len((&__pyx_v_rbuf))); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 299, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __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_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "asyncpg/protocol/prepared_stmt.pyx":297
 *                 val = codec.decode(settings, &rbuf)
 *                 if frb_get_len(&rbuf) != 0:
 *                     raise BufferError(             # <<<<<<<<<<<<<<
 *                         'unexpected trailing {} bytes in buffer'.format(
 *                             frb_get_len(&rbuf)))
 */
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_BufferError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 297, __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(7, 297, __pyx_L1_error)

        /* "asyncpg/protocol/prepared_stmt.pyx":296
 *                 codec = <Codec>cpython.PyTuple_GET_ITEM(rows_codecs, i)
 *                 val = codec.decode(settings, &rbuf)
 *                 if frb_get_len(&rbuf) != 0:             # <<<<<<<<<<<<<<
 *                     raise BufferError(
 *                         'unexpected trailing {} bytes in buffer'.format(
 */
      }

      /* "asyncpg/protocol/prepared_stmt.pyx":300
 *                         'unexpected trailing {} bytes in buffer'.format(
 *                             frb_get_len(&rbuf)))
 *                 frb_set_len(&rbuf, bl - flen)             # <<<<<<<<<<<<<<
 * 
 *             cpython.Py_INCREF(val)
 */
      __pyx_f_7asyncpg_7pgproto_7pgproto_frb_set_len((&__pyx_v_rbuf), (__pyx_v_bl - __pyx_v_flen));
    }
    __pyx_L6:;

    /* "asyncpg/protocol/prepared_stmt.pyx":302
 *                 frb_set_len(&rbuf, bl - flen)
 * 
 *             cpython.Py_INCREF(val)             # <<<<<<<<<<<<<<
 *             record.ApgRecord_SET_ITEM(dec_row, i, val)
 * 
 */
    Py_INCREF(__pyx_v_val);

    /* "asyncpg/protocol/prepared_stmt.pyx":303
 * 
 *             cpython.Py_INCREF(val)
 *             record.ApgRecord_SET_ITEM(dec_row, i, val)             # <<<<<<<<<<<<<<
 * 
 *         if frb_get_len(&rbuf) != 0:
 */
    ApgRecord_SET_ITEM(__pyx_v_dec_row, __pyx_v_i, __pyx_v_val);
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":305
 *             record.ApgRecord_SET_ITEM(dec_row, i, val)
 * 
 *         if frb_get_len(&rbuf) != 0:             # <<<<<<<<<<<<<<
 *             raise BufferError('unexpected trailing {} bytes in buffer'.format(
 *                 frb_get_len(&rbuf)))
 */
  __pyx_t_3 = ((__pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len((&__pyx_v_rbuf)) != 0) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/prepared_stmt.pyx":306
 * 
 *         if frb_get_len(&rbuf) != 0:
 *             raise BufferError('unexpected trailing {} bytes in buffer'.format(             # <<<<<<<<<<<<<<
 *                 frb_get_len(&rbuf)))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_unexpected_trailing_bytes_in_buf, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/prepared_stmt.pyx":307
 *         if frb_get_len(&rbuf) != 0:
 *             raise BufferError('unexpected trailing {} bytes in buffer'.format(
 *                 frb_get_len(&rbuf)))             # <<<<<<<<<<<<<<
 * 
 *         return dec_row
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len((&__pyx_v_rbuf))); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":306
 * 
 *         if frb_get_len(&rbuf) != 0:
 *             raise BufferError('unexpected trailing {} bytes in buffer'.format(             # <<<<<<<<<<<<<<
 *                 frb_get_len(&rbuf)))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_BufferError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(7, 306, __pyx_L1_error)

    /* "asyncpg/protocol/prepared_stmt.pyx":305
 *             record.ApgRecord_SET_ITEM(dec_row, i, val)
 * 
 *         if frb_get_len(&rbuf) != 0:             # <<<<<<<<<<<<<<
 *             raise BufferError('unexpected trailing {} bytes in buffer'.format(
 *                 frb_get_len(&rbuf)))
 */
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":309
 *                 frb_get_len(&rbuf)))
 * 
 *         return dec_row             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dec_row);
  __pyx_r = __pyx_v_dec_row;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":258
 *         self.args_num = <int16_t>(len(self.parameters_desc))
 * 
 *     cdef _decode_row(self, const char* cbuf, ssize_t buf_len):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec codec
 */

  /* function exit code */
  __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_11);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState._decode_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_codec);
  __Pyx_XDECREF(__pyx_v_dec_row);
  __Pyx_XDECREF(__pyx_v_rows_codecs);
  __Pyx_XDECREF((PyObject *)__pyx_v_settings);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pxd":10
 * cdef class PreparedStatementState:
 *     cdef:
 *         readonly str name             # <<<<<<<<<<<<<<
 *         readonly str query
 *         readonly bint closed
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

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

/* "asyncpg/protocol/prepared_stmt.pxd":11
 *     cdef:
 *         readonly str name
 *         readonly str query             # <<<<<<<<<<<<<<
 *         readonly bint closed
 *         readonly int refs
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->query);
  __pyx_r = __pyx_v_self->query;
  goto __pyx_L0;

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

/* "asyncpg/protocol/prepared_stmt.pxd":12
 *         readonly str name
 *         readonly str query
 *         readonly bint closed             # <<<<<<<<<<<<<<
 *         readonly int refs
 *         readonly type record_class
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->closed); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pxd":13
 *         readonly str query
 *         readonly bint closed
 *         readonly int refs             # <<<<<<<<<<<<<<
 *         readonly type record_class
 *         readonly bint ignore_custom_codec
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->refs); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState.refs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pxd":14
 *         readonly bint closed
 *         readonly int refs
 *         readonly type record_class             # <<<<<<<<<<<<<<
 *         readonly bint ignore_custom_codec
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->record_class));
  __pyx_r = ((PyObject *)__pyx_v_self->record_class);
  goto __pyx_L0;

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

/* "asyncpg/protocol/prepared_stmt.pxd":15
 *         readonly int refs
 *         readonly type record_class
 *         readonly bint ignore_custom_codec             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->ignore_custom_codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.PreparedStatementState.ignore_custom_codec.__get__", __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_7asyncpg_8protocol_8protocol_22PreparedStatementState_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_17__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_7asyncpg_8protocol_8protocol_22PreparedStatementState_16__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.PreparedStatementState.__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_7asyncpg_8protocol_8protocol_22PreparedStatementState_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_19__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_7asyncpg_8protocol_8protocol_22PreparedStatementState_18__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_22PreparedStatementState_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__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__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 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(3, 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("asyncpg.protocol.protocol.PreparedStatementState.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":312
 * 
 * 
 * cdef _decode_parameters_desc(object desc):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ReadBuffer reader
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__decode_parameters_desc(PyObject *__pyx_v_desc) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_reader = 0;
  int16_t __pyx_v_nparams;
  uint32_t __pyx_v_p_oid;
  PyObject *__pyx_v_result = 0;
  CYTHON_UNUSED long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int16_t __pyx_t_2;
  int32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decode_parameters_desc", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":317
 *         int16_t nparams
 *         uint32_t p_oid
 *         list result = []             # <<<<<<<<<<<<<<
 * 
 *     reader = ReadBuffer.new_message_parser(desc)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":319
 *         list result = []
 * 
 *     reader = ReadBuffer.new_message_parser(desc)             # <<<<<<<<<<<<<<
 *     nparams = reader.read_int16()
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_ReadBuffer->new_message_parser(__pyx_v_desc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_reader = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":320
 * 
 *     reader = ReadBuffer.new_message_parser(desc)
 *     nparams = reader.read_int16()             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < nparams:
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int16(__pyx_v_reader); if (unlikely(__pyx_t_2 == ((int16_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 320, __pyx_L1_error)
  __pyx_v_nparams = __pyx_t_2;

  /* "asyncpg/protocol/prepared_stmt.pyx":322
 *     nparams = reader.read_int16()
 * 
 *     for i from 0 <= i < nparams:             # <<<<<<<<<<<<<<
 *         p_oid = <uint32_t>reader.read_int32()
 *         result.append(p_oid)
 */
  __pyx_t_2 = __pyx_v_nparams;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

    /* "asyncpg/protocol/prepared_stmt.pyx":323
 * 
 *     for i from 0 <= i < nparams:
 *         p_oid = <uint32_t>reader.read_int32()             # <<<<<<<<<<<<<<
 *         result.append(p_oid)
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int32(__pyx_v_reader); if (unlikely(__pyx_t_3 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 323, __pyx_L1_error)
    __pyx_v_p_oid = ((uint32_t)__pyx_t_3);

    /* "asyncpg/protocol/prepared_stmt.pyx":324
 *     for i from 0 <= i < nparams:
 *         p_oid = <uint32_t>reader.read_int32()
 *         result.append(p_oid)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_p_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(7, 324, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":326
 *         result.append(p_oid)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":312
 * 
 * 
 * cdef _decode_parameters_desc(object desc):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ReadBuffer reader
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._decode_parameters_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_reader);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/prepared_stmt.pyx":329
 * 
 * 
 * cdef _decode_row_desc(object desc):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ReadBuffer reader
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol__decode_row_desc(PyObject *__pyx_v_desc) {
  struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_reader = 0;
  int16_t __pyx_v_nfields;
  PyObject *__pyx_v_f_name = 0;
  uint32_t __pyx_v_f_table_oid;
  int16_t __pyx_v_f_column_num;
  uint32_t __pyx_v_f_dt_oid;
  int16_t __pyx_v_f_dt_size;
  int32_t __pyx_v_f_dt_mod;
  int16_t __pyx_v_f_format;
  PyObject *__pyx_v_result = 0;
  CYTHON_UNUSED long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int16_t __pyx_t_2;
  int32_t __pyx_t_3;
  int16_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decode_row_desc", 0);

  /* "asyncpg/protocol/prepared_stmt.pyx":345
 *         list result
 * 
 *     reader = ReadBuffer.new_message_parser(desc)             # <<<<<<<<<<<<<<
 *     nfields = reader.read_int16()
 *     result = []
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_ReadBuffer->new_message_parser(__pyx_v_desc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_reader = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":346
 * 
 *     reader = ReadBuffer.new_message_parser(desc)
 *     nfields = reader.read_int16()             # <<<<<<<<<<<<<<
 *     result = []
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int16(__pyx_v_reader); if (unlikely(__pyx_t_2 == ((int16_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 346, __pyx_L1_error)
  __pyx_v_nfields = __pyx_t_2;

  /* "asyncpg/protocol/prepared_stmt.pyx":347
 *     reader = ReadBuffer.new_message_parser(desc)
 *     nfields = reader.read_int16()
 *     result = []             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < nfields:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":349
 *     result = []
 * 
 *     for i from 0 <= i < nfields:             # <<<<<<<<<<<<<<
 *         f_name = reader.read_null_str()
 *         f_table_oid = <uint32_t>reader.read_int32()
 */
  __pyx_t_2 = __pyx_v_nfields;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

    /* "asyncpg/protocol/prepared_stmt.pyx":350
 * 
 *     for i from 0 <= i < nfields:
 *         f_name = reader.read_null_str()             # <<<<<<<<<<<<<<
 *         f_table_oid = <uint32_t>reader.read_int32()
 *         f_column_num = reader.read_int16()
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_null_str(__pyx_v_reader); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(7, 350, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_f_name, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":351
 *     for i from 0 <= i < nfields:
 *         f_name = reader.read_null_str()
 *         f_table_oid = <uint32_t>reader.read_int32()             # <<<<<<<<<<<<<<
 *         f_column_num = reader.read_int16()
 *         f_dt_oid = <uint32_t>reader.read_int32()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int32(__pyx_v_reader); if (unlikely(__pyx_t_3 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 351, __pyx_L1_error)
    __pyx_v_f_table_oid = ((uint32_t)__pyx_t_3);

    /* "asyncpg/protocol/prepared_stmt.pyx":352
 *         f_name = reader.read_null_str()
 *         f_table_oid = <uint32_t>reader.read_int32()
 *         f_column_num = reader.read_int16()             # <<<<<<<<<<<<<<
 *         f_dt_oid = <uint32_t>reader.read_int32()
 *         f_dt_size = reader.read_int16()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int16(__pyx_v_reader); if (unlikely(__pyx_t_4 == ((int16_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 352, __pyx_L1_error)
    __pyx_v_f_column_num = __pyx_t_4;

    /* "asyncpg/protocol/prepared_stmt.pyx":353
 *         f_table_oid = <uint32_t>reader.read_int32()
 *         f_column_num = reader.read_int16()
 *         f_dt_oid = <uint32_t>reader.read_int32()             # <<<<<<<<<<<<<<
 *         f_dt_size = reader.read_int16()
 *         f_dt_mod = reader.read_int32()
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int32(__pyx_v_reader); if (unlikely(__pyx_t_3 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 353, __pyx_L1_error)
    __pyx_v_f_dt_oid = ((uint32_t)__pyx_t_3);

    /* "asyncpg/protocol/prepared_stmt.pyx":354
 *         f_column_num = reader.read_int16()
 *         f_dt_oid = <uint32_t>reader.read_int32()
 *         f_dt_size = reader.read_int16()             # <<<<<<<<<<<<<<
 *         f_dt_mod = reader.read_int32()
 *         f_format = reader.read_int16()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int16(__pyx_v_reader); if (unlikely(__pyx_t_4 == ((int16_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 354, __pyx_L1_error)
    __pyx_v_f_dt_size = __pyx_t_4;

    /* "asyncpg/protocol/prepared_stmt.pyx":355
 *         f_dt_oid = <uint32_t>reader.read_int32()
 *         f_dt_size = reader.read_int16()
 *         f_dt_mod = reader.read_int32()             # <<<<<<<<<<<<<<
 *         f_format = reader.read_int16()
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int32(__pyx_v_reader); if (unlikely(__pyx_t_3 == ((int32_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 355, __pyx_L1_error)
    __pyx_v_f_dt_mod = __pyx_t_3;

    /* "asyncpg/protocol/prepared_stmt.pyx":356
 *         f_dt_size = reader.read_int16()
 *         f_dt_mod = reader.read_int32()
 *         f_format = reader.read_int16()             # <<<<<<<<<<<<<<
 * 
 *         result.append(
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_reader->__pyx_vtab)->read_int16(__pyx_v_reader); if (unlikely(__pyx_t_4 == ((int16_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 356, __pyx_L1_error)
    __pyx_v_f_format = __pyx_t_4;

    /* "asyncpg/protocol/prepared_stmt.pyx":359
 * 
 *         result.append(
 *             (f_name, f_table_oid, f_column_num, f_dt_oid,             # <<<<<<<<<<<<<<
 *              f_dt_size, f_dt_mod, f_format))
 * 
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_f_table_oid); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_int16_t(__pyx_v_f_column_num); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_f_dt_oid); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/prepared_stmt.pyx":360
 *         result.append(
 *             (f_name, f_table_oid, f_column_num, f_dt_oid,
 *              f_dt_size, f_dt_mod, f_format))             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_7 = __Pyx_PyInt_From_int16_t(__pyx_v_f_dt_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyInt_From_int32_t(__pyx_v_f_dt_mod); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyInt_From_int16_t(__pyx_v_f_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);

    /* "asyncpg/protocol/prepared_stmt.pyx":359
 * 
 *         result.append(
 *             (f_name, f_table_oid, f_column_num, f_dt_oid,             # <<<<<<<<<<<<<<
 *              f_dt_size, f_dt_mod, f_format))
 * 
 */
    __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) __PYX_ERR(7, 359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v_f_name);
    __Pyx_GIVEREF(__pyx_v_f_name);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_f_name);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_9);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;

    /* "asyncpg/protocol/prepared_stmt.pyx":358
 *         f_format = reader.read_int16()
 * 
 *         result.append(             # <<<<<<<<<<<<<<
 *             (f_name, f_table_oid, f_column_num, f_dt_oid,
 *              f_dt_size, f_dt_mod, f_format))
 */
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(7, 358, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }

  /* "asyncpg/protocol/prepared_stmt.pyx":362
 *              f_dt_size, f_dt_mod, f_format))
 * 
 *     return result             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/protocol/prepared_stmt.pyx":329
 * 
 * 
 * cdef _decode_row_desc(object desc):             # <<<<<<<<<<<<<<
 *     cdef:
 *         ReadBuffer reader
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._decode_row_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_reader);
  __Pyx_XDECREF(__pyx_v_f_name);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":76
 * 
 * cdef class BaseProtocol(CoreProtocol):
 *     def __init__(self, addr, connected_fut, con_params, record_class: type, loop):             # <<<<<<<<<<<<<<
 *         # type of `con_params` is `_ConnectionParameters`
 *         CoreProtocol.__init__(self, con_params)
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_addr = 0;
  PyObject *__pyx_v_connected_fut = 0;
  PyObject *__pyx_v_con_params = 0;
  PyTypeObject *__pyx_v_record_class = 0;
  PyObject *__pyx_v_loop = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_connected_fut,&__pyx_n_s_con_params,&__pyx_n_s_record_class,&__pyx_n_s_loop,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_addr)) != 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_connected_fut)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(1, 76, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_con_params)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(1, 76, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_record_class)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(1, 76, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_loop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(1, 76, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 76, __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_addr = values[0];
    __pyx_v_connected_fut = values[1];
    __pyx_v_con_params = values[2];
    __pyx_v_record_class = ((PyTypeObject*)values[3]);
    __pyx_v_loop = 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(1, 76, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record_class), (&PyType_Type), 1, "record_class", 1))) __PYX_ERR(1, 76, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol___init__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_addr, __pyx_v_connected_fut, __pyx_v_con_params, __pyx_v_record_class, __pyx_v_loop);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol___init__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_addr, PyObject *__pyx_v_connected_fut, PyObject *__pyx_v_con_params, PyTypeObject *__pyx_v_record_class, PyObject *__pyx_v_loop) {
  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;
  PyObject *__pyx_t_6 = NULL;
  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("__init__", 0);

  /* "asyncpg/protocol/protocol.pyx":78
 *     def __init__(self, addr, connected_fut, con_params, record_class: type, loop):
 *         # type of `con_params` is `_ConnectionParameters`
 *         CoreProtocol.__init__(self, con_params)             # <<<<<<<<<<<<<<
 * 
 *         self.loop = loop
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_CoreProtocol), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_con_params};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_con_params};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_con_params);
    __Pyx_GIVEREF(__pyx_v_con_params);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_con_params);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":80
 *         CoreProtocol.__init__(self, con_params)
 * 
 *         self.loop = loop             # <<<<<<<<<<<<<<
 *         self.transport = None
 *         self.waiter = connected_fut
 */
  __Pyx_INCREF(__pyx_v_loop);
  __Pyx_GIVEREF(__pyx_v_loop);
  __Pyx_GOTREF(__pyx_v_self->loop);
  __Pyx_DECREF(__pyx_v_self->loop);
  __pyx_v_self->loop = __pyx_v_loop;

  /* "asyncpg/protocol/protocol.pyx":81
 * 
 *         self.loop = loop
 *         self.transport = None             # <<<<<<<<<<<<<<
 *         self.waiter = connected_fut
 *         self.cancel_waiter = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.transport);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.transport);
  __pyx_v_self->__pyx_base.transport = Py_None;

  /* "asyncpg/protocol/protocol.pyx":82
 *         self.loop = loop
 *         self.transport = None
 *         self.waiter = connected_fut             # <<<<<<<<<<<<<<
 *         self.cancel_waiter = None
 *         self.cancel_sent_waiter = None
 */
  __Pyx_INCREF(__pyx_v_connected_fut);
  __Pyx_GIVEREF(__pyx_v_connected_fut);
  __Pyx_GOTREF(__pyx_v_self->waiter);
  __Pyx_DECREF(__pyx_v_self->waiter);
  __pyx_v_self->waiter = __pyx_v_connected_fut;

  /* "asyncpg/protocol/protocol.pyx":83
 *         self.transport = None
 *         self.waiter = connected_fut
 *         self.cancel_waiter = None             # <<<<<<<<<<<<<<
 *         self.cancel_sent_waiter = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->cancel_waiter);
  __Pyx_DECREF(__pyx_v_self->cancel_waiter);
  __pyx_v_self->cancel_waiter = Py_None;

  /* "asyncpg/protocol/protocol.pyx":84
 *         self.waiter = connected_fut
 *         self.cancel_waiter = None
 *         self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self.address = addr
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->cancel_sent_waiter);
  __Pyx_DECREF(__pyx_v_self->cancel_sent_waiter);
  __pyx_v_self->cancel_sent_waiter = Py_None;

  /* "asyncpg/protocol/protocol.pyx":86
 *         self.cancel_sent_waiter = None
 * 
 *         self.address = addr             # <<<<<<<<<<<<<<
 *         self.settings = ConnectionSettings((self.address, con_params.database))
 *         self.record_class = record_class
 */
  __Pyx_INCREF(__pyx_v_addr);
  __Pyx_GIVEREF(__pyx_v_addr);
  __Pyx_GOTREF(__pyx_v_self->address);
  __Pyx_DECREF(__pyx_v_self->address);
  __pyx_v_self->address = __pyx_v_addr;

  /* "asyncpg/protocol/protocol.pyx":87
 * 
 *         self.address = addr
 *         self.settings = ConnectionSettings((self.address, con_params.database))             # <<<<<<<<<<<<<<
 *         self.record_class = record_class
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_con_params, __pyx_n_s_database); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->address);
  __Pyx_GIVEREF(__pyx_v_self->address);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->address);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_ConnectionSettings), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->settings);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->settings));
  __pyx_v_self->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":88
 *         self.address = addr
 *         self.settings = ConnectionSettings((self.address, con_params.database))
 *         self.record_class = record_class             # <<<<<<<<<<<<<<
 * 
 *         self.statement = None
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_record_class));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_record_class));
  __Pyx_GOTREF(__pyx_v_self->record_class);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->record_class));
  __pyx_v_self->record_class = __pyx_v_record_class;

  /* "asyncpg/protocol/protocol.pyx":90
 *         self.record_class = record_class
 * 
 *         self.statement = None             # <<<<<<<<<<<<<<
 *         self.return_extra = False
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->statement);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->statement));
  __pyx_v_self->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None);

  /* "asyncpg/protocol/protocol.pyx":91
 * 
 *         self.statement = None
 *         self.return_extra = False             # <<<<<<<<<<<<<<
 * 
 *         self.last_query = None
 */
  __pyx_v_self->return_extra = 0;

  /* "asyncpg/protocol/protocol.pyx":93
 *         self.return_extra = False
 * 
 *         self.last_query = None             # <<<<<<<<<<<<<<
 * 
 *         self.closing = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->last_query);
  __Pyx_DECREF(__pyx_v_self->last_query);
  __pyx_v_self->last_query = ((PyObject*)Py_None);

  /* "asyncpg/protocol/protocol.pyx":95
 *         self.last_query = None
 * 
 *         self.closing = False             # <<<<<<<<<<<<<<
 *         self.is_reading = True
 *         self.writing_allowed = asyncio.Event()
 */
  __pyx_v_self->closing = 0;

  /* "asyncpg/protocol/protocol.pyx":96
 * 
 *         self.closing = False
 *         self.is_reading = True             # <<<<<<<<<<<<<<
 *         self.writing_allowed = asyncio.Event()
 *         self.writing_allowed.set()
 */
  __pyx_v_self->is_reading = 1;

  /* "asyncpg/protocol/protocol.pyx":97
 *         self.closing = False
 *         self.is_reading = True
 *         self.writing_allowed = asyncio.Event()             # <<<<<<<<<<<<<<
 *         self.writing_allowed.set()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Event); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_writing_allowed, __pyx_t_1) < 0) __PYX_ERR(1, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":98
 *         self.is_reading = True
 *         self.writing_allowed = asyncio.Event()
 *         self.writing_allowed.set()             # <<<<<<<<<<<<<<
 * 
 *         self.timeout_handle = None
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __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;

  /* "asyncpg/protocol/protocol.pyx":100
 *         self.writing_allowed.set()
 * 
 *         self.timeout_handle = None             # <<<<<<<<<<<<<<
 *         self.timeout_callback = self._on_timeout
 *         self.completed_callback = self._on_waiter_completed
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->timeout_handle);
  __Pyx_DECREF(__pyx_v_self->timeout_handle);
  __pyx_v_self->timeout_handle = Py_None;

  /* "asyncpg/protocol/protocol.pyx":101
 * 
 *         self.timeout_handle = None
 *         self.timeout_callback = self._on_timeout             # <<<<<<<<<<<<<<
 *         self.completed_callback = self._on_waiter_completed
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->timeout_callback);
  __Pyx_DECREF(__pyx_v_self->timeout_callback);
  __pyx_v_self->timeout_callback = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":102
 *         self.timeout_handle = None
 *         self.timeout_callback = self._on_timeout
 *         self.completed_callback = self._on_waiter_completed             # <<<<<<<<<<<<<<
 * 
 *         self.queries_count = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_waiter_completed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->completed_callback);
  __Pyx_DECREF(__pyx_v_self->completed_callback);
  __pyx_v_self->completed_callback = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":104
 *         self.completed_callback = self._on_waiter_completed
 * 
 *         self.queries_count = 0             # <<<<<<<<<<<<<<
 * 
 *         self._is_ssl = False
 */
  __pyx_v_self->queries_count = 0;

  /* "asyncpg/protocol/protocol.pyx":106
 *         self.queries_count = 0
 * 
 *         self._is_ssl = False             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_v_self->_is_ssl = 0;

  /* "asyncpg/protocol/protocol.pyx":108
 *         self._is_ssl = False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = loop.create_future
 *         except AttributeError:
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/protocol.pyx":109
 * 
 *         try:
 *             self.create_future = loop.create_future             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             self.create_future = self._create_future_fallback
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s_create_future); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->create_future);
      __Pyx_DECREF(__pyx_v_self->create_future);
      __pyx_v_self->create_future = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "asyncpg/protocol/protocol.pyx":108
 *         self._is_ssl = False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = loop.create_future
 *         except AttributeError:
 */
    }
    __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_5); __pyx_t_5 = 0;

    /* "asyncpg/protocol/protocol.pyx":110
 *         try:
 *             self.create_future = loop.create_future
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             self.create_future = self._create_future_fallback
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(1, 110, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);

      /* "asyncpg/protocol/protocol.pyx":111
 *             self.create_future = loop.create_future
 *         except AttributeError:
 *             self.create_future = self._create_future_fallback             # <<<<<<<<<<<<<<
 * 
 *     def set_connection(self, connection):
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_future_fallback); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 111, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->create_future);
      __Pyx_DECREF(__pyx_v_self->create_future);
      __pyx_v_self->create_future = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asyncpg/protocol/protocol.pyx":108
 *         self._is_ssl = False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = loop.create_future
 *         except AttributeError:
 */
    __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:;
  }

  /* "asyncpg/protocol/protocol.pyx":76
 * 
 * cdef class BaseProtocol(CoreProtocol):
 *     def __init__(self, addr, connected_fut, con_params, record_class: type, loop):             # <<<<<<<<<<<<<<
 *         # type of `con_params` is `_ConnectionParameters`
 *         CoreProtocol.__init__(self, con_params)
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":113
 *             self.create_future = self._create_future_fallback
 * 
 *     def set_connection(self, connection):             # <<<<<<<<<<<<<<
 *         self.conref = weakref.ref(connection)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_3set_connection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_3set_connection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_connection (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_2set_connection(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_connection));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_2set_connection(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_connection) {
  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("set_connection", 0);

  /* "asyncpg/protocol/protocol.pyx":114
 * 
 *     def set_connection(self, connection):
 *         self.conref = weakref.ref(connection)             # <<<<<<<<<<<<<<
 * 
 *     cdef get_connection(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_weakref); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ref); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 114, __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_v_connection) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_connection);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->conref);
  __Pyx_DECREF(__pyx_v_self->conref);
  __pyx_v_self->conref = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":113
 *             self.create_future = self._create_future_fallback
 * 
 *     def set_connection(self, connection):             # <<<<<<<<<<<<<<
 *         self.conref = weakref.ref(connection)
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.set_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":116
 *         self.conref = weakref.ref(connection)
 * 
 *     cdef get_connection(self):             # <<<<<<<<<<<<<<
 *         if self.conref is not None:
 *             return self.conref()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_get_connection(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_connection", 0);

  /* "asyncpg/protocol/protocol.pyx":117
 * 
 *     cdef get_connection(self):
 *         if self.conref is not None:             # <<<<<<<<<<<<<<
 *             return self.conref()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->conref != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":118
 *     cdef get_connection(self):
 *         if self.conref is not None:
 *             return self.conref()             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->conref);
    __pyx_t_4 = __pyx_v_self->conref; __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_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_3)) __PYX_ERR(1, 118, __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;

    /* "asyncpg/protocol/protocol.pyx":117
 * 
 *     cdef get_connection(self):
 *         if self.conref is not None:             # <<<<<<<<<<<<<<
 *             return self.conref()
 *         else:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":120
 *             return self.conref()
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get_server_pid(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/protocol.pyx":116
 *         self.conref = weakref.ref(connection)
 * 
 *     cdef get_connection(self):             # <<<<<<<<<<<<<<
 *         if self.conref is not None:
 *             return self.conref()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.get_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":122
 *             return None
 * 
 *     def get_server_pid(self):             # <<<<<<<<<<<<<<
 *         return self.backend_pid
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_5get_server_pid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_5get_server_pid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_server_pid (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_4get_server_pid(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_4get_server_pid(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("get_server_pid", 0);

  /* "asyncpg/protocol/protocol.pyx":123
 * 
 *     def get_server_pid(self):
 *         return self.backend_pid             # <<<<<<<<<<<<<<
 * 
 *     def get_settings(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->__pyx_base.backend_pid); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":122
 *             return None
 * 
 *     def get_server_pid(self):             # <<<<<<<<<<<<<<
 *         return self.backend_pid
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.get_server_pid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":125
 *         return self.backend_pid
 * 
 *     def get_settings(self):             # <<<<<<<<<<<<<<
 *         return self.settings
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7get_settings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7get_settings(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_settings (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6get_settings(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6get_settings(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_settings", 0);

  /* "asyncpg/protocol/protocol.pyx":126
 * 
 *     def get_settings(self):
 *         return self.settings             # <<<<<<<<<<<<<<
 * 
 *     def get_record_class(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->settings));
  __pyx_r = ((PyObject *)__pyx_v_self->settings);
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":125
 *         return self.backend_pid
 * 
 *     def get_settings(self):             # <<<<<<<<<<<<<<
 *         return self.settings
 * 
 */

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

/* "asyncpg/protocol/protocol.pyx":128
 *         return self.settings
 * 
 *     def get_record_class(self):             # <<<<<<<<<<<<<<
 *         return self.record_class
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_9get_record_class(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_9get_record_class(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_record_class (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_8get_record_class(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_8get_record_class(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_record_class", 0);

  /* "asyncpg/protocol/protocol.pyx":129
 * 
 *     def get_record_class(self):
 *         return self.record_class             # <<<<<<<<<<<<<<
 * 
 *     cdef inline resume_reading(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->record_class));
  __pyx_r = ((PyObject *)__pyx_v_self->record_class);
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":128
 *         return self.settings
 * 
 *     def get_record_class(self):             # <<<<<<<<<<<<<<
 *         return self.record_class
 * 
 */

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

/* "asyncpg/protocol/protocol.pyx":131
 *         return self.record_class
 * 
 *     cdef inline resume_reading(self):             # <<<<<<<<<<<<<<
 *         if not self.is_reading:
 *             self.is_reading = True
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("resume_reading", 0);

  /* "asyncpg/protocol/protocol.pyx":132
 * 
 *     cdef inline resume_reading(self):
 *         if not self.is_reading:             # <<<<<<<<<<<<<<
 *             self.is_reading = True
 *             self.transport.resume_reading()
 */
  __pyx_t_1 = ((!(__pyx_v_self->is_reading != 0)) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":133
 *     cdef inline resume_reading(self):
 *         if not self.is_reading:
 *             self.is_reading = True             # <<<<<<<<<<<<<<
 *             self.transport.resume_reading()
 * 
 */
    __pyx_v_self->is_reading = 1;

    /* "asyncpg/protocol/protocol.pyx":134
 *         if not self.is_reading:
 *             self.is_reading = True
 *             self.transport.resume_reading()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline pause_reading(self):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.transport, __pyx_n_s_resume_reading); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 134, __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(1, 134, __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;

    /* "asyncpg/protocol/protocol.pyx":132
 * 
 *     cdef inline resume_reading(self):
 *         if not self.is_reading:             # <<<<<<<<<<<<<<
 *             self.is_reading = True
 *             self.transport.resume_reading()
 */
  }

  /* "asyncpg/protocol/protocol.pyx":131
 *         return self.record_class
 * 
 *     cdef inline resume_reading(self):             # <<<<<<<<<<<<<<
 *         if not self.is_reading:
 *             self.is_reading = True
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.resume_reading", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":136
 *             self.transport.resume_reading()
 * 
 *     cdef inline pause_reading(self):             # <<<<<<<<<<<<<<
 *         if self.is_reading:
 *             self.is_reading = False
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_pause_reading(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("pause_reading", 0);

  /* "asyncpg/protocol/protocol.pyx":137
 * 
 *     cdef inline pause_reading(self):
 *         if self.is_reading:             # <<<<<<<<<<<<<<
 *             self.is_reading = False
 *             self.transport.pause_reading()
 */
  __pyx_t_1 = (__pyx_v_self->is_reading != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":138
 *     cdef inline pause_reading(self):
 *         if self.is_reading:
 *             self.is_reading = False             # <<<<<<<<<<<<<<
 *             self.transport.pause_reading()
 * 
 */
    __pyx_v_self->is_reading = 0;

    /* "asyncpg/protocol/protocol.pyx":139
 *         if self.is_reading:
 *             self.is_reading = False
 *             self.transport.pause_reading()             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.transport, __pyx_n_s_pause_reading); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __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(1, 139, __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;

    /* "asyncpg/protocol/protocol.pyx":137
 * 
 *     cdef inline pause_reading(self):
 *         if self.is_reading:             # <<<<<<<<<<<<<<
 *             self.is_reading = False
 *             self.transport.pause_reading()
 */
  }

  /* "asyncpg/protocol/protocol.pyx":136
 *             self.transport.resume_reading()
 * 
 *     cdef inline pause_reading(self):             # <<<<<<<<<<<<<<
 *         if self.is_reading:
 *             self.is_reading = False
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.pause_reading", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":142
 * 
 *     @cython.iterable_coroutine
 *     async def prepare(self, stmt_name, query, timeout,             # <<<<<<<<<<<<<<
 *                       *,
 *                       PreparedStatementState state=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_11prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_11prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stmt_name = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_timeout = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_ignore_custom_codec = 0;
  PyObject *__pyx_v_record_class = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prepare (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stmt_name,&__pyx_n_s_query,&__pyx_n_s_timeout,&__pyx_n_s_record_class,&__pyx_n_s_state,&__pyx_n_s_ignore_custom_codec,0};
    PyObject* values[6] = {0,0,0,0,0,0};

    /* "asyncpg/protocol/protocol.pyx":144
 *     async def prepare(self, stmt_name, query, timeout,
 *                       *,
 *                       PreparedStatementState state=None,             # <<<<<<<<<<<<<<
 *                       ignore_custom_codec=False,
 *                       record_class):
 */
    values[4] = (PyObject *)((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None);

    /* "asyncpg/protocol/protocol.pyx":145
 *                       *,
 *                       PreparedStatementState state=None,
 *                       ignore_custom_codec=False,             # <<<<<<<<<<<<<<
 *                       record_class):
 *         if self.cancel_waiter is not None:
 */
    values[5] = ((PyObject *)Py_False);
    if (likely(__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_stmt_name)) != 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_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare", 1, 3, 3, 1); __PYX_ERR(1, 142, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare", 1, 3, 3, 2); __PYX_ERR(1, 142, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_record_class)) != 0)) kw_args--;
        else {
          __Pyx_RaiseKeywordRequired("prepare", __pyx_n_s_record_class); __PYX_ERR(1, 142, __pyx_L3_error)
        }
      }
      if (kw_args > 0 && likely(kw_args <= 2)) {
        Py_ssize_t index;
        for (index = 4; index < 6 && kw_args > 0; index++) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
          if (value) { values[index] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare") < 0)) __PYX_ERR(1, 142, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      __Pyx_RaiseKeywordRequired("prepare", __pyx_n_s_record_class); __PYX_ERR(1, 142, __pyx_L3_error)
    }
    __pyx_v_stmt_name = values[0];
    __pyx_v_query = values[1];
    __pyx_v_timeout = values[2];
    __pyx_v_record_class = values[3];
    __pyx_v_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[4]);
    __pyx_v_ignore_custom_codec = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prepare", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 142, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 144, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_10prepare(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_stmt_name, __pyx_v_query, __pyx_v_timeout, __pyx_v_state, __pyx_v_ignore_custom_codec, __pyx_v_record_class);

  /* "asyncpg/protocol/protocol.pyx":142
 * 
 *     @cython.iterable_coroutine
 *     async def prepare(self, stmt_name, query, timeout,             # <<<<<<<<<<<<<<
 *                       *,
 *                       PreparedStatementState state=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_10prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_stmt_name, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_ignore_custom_codec, PyObject *__pyx_v_record_class) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 142, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_stmt_name = __pyx_v_stmt_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stmt_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stmt_name);
  __pyx_cur_scope->__pyx_v_query = __pyx_v_query;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_ignore_custom_codec = __pyx_v_ignore_custom_codec;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ignore_custom_codec);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ignore_custom_codec);
  __pyx_cur_scope->__pyx_v_record_class = __pyx_v_record_class;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_record_class);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_record_class);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_12generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_prepare, __pyx_n_s_BaseProtocol_prepare, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 142, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prepare", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L29_resume_from_await;
    case 4: goto __pyx_L32_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 142, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":147
 *                       ignore_custom_codec=False,
 *                       record_class):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":148
 *                       record_class):
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 148, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 148, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":147
 *                       ignore_custom_codec=False,
 *                       record_class):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":149
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":150
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 150, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 150, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":151
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":149
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":153
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         timeout = self._get_timeout_impl(timeout)
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":154
 * 
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":156
 *         timeout = self._get_timeout_impl(timeout)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._prepare(stmt_name, query)  # network op
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":157
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":158
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._prepare(stmt_name, query)  # network op             # <<<<<<<<<<<<<<
 *             self.last_query = query
 *             if state is None:
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_stmt_name))||((__pyx_cur_scope->__pyx_v_stmt_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_stmt_name)->tp_name), 0))) __PYX_ERR(1, 158, __pyx_L11_error)
        if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_query))||((__pyx_cur_scope->__pyx_v_query) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_query)->tp_name), 0))) __PYX_ERR(1, 158, __pyx_L11_error)
        __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._prepare(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_cur_scope->__pyx_v_stmt_name), ((PyObject*)__pyx_cur_scope->__pyx_v_query)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 158, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":159
 *         try:
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query             # <<<<<<<<<<<<<<
 *             if state is None:
 *                 state = PreparedStatementState(
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_query))||((__pyx_cur_scope->__pyx_v_query) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_query)->tp_name), 0))) __PYX_ERR(1, 159, __pyx_L11_error)
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_query;
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":160
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query
 *             if state is None:             # <<<<<<<<<<<<<<
 *                 state = PreparedStatementState(
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 */
        __pyx_t_1 = (((PyObject *)__pyx_cur_scope->__pyx_v_state) == Py_None);
        __pyx_t_2 = (__pyx_t_1 != 0);
        if (__pyx_t_2) {

          /* "asyncpg/protocol/protocol.pyx":161
 *             self.last_query = query
 *             if state is None:
 *                 state = PreparedStatementState(             # <<<<<<<<<<<<<<
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 *             self.statement = state
 */
          __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 161, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stmt_name);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stmt_name);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_stmt_name);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query);
          PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_query);
          __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
          __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
          PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_cur_scope->__pyx_v_self));
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_record_class);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_record_class);
          PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_cur_scope->__pyx_v_record_class);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ignore_custom_codec);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ignore_custom_codec);
          PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_cur_scope->__pyx_v_ignore_custom_codec);
          __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState), __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 161, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_state, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_t_7));
          __Pyx_GIVEREF(__pyx_t_7);
          __pyx_t_7 = 0;

          /* "asyncpg/protocol/protocol.pyx":160
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query
 *             if state is None:             # <<<<<<<<<<<<<<
 *                 state = PreparedStatementState(
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 */
        }

        /* "asyncpg/protocol/protocol.pyx":163
 *                 state = PreparedStatementState(
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 *             self.statement = state             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->statement));
        __pyx_cur_scope->__pyx_v_self->statement = __pyx_cur_scope->__pyx_v_state;

        /* "asyncpg/protocol/protocol.pyx":157
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/protocol.pyx":164
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 *             self.statement = state
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(1, 164, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":165
 *             self.statement = state
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 165, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 165, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/protocol.pyx":166
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 166, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":164
 *                     stmt_name, query, self, record_class, ignore_custom_codec)
 *             self.statement = state
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L24;
          }
          __pyx_L23_error:;
          /*exception exit:*/{
            __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_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
            goto __pyx_L13_except_error;
          }
          __pyx_L24:;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":157
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._prepare(stmt_name, query)  # network op
 *             self.last_query = query
 */
      __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_L9_error;
      __pyx_L12_exception_handled:;
      __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);
      __pyx_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":168
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L29_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 168, __pyx_L1_error)
        __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_9 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 168, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_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_20, &__pyx_t_19, &__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_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_5);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L32_resume_from_await:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 168, __pyx_L31_error)
          __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_9 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 168, __pyx_L31_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L30_return;
      }
      __pyx_L30_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L31_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":142
 * 
 *     @cython.iterable_coroutine
 *     async def prepare(self, stmt_name, query, timeout,             # <<<<<<<<<<<<<<
 *                       *,
 *                       PreparedStatementState state=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_AddTraceback("prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":171
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                            str portal_name, int limit, return_extra,
 *                            timeout):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_14bind_execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_14bind_execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_portal_name = 0;
  int __pyx_v_limit;
  PyObject *__pyx_v_return_extra = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind_execute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_args,&__pyx_n_s_portal_name,&__pyx_n_s_limit,&__pyx_n_s_return_extra,&__pyx_n_s_timeout,0};
    PyObject* values[6] = {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  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_state)) != 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_args)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, 1); __PYX_ERR(1, 171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_portal_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, 2); __PYX_ERR(1, 171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_limit)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, 3); __PYX_ERR(1, 171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_extra)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, 4); __PYX_ERR(1, 171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, 5); __PYX_ERR(1, 171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bind_execute") < 0)) __PYX_ERR(1, 171, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      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);
    }
    __pyx_v_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[0]);
    __pyx_v_args = values[1];
    __pyx_v_portal_name = ((PyObject*)values[2]);
    __pyx_v_limit = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 172, __pyx_L3_error)
    __pyx_v_return_extra = values[4];
    __pyx_v_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bind_execute", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 171, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_portal_name), (&PyUnicode_Type), 1, "portal_name", 1))) __PYX_ERR(1, 172, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13bind_execute(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_state, __pyx_v_args, __pyx_v_portal_name, __pyx_v_limit, __pyx_v_return_extra, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13bind_execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, int __pyx_v_limit, PyObject *__pyx_v_return_extra, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bind_execute", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 171, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  __pyx_cur_scope->__pyx_v_portal_name = __pyx_v_portal_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_portal_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_portal_name);
  __pyx_cur_scope->__pyx_v_limit = __pyx_v_limit;
  __pyx_cur_scope->__pyx_v_return_extra = __pyx_v_return_extra;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_return_extra);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_return_extra);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_15generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_bind_execute, __pyx_n_s_BaseProtocol_bind_execute, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 171, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind_execute", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L28_resume_from_await;
    case 4: goto __pyx_L31_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 171, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":175
 *                            timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":176
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 176, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 176, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":175
 *                            timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":177
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":178
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 178, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 178, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":179
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":177
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":181
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         timeout = self._get_timeout_impl(timeout)
 *         args_buf = state._encode_bind_msg(args)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":182
 * 
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         args_buf = state._encode_bind_msg(args)
 * 
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":183
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)
 *         args_buf = state._encode_bind_msg(args)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(__pyx_cur_scope->__pyx_v_state, __pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_args_buf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":185
 *         args_buf = state._encode_bind_msg(args)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._bind_execute(
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":186
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind_execute(
 *                 portal_name,
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":189
 *             self._bind_execute(
 *                 portal_name,
 *                 state.name,             # <<<<<<<<<<<<<<
 *                 args_buf,
 *                 limit)  # network op
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->name;
        __Pyx_INCREF(__pyx_t_3);

        /* "asyncpg/protocol/protocol.pyx":190
 *                 portal_name,
 *                 state.name,
 *                 args_buf,             # <<<<<<<<<<<<<<
 *                 limit)  # network op
 * 
 */
        if (!(likely(((__pyx_cur_scope->__pyx_v_args_buf) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_args_buf, __pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer))))) __PYX_ERR(1, 190, __pyx_L11_error)

        /* "asyncpg/protocol/protocol.pyx":187
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._bind_execute(             # <<<<<<<<<<<<<<
 *                 portal_name,
 *                 state.name,
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._bind_execute(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_portal_name, ((PyObject*)__pyx_t_3), ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_args_buf), __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 187, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "asyncpg/protocol/protocol.pyx":193
 *                 limit)  # network op
 * 
 *             self.last_query = state.query             # <<<<<<<<<<<<<<
 *             self.statement = state
 *             self.return_extra = return_extra
 */
        __pyx_t_7 = __pyx_cur_scope->__pyx_v_state->query;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "asyncpg/protocol/protocol.pyx":194
 * 
 *             self.last_query = state.query
 *             self.statement = state             # <<<<<<<<<<<<<<
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 */
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->statement));
        __pyx_cur_scope->__pyx_v_self->statement = __pyx_cur_scope->__pyx_v_state;

        /* "asyncpg/protocol/protocol.pyx":195
 *             self.last_query = state.query
 *             self.statement = state
 *             self.return_extra = return_extra             # <<<<<<<<<<<<<<
 *             self.queries_count += 1
 *         except Exception as ex:
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_return_extra); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 195, __pyx_L11_error)
        __pyx_cur_scope->__pyx_v_self->return_extra = __pyx_t_1;

        /* "asyncpg/protocol/protocol.pyx":196
 *             self.statement = state
 *             self.return_extra = return_extra
 *             self.queries_count += 1             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __pyx_cur_scope->__pyx_v_self->queries_count = (__pyx_cur_scope->__pyx_v_self->queries_count + 1);

        /* "asyncpg/protocol/protocol.pyx":186
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind_execute(
 *                 portal_name,
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/protocol.pyx":197
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(1, 197, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":198
 *             self.queries_count += 1
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 198, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 198, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/protocol.pyx":199
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 199, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":197
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L23;
          }
          __pyx_L22_error:;
          /*exception exit:*/{
            __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_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
            goto __pyx_L13_except_error;
          }
          __pyx_L23:;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":186
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind_execute(
 *                 portal_name,
 */
      __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_L9_error;
      __pyx_L12_exception_handled:;
      __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);
      __pyx_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":201
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L28_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 201, __pyx_L1_error)
        __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_9 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 201, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_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_20, &__pyx_t_19, &__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_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_5);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L31_resume_from_await:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 201, __pyx_L30_error)
          __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_9 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 201, __pyx_L30_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_return;
      }
      __pyx_L29_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L30_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":171
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                            str portal_name, int limit, return_extra,
 *                            timeout):
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_AddTraceback("bind_execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":204
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute_many(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                                 str portal_name, timeout):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_portal_name = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind_execute_many (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_args,&__pyx_n_s_portal_name,&__pyx_n_s_timeout,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_state)) != 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_args)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute_many", 1, 4, 4, 1); __PYX_ERR(1, 204, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_portal_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute_many", 1, 4, 4, 2); __PYX_ERR(1, 204, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind_execute_many", 1, 4, 4, 3); __PYX_ERR(1, 204, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bind_execute_many") < 0)) __PYX_ERR(1, 204, __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_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[0]);
    __pyx_v_args = values[1];
    __pyx_v_portal_name = ((PyObject*)values[2]);
    __pyx_v_timeout = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bind_execute_many", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 204, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 204, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_portal_name), (&PyUnicode_Type), 1, "portal_name", 1))) __PYX_ERR(1, 205, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_16bind_execute_many(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_state, __pyx_v_args, __pyx_v_portal_name, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_2generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":220
 *         # this generator expression to keep the memory pressure under
 *         # control.
 *         data_gen = (state._encode_bind_msg(b) for b in args)             # <<<<<<<<<<<<<<
 *         arg_bufs = iter(data_gen)
 * 
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 220, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_2generator16, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_bind_execute_many_locals_genexpr, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_2generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 220, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) { __Pyx_RaiseClosureNameError("args"); __PYX_ERR(1, 220, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_args; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 220, __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(1, 220, __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(1, 220, __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(1, 220, __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(1, 220, __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(1, 220, __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(1, 220, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_b);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_state)) { __Pyx_RaiseClosureNameError("state"); __PYX_ERR(1, 220, __pyx_L1_error) }
    __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_state, __pyx_cur_scope->__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 220, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":204
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute_many(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                                 str portal_name, timeout):
 * 
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_16bind_execute_many(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *__pyx_cur_scope;
  PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_2generator16 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bind_execute_many", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 204, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  __pyx_cur_scope->__pyx_v_portal_name = __pyx_v_portal_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_portal_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_portal_name);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_18generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_bind_execute_many, __pyx_n_s_BaseProtocol_bind_execute_many, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 204, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XDECREF(__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_2generator16);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_18generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  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;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_t_18;
  char const *__pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  char const *__pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind_execute_many", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L33_resume_from_await;
    case 4: goto __pyx_L34_resume_from_await;
    case 5: goto __pyx_L62_resume_from_await;
    case 6: goto __pyx_L65_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 204, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":207
 *                                 str portal_name, timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":208
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 208, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 208, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":207
 *                                 str portal_name, timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":209
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":210
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 210, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 210, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":211
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":209
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":213
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         timeout = self._get_timeout_impl(timeout)
 *         timer = Timer(timeout)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":214
 * 
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         timer = Timer(timeout)
 * 
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":215
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)
 *         timer = Timer(timeout)             # <<<<<<<<<<<<<<
 * 
 *         # Make sure the argument sequence is encoded lazily with
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 215, __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_cur_scope->__pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_timer = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":220
 *         # this generator expression to keep the memory pressure under
 *         # control.
 *         data_gen = (state._encode_bind_msg(b) for b in args)             # <<<<<<<<<<<<<<
 *         arg_bufs = iter(data_gen)
 * 
 */
  __pyx_t_3 = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_data_gen = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":221
 *         # control.
 *         data_gen = (state._encode_bind_msg(b) for b in args)
 *         arg_bufs = iter(data_gen)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_data_gen); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_arg_bufs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":223
 *         arg_bufs = iter(data_gen)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             more = self._bind_execute_many(
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":224
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             more = self._bind_execute_many(
 *                 portal_name,
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":227
 *             more = self._bind_execute_many(
 *                 portal_name,
 *                 state.name,             # <<<<<<<<<<<<<<
 *                 arg_bufs)  # network op
 * 
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->name;
        __Pyx_INCREF(__pyx_t_3);

        /* "asyncpg/protocol/protocol.pyx":225
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             more = self._bind_execute_many(             # <<<<<<<<<<<<<<
 *                 portal_name,
 *                 state.name,
 */
        __pyx_cur_scope->__pyx_v_more = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._bind_execute_many(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_portal_name, ((PyObject*)__pyx_t_3), __pyx_cur_scope->__pyx_v_arg_bufs);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":230
 *                 arg_bufs)  # network op
 * 
 *             self.last_query = state.query             # <<<<<<<<<<<<<<
 *             self.statement = state
 *             self.return_extra = False
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->query;
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":231
 * 
 *             self.last_query = state.query
 *             self.statement = state             # <<<<<<<<<<<<<<
 *             self.return_extra = False
 *             self.queries_count += 1
 */
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->statement));
        __pyx_cur_scope->__pyx_v_self->statement = __pyx_cur_scope->__pyx_v_state;

        /* "asyncpg/protocol/protocol.pyx":232
 *             self.last_query = state.query
 *             self.statement = state
 *             self.return_extra = False             # <<<<<<<<<<<<<<
 *             self.queries_count += 1
 * 
 */
        __pyx_cur_scope->__pyx_v_self->return_extra = 0;

        /* "asyncpg/protocol/protocol.pyx":233
 *             self.statement = state
 *             self.return_extra = False
 *             self.queries_count += 1             # <<<<<<<<<<<<<<
 * 
 *             while more:
 */
        __pyx_cur_scope->__pyx_v_self->queries_count = (__pyx_cur_scope->__pyx_v_self->queries_count + 1);

        /* "asyncpg/protocol/protocol.pyx":235
 *             self.queries_count += 1
 * 
 *             while more:             # <<<<<<<<<<<<<<
 *                 with timer:
 *                     await asyncio.wait_for(
 */
        while (1) {
          __pyx_t_1 = (__pyx_cur_scope->__pyx_v_more != 0);
          if (!__pyx_t_1) break;

          /* "asyncpg/protocol/protocol.pyx":236
 * 
 *             while more:
 *                 with timer:             # <<<<<<<<<<<<<<
 *                     await asyncio.wait_for(
 *                         self.writing_allowed.wait(),
 */
          /*with:*/ {
            __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 236, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 236, __pyx_L19_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_3 = (__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_3)) __PYX_ERR(1, 236, __pyx_L19_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            /*try:*/ {
              {
                __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:*/ {

                  /* "asyncpg/protocol/protocol.pyx":237
 *             while more:
 *                 with timer:
 *                     await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                         self.writing_allowed.wait(),
 *                         timeout=timer.get_remaining_budget())
 */
                  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 237, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait_for); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 237, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                  /* "asyncpg/protocol/protocol.pyx":238
 *                 with timer:
 *                     await asyncio.wait_for(
 *                         self.writing_allowed.wait(),             # <<<<<<<<<<<<<<
 *                         timeout=timer.get_remaining_budget())
 *                     # On Windows the above event somehow won't allow context
 */
                  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 238, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_wait); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 238, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __pyx_t_5 = NULL;
                  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
                    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13);
                    if (likely(__pyx_t_5)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                      __Pyx_INCREF(__pyx_t_5);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_13, function);
                    }
                  }
                  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 238, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

                  /* "asyncpg/protocol/protocol.pyx":237
 *             while more:
 *                 with timer:
 *                     await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                         self.writing_allowed.wait(),
 *                         timeout=timer.get_remaining_budget())
 */
                  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 237, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_GIVEREF(__pyx_t_3);
                  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3);
                  __pyx_t_3 = 0;

                  /* "asyncpg/protocol/protocol.pyx":239
 *                     await asyncio.wait_for(
 *                         self.writing_allowed.wait(),
 *                         timeout=timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 *                     # On Windows the above event somehow won't allow context
 *                     # switch, so forcing one with sleep(0) here
 */
                  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 239, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 239, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_15 = NULL;
                  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
                    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
                    if (likely(__pyx_t_15)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                      __Pyx_INCREF(__pyx_t_15);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_14, function);
                    }
                  }
                  __pyx_t_5 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 239, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_t_5) < 0) __PYX_ERR(1, 239, __pyx_L25_error)
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                  /* "asyncpg/protocol/protocol.pyx":237
 *             while more:
 *                 with timer:
 *                     await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                         self.writing_allowed.wait(),
 *                         timeout=timer.get_remaining_budget())
 */
                  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 237, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __Pyx_XGOTREF(__pyx_r);
                  if (likely(__pyx_r)) {
                    __Pyx_XGIVEREF(__pyx_t_6);
                    __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                    __Pyx_XGIVEREF(__pyx_t_7);
                    __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                    __Pyx_XGIVEREF(__pyx_t_8);
                    __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                    __Pyx_XGIVEREF(__pyx_t_9);
                    __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
                    __Pyx_XGIVEREF(__pyx_t_10);
                    __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
                    __Pyx_XGIVEREF(__pyx_t_11);
                    __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
                    __Pyx_XGIVEREF(__pyx_t_12);
                    __pyx_cur_scope->__pyx_t_6 = __pyx_t_12;
                    __Pyx_XGIVEREF(__pyx_r);
                    __Pyx_RefNannyFinishContext();
                    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                    /* return from generator, awaiting value */
                    __pyx_generator->resume_label = 3;
                    return __pyx_r;
                    __pyx_L33_resume_from_await:;
                    __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                    __pyx_cur_scope->__pyx_t_0 = 0;
                    __Pyx_XGOTREF(__pyx_t_6);
                    __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                    __pyx_cur_scope->__pyx_t_1 = 0;
                    __Pyx_XGOTREF(__pyx_t_7);
                    __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                    __pyx_cur_scope->__pyx_t_2 = 0;
                    __Pyx_XGOTREF(__pyx_t_8);
                    __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
                    __pyx_cur_scope->__pyx_t_3 = 0;
                    __Pyx_XGOTREF(__pyx_t_9);
                    __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
                    __pyx_cur_scope->__pyx_t_4 = 0;
                    __Pyx_XGOTREF(__pyx_t_10);
                    __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
                    __pyx_cur_scope->__pyx_t_5 = 0;
                    __Pyx_XGOTREF(__pyx_t_11);
                    __pyx_t_12 = __pyx_cur_scope->__pyx_t_6;
                    __pyx_cur_scope->__pyx_t_6 = 0;
                    __Pyx_XGOTREF(__pyx_t_12);
                    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 237, __pyx_L25_error)
                  } else {
                    PyObject* exc_type = __Pyx_PyErr_Occurred();
                    if (exc_type) {
                      if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                      else __PYX_ERR(1, 237, __pyx_L25_error)
                    }
                  }

                  /* "asyncpg/protocol/protocol.pyx":242
 *                     # On Windows the above event somehow won't allow context
 *                     # switch, so forcing one with sleep(0) here
 *                     await asyncio.sleep(0)             # <<<<<<<<<<<<<<
 *                 if not timer.has_budget_greater_than(0):
 *                     raise asyncio.TimeoutError
 */
                  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 242, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sleep); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 242, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __pyx_t_3 = NULL;
                  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
                    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_13);
                    if (likely(__pyx_t_3)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                      __Pyx_INCREF(__pyx_t_3);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_13, function);
                    }
                  }
                  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_int_0);
                  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 242, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __Pyx_XGOTREF(__pyx_r);
                  if (likely(__pyx_r)) {
                    __Pyx_XGIVEREF(__pyx_t_6);
                    __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                    __Pyx_XGIVEREF(__pyx_t_7);
                    __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                    __Pyx_XGIVEREF(__pyx_t_8);
                    __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                    __Pyx_XGIVEREF(__pyx_t_9);
                    __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
                    __Pyx_XGIVEREF(__pyx_t_10);
                    __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
                    __Pyx_XGIVEREF(__pyx_t_11);
                    __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
                    __Pyx_XGIVEREF(__pyx_t_12);
                    __pyx_cur_scope->__pyx_t_6 = __pyx_t_12;
                    __Pyx_XGIVEREF(__pyx_r);
                    __Pyx_RefNannyFinishContext();
                    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                    /* return from generator, awaiting value */
                    __pyx_generator->resume_label = 4;
                    return __pyx_r;
                    __pyx_L34_resume_from_await:;
                    __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                    __pyx_cur_scope->__pyx_t_0 = 0;
                    __Pyx_XGOTREF(__pyx_t_6);
                    __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                    __pyx_cur_scope->__pyx_t_1 = 0;
                    __Pyx_XGOTREF(__pyx_t_7);
                    __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                    __pyx_cur_scope->__pyx_t_2 = 0;
                    __Pyx_XGOTREF(__pyx_t_8);
                    __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
                    __pyx_cur_scope->__pyx_t_3 = 0;
                    __Pyx_XGOTREF(__pyx_t_9);
                    __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
                    __pyx_cur_scope->__pyx_t_4 = 0;
                    __Pyx_XGOTREF(__pyx_t_10);
                    __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
                    __pyx_cur_scope->__pyx_t_5 = 0;
                    __Pyx_XGOTREF(__pyx_t_11);
                    __pyx_t_12 = __pyx_cur_scope->__pyx_t_6;
                    __pyx_cur_scope->__pyx_t_6 = 0;
                    __Pyx_XGOTREF(__pyx_t_12);
                    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 242, __pyx_L25_error)
                  } else {
                    PyObject* exc_type = __Pyx_PyErr_Occurred();
                    if (exc_type) {
                      if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                      else __PYX_ERR(1, 242, __pyx_L25_error)
                    }
                  }

                  /* "asyncpg/protocol/protocol.pyx":236
 * 
 *             while more:
 *                 with timer:             # <<<<<<<<<<<<<<
 *                     await asyncio.wait_for(
 *                         self.writing_allowed.wait(),
 */
                }
                __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_L25_error:;
                __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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;
                /*except:*/ {
                  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
                  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_13, &__pyx_t_3) < 0) __PYX_ERR(1, 236, __pyx_L27_except_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_4 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_13, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 236, __pyx_L27_except_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL);
                  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 236, __pyx_L27_except_error)
                  __Pyx_GOTREF(__pyx_t_16);
                  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_16);
                  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                  if (__pyx_t_1 < 0) __PYX_ERR(1, 236, __pyx_L27_except_error)
                  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
                  if (__pyx_t_2) {
                    __Pyx_GIVEREF(__pyx_t_5);
                    __Pyx_GIVEREF(__pyx_t_13);
                    __Pyx_XGIVEREF(__pyx_t_3);
                    __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_13, __pyx_t_3);
                    __pyx_t_5 = 0; __pyx_t_13 = 0; __pyx_t_3 = 0; 
                    __PYX_ERR(1, 236, __pyx_L27_except_error)
                  }
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                  goto __pyx_L26_exception_handled;
                }
                __pyx_L27_except_error:;
                __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_L11_error;
                __pyx_L26_exception_handled:;
                __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_L32_try_end:;
              }
            }
            /*finally:*/ {
              /*normal exit:*/{
                if (__pyx_t_9) {
                  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__48, NULL);
                  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                  if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 236, __pyx_L11_error)
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                }
                goto __pyx_L24;
              }
              __pyx_L24:;
            }
            goto __pyx_L38;
            __pyx_L19_error:;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L11_error;
            __pyx_L38:;
          }

          /* "asyncpg/protocol/protocol.pyx":243
 *                     # switch, so forcing one with sleep(0) here
 *                     await asyncio.sleep(0)
 *                 if not timer.has_budget_greater_than(0):             # <<<<<<<<<<<<<<
 *                     raise asyncio.TimeoutError
 *                 more = self._bind_execute_many_more()  # network op
 */
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_has_budget_greater_than); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 243, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
            }
          }
          __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_5, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_int_0);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 243, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 243, __pyx_L11_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_1 = ((!__pyx_t_2) != 0);
          if (unlikely(__pyx_t_1)) {

            /* "asyncpg/protocol/protocol.pyx":244
 *                     await asyncio.sleep(0)
 *                 if not timer.has_budget_greater_than(0):
 *                     raise asyncio.TimeoutError             # <<<<<<<<<<<<<<
 *                 more = self._bind_execute_many_more()  # network op
 * 
 */
            __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 244, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 244, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_Raise(__pyx_t_13, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __PYX_ERR(1, 244, __pyx_L11_error)

            /* "asyncpg/protocol/protocol.pyx":243
 *                     # switch, so forcing one with sleep(0) here
 *                     await asyncio.sleep(0)
 *                 if not timer.has_budget_greater_than(0):             # <<<<<<<<<<<<<<
 *                     raise asyncio.TimeoutError
 *                 more = self._bind_execute_many_more()  # network op
 */
          }

          /* "asyncpg/protocol/protocol.pyx":245
 *                 if not timer.has_budget_greater_than(0):
 *                     raise asyncio.TimeoutError
 *                 more = self._bind_execute_many_more()  # network op             # <<<<<<<<<<<<<<
 * 
 *         except asyncio.TimeoutError as e:
 */
          __pyx_cur_scope->__pyx_v_more = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._bind_execute_many_more(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), NULL);
        }

        /* "asyncpg/protocol/protocol.pyx":224
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             more = self._bind_execute_many(
 *                 portal_name,
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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;

      /* "asyncpg/protocol/protocol.pyx":247
 *                 more = self._bind_execute_many_more()  # network op
 * 
 *         except asyncio.TimeoutError as e:             # <<<<<<<<<<<<<<
 *             self._bind_execute_many_fail(e)  # network op
 * 
 */
      __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_3, &__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 247, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 247, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_13, __pyx_t_14);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_ErrRestore(__pyx_t_13, __pyx_t_3, __pyx_t_5);
      __pyx_t_13 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0;
      if (__pyx_t_17) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_13) < 0) __PYX_ERR(1, 247, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_e = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":248
 * 
 *         except asyncio.TimeoutError as e:
 *             self._bind_execute_many_fail(e)  # network op             # <<<<<<<<<<<<<<
 * 
 *         except Exception as ex:
 */
          __pyx_t_14 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._bind_execute_many_fail(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_e, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 248, __pyx_L45_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":247
 *                 more = self._bind_execute_many_more()  # network op
 * 
 *         except asyncio.TimeoutError as e:             # <<<<<<<<<<<<<<
 *             self._bind_execute_many_fail(e)  # network op
 * 
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e);
            __pyx_cur_scope->__pyx_v_e = NULL;
            goto __pyx_L46;
          }
          __pyx_L45_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_assign
            __pyx_t_9 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_16 = 0; __pyx_t_20 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_16, &__pyx_t_20);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_12, &__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_20);
            __pyx_t_17 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e);
              __pyx_cur_scope->__pyx_v_e = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_20);
              __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_16, __pyx_t_20);
            }
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ErrRestore(__pyx_t_9, __pyx_t_12, __pyx_t_11);
            __pyx_t_9 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_16 = 0; __pyx_t_20 = 0;
            __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19;
            goto __pyx_L13_except_error;
          }
          __pyx_L46:;
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L12_exception_handled;
      }

      /* "asyncpg/protocol/protocol.pyx":250
 *             self._bind_execute_many_fail(e)  # network op
 * 
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_18) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(1, 250, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":251
 * 
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L56_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_15 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          __pyx_t_14 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_15, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 251, __pyx_L56_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "asyncpg/protocol/protocol.pyx":252
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_14 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 252, __pyx_L56_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":250
 *             self._bind_execute_many_fail(e)  # network op
 * 
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L57;
          }
          __pyx_L56_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_assign
            __pyx_t_20 = 0; __pyx_t_16 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_9);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_16, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_16, &__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_9);
            __pyx_t_18 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_12);
              __Pyx_XGIVEREF(__pyx_t_9);
              __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_9);
            }
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_ErrRestore(__pyx_t_20, __pyx_t_16, __pyx_t_10);
            __pyx_t_20 = 0; __pyx_t_16 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_9 = 0;
            __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_21;
            goto __pyx_L13_except_error;
          }
          __pyx_L57:;
        }
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":224
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             more = self._bind_execute_many(
 *                 portal_name,
 */
      __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_L9_error;
      __pyx_L12_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_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":254
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 5;
        return __pyx_r;
        __pyx_L62_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 254, __pyx_L1_error)
        __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_5 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 254, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_9 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_12, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_t_9);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
          __Pyx_XGIVEREF(__pyx_t_11);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
          __Pyx_XGIVEREF(__pyx_t_12);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 6;
          return __pyx_r;
          __pyx_L65_resume_from_await:;
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_11);
          __pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_12);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 254, __pyx_L64_error)
          __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
        } else {
          __pyx_t_5 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 254, __pyx_L64_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L63_return;
      }
      __pyx_L63_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_12, __pyx_t_11);
      }
      __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;
      __pyx_t_9 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
      goto __pyx_L0;
      __pyx_L64_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_12, __pyx_t_11);
      }
      __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;
      __pyx_t_9 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":204
 * 
 *     @cython.iterable_coroutine
 *     async def bind_execute_many(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                                 str portal_name, timeout):
 * 
 */

  /* 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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("bind_execute_many", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_21generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":257
 * 
 *     @cython.iterable_coroutine
 *     async def bind(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                    str portal_name, timeout):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_20bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_20bind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_portal_name = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_args,&__pyx_n_s_portal_name,&__pyx_n_s_timeout,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_state)) != 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_args)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind", 1, 4, 4, 1); __PYX_ERR(1, 257, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_portal_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind", 1, 4, 4, 2); __PYX_ERR(1, 257, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bind", 1, 4, 4, 3); __PYX_ERR(1, 257, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bind") < 0)) __PYX_ERR(1, 257, __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_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[0]);
    __pyx_v_args = values[1];
    __pyx_v_portal_name = ((PyObject*)values[2]);
    __pyx_v_timeout = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bind", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 257, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 257, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_portal_name), (&PyUnicode_Type), 1, "portal_name", 1))) __PYX_ERR(1, 258, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_19bind(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_state, __pyx_v_args, __pyx_v_portal_name, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_19bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_args, PyObject *__pyx_v_portal_name, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bind", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 257, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_args = __pyx_v_args;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_args);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_args);
  __pyx_cur_scope->__pyx_v_portal_name = __pyx_v_portal_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_portal_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_portal_name);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_21generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_bind, __pyx_n_s_BaseProtocol_bind, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_21generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bind", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L28_resume_from_await;
    case 4: goto __pyx_L31_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 257, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":260
 *                    str portal_name, timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":261
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 261, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 261, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":260
 *                    str portal_name, timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":262
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":263
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 263, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 263, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":264
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":262
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":266
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         timeout = self._get_timeout_impl(timeout)
 *         args_buf = state._encode_bind_msg(args)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":267
 * 
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         args_buf = state._encode_bind_msg(args)
 * 
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":268
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)
 *         args_buf = state._encode_bind_msg(args)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg(__pyx_cur_scope->__pyx_v_state, __pyx_cur_scope->__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_args_buf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":270
 *         args_buf = state._encode_bind_msg(args)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._bind(
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":271
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind(
 *                 portal_name,
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":274
 *             self._bind(
 *                 portal_name,
 *                 state.name,             # <<<<<<<<<<<<<<
 *                 args_buf)  # network op
 * 
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->name;
        __Pyx_INCREF(__pyx_t_3);

        /* "asyncpg/protocol/protocol.pyx":275
 *                 portal_name,
 *                 state.name,
 *                 args_buf)  # network op             # <<<<<<<<<<<<<<
 * 
 *             self.last_query = state.query
 */
        if (!(likely(((__pyx_cur_scope->__pyx_v_args_buf) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_args_buf, __pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer))))) __PYX_ERR(1, 275, __pyx_L11_error)

        /* "asyncpg/protocol/protocol.pyx":272
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._bind(             # <<<<<<<<<<<<<<
 *                 portal_name,
 *                 state.name,
 */
        __pyx_t_7 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._bind(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_portal_name, ((PyObject*)__pyx_t_3), ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_args_buf)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 272, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "asyncpg/protocol/protocol.pyx":277
 *                 args_buf)  # network op
 * 
 *             self.last_query = state.query             # <<<<<<<<<<<<<<
 *             self.statement = state
 *         except Exception as ex:
 */
        __pyx_t_7 = __pyx_cur_scope->__pyx_v_state->query;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "asyncpg/protocol/protocol.pyx":278
 * 
 *             self.last_query = state.query
 *             self.statement = state             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->statement));
        __pyx_cur_scope->__pyx_v_self->statement = __pyx_cur_scope->__pyx_v_state;

        /* "asyncpg/protocol/protocol.pyx":271
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind(
 *                 portal_name,
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "asyncpg/protocol/protocol.pyx":279
 *             self.last_query = state.query
 *             self.statement = state
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(1, 279, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":280
 *             self.statement = state
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 280, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 280, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/protocol.pyx":281
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 281, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":279
 *             self.last_query = state.query
 *             self.statement = state
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L23;
          }
          __pyx_L22_error:;
          /*exception exit:*/{
            __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_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
            goto __pyx_L13_except_error;
          }
          __pyx_L23:;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":271
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._bind(
 *                 portal_name,
 */
      __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_L9_error;
      __pyx_L12_exception_handled:;
      __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);
      __pyx_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":283
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L28_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 283, __pyx_L1_error)
        __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_9 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 283, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_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_20, &__pyx_t_19, &__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_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_5);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L31_resume_from_await:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 283, __pyx_L30_error)
          __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_9 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 283, __pyx_L30_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_return;
      }
      __pyx_L29_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L30_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":257
 * 
 *     @cython.iterable_coroutine
 *     async def bind(self, PreparedStatementState state, args,             # <<<<<<<<<<<<<<
 *                    str portal_name, timeout):
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_AddTraceback("bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_24generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":286
 * 
 *     @cython.iterable_coroutine
 *     async def execute(self, PreparedStatementState state,             # <<<<<<<<<<<<<<
 *                       str portal_name, int limit, return_extra,
 *                       timeout):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_23execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_23execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_portal_name = 0;
  int __pyx_v_limit;
  PyObject *__pyx_v_return_extra = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_portal_name,&__pyx_n_s_limit,&__pyx_n_s_return_extra,&__pyx_n_s_timeout,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_state)) != 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_portal_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 5, 5, 1); __PYX_ERR(1, 286, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_limit)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 5, 5, 2); __PYX_ERR(1, 286, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_extra)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 5, 5, 3); __PYX_ERR(1, 286, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 5, 5, 4); __PYX_ERR(1, 286, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute") < 0)) __PYX_ERR(1, 286, __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_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[0]);
    __pyx_v_portal_name = ((PyObject*)values[1]);
    __pyx_v_limit = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 287, __pyx_L3_error)
    __pyx_v_return_extra = values[3];
    __pyx_v_timeout = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 286, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_portal_name), (&PyUnicode_Type), 1, "portal_name", 1))) __PYX_ERR(1, 287, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_22execute(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_state, __pyx_v_portal_name, __pyx_v_limit, __pyx_v_return_extra, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_22execute(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_portal_name, int __pyx_v_limit, PyObject *__pyx_v_return_extra, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("execute", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 286, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_portal_name = __pyx_v_portal_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_portal_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_portal_name);
  __pyx_cur_scope->__pyx_v_limit = __pyx_v_limit;
  __pyx_cur_scope->__pyx_v_return_extra = __pyx_v_return_extra;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_return_extra);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_return_extra);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_24generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_execute, __pyx_n_s_BaseProtocol_execute, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_24generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  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_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L28_resume_from_await;
    case 4: goto __pyx_L31_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 286, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":290
 *                       timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":291
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 291, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 291, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":290
 *                       timeout):
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":292
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":293
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 293, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 293, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":294
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":292
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":296
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         timeout = self._get_timeout_impl(timeout)
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":297
 * 
 *         self._check_state()
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":299
 *         timeout = self._get_timeout_impl(timeout)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._execute(
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":300
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._execute(
 *                 portal_name,
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":301
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._execute(             # <<<<<<<<<<<<<<
 *                 portal_name,
 *                 limit)  # network op
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._execute(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_portal_name, __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 301, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":305
 *                 limit)  # network op
 * 
 *             self.last_query = state.query             # <<<<<<<<<<<<<<
 *             self.statement = state
 *             self.return_extra = return_extra
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->query;
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":306
 * 
 *             self.last_query = state.query
 *             self.statement = state             # <<<<<<<<<<<<<<
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 */
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_state));
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->statement));
        __pyx_cur_scope->__pyx_v_self->statement = __pyx_cur_scope->__pyx_v_state;

        /* "asyncpg/protocol/protocol.pyx":307
 *             self.last_query = state.query
 *             self.statement = state
 *             self.return_extra = return_extra             # <<<<<<<<<<<<<<
 *             self.queries_count += 1
 *         except Exception as ex:
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_return_extra); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 307, __pyx_L11_error)
        __pyx_cur_scope->__pyx_v_self->return_extra = __pyx_t_1;

        /* "asyncpg/protocol/protocol.pyx":308
 *             self.statement = state
 *             self.return_extra = return_extra
 *             self.queries_count += 1             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __pyx_cur_scope->__pyx_v_self->queries_count = (__pyx_cur_scope->__pyx_v_self->queries_count + 1);

        /* "asyncpg/protocol/protocol.pyx":300
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._execute(
 *                 portal_name,
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asyncpg/protocol/protocol.pyx":309
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_7) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(1, 309, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_8;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":310
 *             self.queries_count += 1
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 310, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 310, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/protocol.pyx":311
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 311, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":309
 *             self.return_extra = return_extra
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L23;
          }
          __pyx_L22_error:;
          /*exception exit:*/{
            __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_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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_7 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_7; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
            goto __pyx_L13_except_error;
          }
          __pyx_L23:;
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":300
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._execute(
 *                 portal_name,
 */
      __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_L9_error;
      __pyx_L12_exception_handled:;
      __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);
      __pyx_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":313
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L28_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 313, __pyx_L1_error)
        __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_9 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 313, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_19, &__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_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_5);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L31_resume_from_await:;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 313, __pyx_L30_error)
          __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_9 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(1, 313, __pyx_L30_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_return;
      }
      __pyx_L29_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L30_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __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_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":286
 * 
 *     @cython.iterable_coroutine
 *     async def execute(self, PreparedStatementState state,             # <<<<<<<<<<<<<<
 *                       str portal_name, int limit, return_extra,
 *                       timeout):
 */

  /* function exit code */
  __pyx_L1_error:;
  __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("execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_27generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":316
 * 
 *     @cython.iterable_coroutine
 *     async def query(self, query, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_26query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_26query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("query (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_query,&__pyx_n_s_timeout,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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_query)) != 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_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("query", 1, 2, 2, 1); __PYX_ERR(1, 316, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "query") < 0)) __PYX_ERR(1, 316, __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_query = values[0];
    __pyx_v_timeout = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("query", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 316, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_25query(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_query, __pyx_v_timeout);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_25query(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("query", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 316, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_query = __pyx_v_query;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_27generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_query, __pyx_n_s_BaseProtocol_query, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 316, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_27generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("query", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L28_resume_from_await;
    case 4: goto __pyx_L31_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 316, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":317
 *     @cython.iterable_coroutine
 *     async def query(self, query, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":318
 *     async def query(self, query, timeout):
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 318, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 318, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":317
 *     @cython.iterable_coroutine
 *     async def query(self, query, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":319
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":320
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 320, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 320, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":321
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":319
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":323
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 *         # query() needs to call _get_timeout instead of _get_timeout_impl
 *         # for consistent validation, as it is called differently from
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":327
 *         # for consistent validation, as it is called differently from
 *         # prepare/bind/execute methods.
 *         timeout = self._get_timeout(timeout)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timeout)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 327, __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_cur_scope->__pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":329
 *         timeout = self._get_timeout(timeout)
 * 
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._simple_query(query)  # network op
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":330
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._simple_query(query)  # network op
 *             self.last_query = query
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":331
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._simple_query(query)  # network op             # <<<<<<<<<<<<<<
 *             self.last_query = query
 *             self.queries_count += 1
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_query))||((__pyx_cur_scope->__pyx_v_query) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_query)->tp_name), 0))) __PYX_ERR(1, 331, __pyx_L11_error)
        __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._simple_query(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_cur_scope->__pyx_v_query)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":332
 *         try:
 *             self._simple_query(query)  # network op
 *             self.last_query = query             # <<<<<<<<<<<<<<
 *             self.queries_count += 1
 *         except Exception as ex:
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_query))||((__pyx_cur_scope->__pyx_v_query) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_query)->tp_name), 0))) __PYX_ERR(1, 332, __pyx_L11_error)
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_query;
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->last_query);
        __pyx_cur_scope->__pyx_v_self->last_query = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "asyncpg/protocol/protocol.pyx":333
 *             self._simple_query(query)  # network op
 *             self.last_query = query
 *             self.queries_count += 1             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __pyx_cur_scope->__pyx_v_self->queries_count = (__pyx_cur_scope->__pyx_v_self->queries_count + 1);

        /* "asyncpg/protocol/protocol.pyx":330
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._simple_query(query)  # network op
 *             self.last_query = query
 */
      }
      __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_L16_try_end;
      __pyx_L11_error:;
      __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;

      /* "asyncpg/protocol/protocol.pyx":334
 *             self.last_query = query
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_9) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.query", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(1, 334, __pyx_L13_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_4;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":335
 *             self.queries_count += 1
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 335, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 335, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "asyncpg/protocol/protocol.pyx":336
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_10 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 336, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":334
 *             self.last_query = query
 *             self.queries_count += 1
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L23;
          }
          __pyx_L22_error:;
          /*exception exit:*/{
            __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_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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_9 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_9; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
            goto __pyx_L13_except_error;
          }
          __pyx_L23:;
        }
        __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_L12_exception_handled;
      }
      goto __pyx_L13_except_error;
      __pyx_L13_except_error:;

      /* "asyncpg/protocol/protocol.pyx":330
 * 
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._simple_query(query)  # network op
 *             self.last_query = query
 */
      __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_L9_error;
      __pyx_L12_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_L16_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":338
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L28_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 338, __pyx_L1_error)
        __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
      } else {
        __pyx_t_5 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L31_resume_from_await:;
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 338, __pyx_L30_error)
          __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
        } else {
          __pyx_t_5 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 338, __pyx_L30_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L29_return;
      }
      __pyx_L29_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
      }
      __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;
      __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L30_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
      }
      __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;
      __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":316
 * 
 *     @cython.iterable_coroutine
 *     async def query(self, query, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_30generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":341
 * 
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_29copy_out(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_29copy_out(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_copy_stmt = 0;
  PyObject *__pyx_v_sink = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_out (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_copy_stmt,&__pyx_n_s_sink,&__pyx_n_s_timeout,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_copy_stmt)) != 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_sink)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_out", 1, 3, 3, 1); __PYX_ERR(1, 341, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_out", 1, 3, 3, 2); __PYX_ERR(1, 341, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_out") < 0)) __PYX_ERR(1, 341, __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_copy_stmt = values[0];
    __pyx_v_sink = values[1];
    __pyx_v_timeout = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_out", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 341, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_28copy_out(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_copy_stmt, __pyx_v_sink, __pyx_v_timeout);

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

/* "asyncpg/protocol/protocol.pyx":380
 *                         # Make asyncio shut up about unretrieved
 *                         # QueryCanceledError
 *                         waiter.add_done_callback(lambda f: f.exception())             # <<<<<<<<<<<<<<
 *                         raise
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_8copy_out_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_12BaseProtocol_8copy_out_lambda6 = {"lambda6", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_8copy_out_lambda6, METH_O, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_8copy_out_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f) {
  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("lambda6", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 380, __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(1, 380, __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;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":341
 * 
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_28copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt, PyObject *__pyx_v_sink, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_out", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 341, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_copy_stmt = __pyx_v_copy_stmt;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_copy_stmt);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_copy_stmt);
  __pyx_cur_scope->__pyx_v_sink = __pyx_v_sink;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sink);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sink);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_30generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_copy_out, __pyx_n_s_BaseProtocol_copy_out, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 341, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_30generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  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 = NULL;
  int __pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  char const *__pyx_t_21;
  PyObject *__pyx_t_22 = NULL;
  char const *__pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_out", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L27_resume_from_await;
    case 4: goto __pyx_L57_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 341, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":342
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":343
 *     async def copy_out(self, copy_stmt, sink, timeout):
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 343, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 343, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":342
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":344
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":345
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 345, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 345, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":346
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":344
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":348
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 * 
 *         timeout = self._get_timeout_impl(timeout)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":350
 *         self._check_state()
 * 
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         timer = Timer(timeout)
 * 
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":351
 * 
 *         timeout = self._get_timeout_impl(timeout)
 *         timer = Timer(timeout)             # <<<<<<<<<<<<<<
 * 
 *         # The copy operation is guarded by a single timeout
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 351, __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_cur_scope->__pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_timer = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":355
 *         # The copy operation is guarded by a single timeout
 *         # on the top level.
 *         waiter = self._new_waiter(timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 * 
 *         self._copy_out(copy_stmt)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 355, __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_3 = (__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_3)) __PYX_ERR(1, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/protocol.pyx":357
 *         waiter = self._new_waiter(timer.get_remaining_budget())
 * 
 *         self._copy_out(copy_stmt)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_copy_stmt))||((__pyx_cur_scope->__pyx_v_copy_stmt) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_copy_stmt)->tp_name), 0))) __PYX_ERR(1, 357, __pyx_L1_error)
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._copy_out(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_cur_scope->__pyx_v_copy_stmt)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/protocol.pyx":359
 *         self._copy_out(copy_stmt)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             while True:
 *                 self.resume_reading()
 */
  /*try:*/ {

    /* "asyncpg/protocol/protocol.pyx":360
 * 
 *         try:
 *             while True:             # <<<<<<<<<<<<<<
 *                 self.resume_reading()
 * 
 */
    while (1) {

      /* "asyncpg/protocol/protocol.pyx":361
 *         try:
 *             while True:
 *                 self.resume_reading()             # <<<<<<<<<<<<<<
 * 
 *                 with timer:
 */
      __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 361, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/protocol.pyx":363
 *                 self.resume_reading()
 * 
 *                 with timer:             # <<<<<<<<<<<<<<
 *                     buffer, done, status_msg = await waiter
 * 
 */
      /*with:*/ {
        __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 363, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 363, __pyx_L13_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_4 = (__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_4)) __PYX_ERR(1, 363, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_7);
            __Pyx_XGOTREF(__pyx_t_8);
            __Pyx_XGOTREF(__pyx_t_9);
            /*try:*/ {

              /* "asyncpg/protocol/protocol.pyx":364
 * 
 *                 with timer:
 *                     buffer, done, status_msg = await waiter             # <<<<<<<<<<<<<<
 * 
 *                 # buffer will be empty if CopyDone was received apart from
 */
              __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
              __Pyx_XGOTREF(__pyx_r);
              if (likely(__pyx_r)) {
                __Pyx_XGIVEREF(__pyx_t_6);
                __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                __Pyx_XGIVEREF(__pyx_t_7);
                __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                __Pyx_XGIVEREF(__pyx_t_8);
                __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                __Pyx_XGIVEREF(__pyx_t_9);
                __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
                __Pyx_XGIVEREF(__pyx_r);
                __Pyx_RefNannyFinishContext();
                __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                /* return from generator, awaiting value */
                __pyx_generator->resume_label = 3;
                return __pyx_r;
                __pyx_L27_resume_from_await:;
                __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                __pyx_cur_scope->__pyx_t_0 = 0;
                __Pyx_XGOTREF(__pyx_t_6);
                __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                __pyx_cur_scope->__pyx_t_1 = 0;
                __Pyx_XGOTREF(__pyx_t_7);
                __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                __pyx_cur_scope->__pyx_t_2 = 0;
                __Pyx_XGOTREF(__pyx_t_8);
                __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
                __pyx_cur_scope->__pyx_t_3 = 0;
                __Pyx_XGOTREF(__pyx_t_9);
                if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 364, __pyx_L19_error)
                __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
              } else {
                __pyx_t_4 = NULL;
                if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(1, 364, __pyx_L19_error)
                __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 != 3)) {
                  if (size > 3) __Pyx_RaiseTooManyValuesError(3);
                  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                  __PYX_ERR(1, 364, __pyx_L19_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_5 = PyTuple_GET_ITEM(sequence, 1); 
                  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); 
                } else {
                  __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
                  __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
                  __pyx_t_10 = PyList_GET_ITEM(sequence, 2); 
                }
                __Pyx_INCREF(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_10);
                #else
                __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 364, __pyx_L19_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 364, __pyx_L19_error)
                __Pyx_GOTREF(__pyx_t_5);
                __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 364, __pyx_L19_error)
                __Pyx_GOTREF(__pyx_t_10);
                #endif
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              } else {
                Py_ssize_t index = -1;
                __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 364, __pyx_L19_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
                index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L28_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_3);
                index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L28_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_5);
                index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L28_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_10);
                if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) __PYX_ERR(1, 364, __pyx_L19_error)
                __pyx_t_12 = NULL;
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                goto __pyx_L29_unpacking_done;
                __pyx_L28_unpacking_failed:;
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                __pyx_t_12 = NULL;
                if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                __PYX_ERR(1, 364, __pyx_L19_error)
                __pyx_L29_unpacking_done:;
              }
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_buffer);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_buffer, __pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_done);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_done, __pyx_t_5);
              __Pyx_GIVEREF(__pyx_t_5);
              __pyx_t_5 = 0;
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_status_msg);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_status_msg, __pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_10);
              __pyx_t_10 = 0;

              /* "asyncpg/protocol/protocol.pyx":363
 *                 self.resume_reading()
 * 
 *                 with timer:             # <<<<<<<<<<<<<<
 *                     buffer, done, status_msg = await waiter
 * 
 */
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L26_try_end;
            __pyx_L19_error:;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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;
            /*except:*/ {
              __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_5) < 0) __PYX_ERR(1, 363, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_3 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 363, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 363, __pyx_L21_except_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if (__pyx_t_1 < 0) __PYX_ERR(1, 363, __pyx_L21_except_error)
              __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
              if (__pyx_t_2) {
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_GIVEREF(__pyx_t_10);
                __Pyx_XGIVEREF(__pyx_t_5);
                __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_10, __pyx_t_5);
                __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_5 = 0; 
                __PYX_ERR(1, 363, __pyx_L21_except_error)
              }
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              goto __pyx_L20_exception_handled;
            }
            __pyx_L21_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            goto __pyx_L9_error;
            __pyx_L20_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            __pyx_L26_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_6) {
              __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__48, NULL);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 363, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            }
            goto __pyx_L18;
          }
          __pyx_L18:;
        }
        goto __pyx_L33;
        __pyx_L13_error:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L9_error;
        __pyx_L33:;
      }

      /* "asyncpg/protocol/protocol.pyx":368
 *                 # buffer will be empty if CopyDone was received apart from
 *                 # the last CopyData message.
 *                 if buffer:             # <<<<<<<<<<<<<<
 *                     try:
 *                         with timer:
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_buffer)) { __Pyx_RaiseUnboundLocalError("buffer"); __PYX_ERR(1, 368, __pyx_L9_error) }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_buffer); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 368, __pyx_L9_error)
      if (__pyx_t_2) {

        /* "asyncpg/protocol/protocol.pyx":369
 *                 # the last CopyData message.
 *                 if buffer:
 *                     try:             # <<<<<<<<<<<<<<
 *                         with timer:
 *                             await asyncio.wait_for(
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_9, &__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_8);
          /*try:*/ {

            /* "asyncpg/protocol/protocol.pyx":370
 *                 if buffer:
 *                     try:
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             await asyncio.wait_for(
 *                                 sink(buffer),
 */
            /*with:*/ {
              __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 370, __pyx_L35_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 370, __pyx_L43_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_4 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
                __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
                if (likely(__pyx_t_4)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                  __Pyx_INCREF(__pyx_t_4);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_10, function);
                }
              }
              __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 370, __pyx_L43_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              /*try:*/ {
                {
                  __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
                  __Pyx_XGOTREF(__pyx_t_13);
                  __Pyx_XGOTREF(__pyx_t_14);
                  __Pyx_XGOTREF(__pyx_t_15);
                  /*try:*/ {

                    /* "asyncpg/protocol/protocol.pyx":371
 *                     try:
 *                         with timer:
 *                             await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())
 */
                    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 371, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_5);
                    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_wait_for); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 371, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_10);
                    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                    /* "asyncpg/protocol/protocol.pyx":372
 *                         with timer:
 *                             await asyncio.wait_for(
 *                                 sink(buffer),             # <<<<<<<<<<<<<<
 *                                 timeout=timer.get_remaining_budget())
 *                     except (Exception, asyncio.CancelledError) as ex:
 */
                    if (unlikely(!__pyx_cur_scope->__pyx_v_buffer)) { __Pyx_RaiseUnboundLocalError("buffer"); __PYX_ERR(1, 372, __pyx_L49_error) }
                    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sink);
                    __pyx_t_4 = __pyx_cur_scope->__pyx_v_sink; __pyx_t_3 = NULL;
                    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_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_buffer) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_buffer);
                    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 372, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_5);
                    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

                    /* "asyncpg/protocol/protocol.pyx":371
 *                     try:
 *                         with timer:
 *                             await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())
 */
                    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 371, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_4);
                    __Pyx_GIVEREF(__pyx_t_5);
                    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
                    __pyx_t_5 = 0;

                    /* "asyncpg/protocol/protocol.pyx":373
 *                             await asyncio.wait_for(
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 *                     except (Exception, asyncio.CancelledError) as ex:
 *                         # Abort the COPY operation on any error in
 */
                    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 373, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_5);
                    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 373, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_11);
                    __pyx_t_16 = NULL;
                    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
                      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11);
                      if (likely(__pyx_t_16)) {
                        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                        __Pyx_INCREF(__pyx_t_16);
                        __Pyx_INCREF(function);
                        __Pyx_DECREF_SET(__pyx_t_11, function);
                      }
                    }
                    __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 373, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_3);
                    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_timeout, __pyx_t_3) < 0) __PYX_ERR(1, 373, __pyx_L49_error)
                    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                    /* "asyncpg/protocol/protocol.pyx":371
 *                     try:
 *                         with timer:
 *                             await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())
 */
                    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 371, __pyx_L49_error)
                    __Pyx_GOTREF(__pyx_t_3);
                    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3);
                    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                    __Pyx_XGOTREF(__pyx_r);
                    if (likely(__pyx_r)) {
                      __Pyx_XGIVEREF(__pyx_t_6);
                      __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                      __Pyx_XGIVEREF(__pyx_t_7);
                      __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                      __Pyx_XGIVEREF(__pyx_t_8);
                      __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                      __Pyx_XGIVEREF(__pyx_t_9);
                      __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
                      __Pyx_XGIVEREF(__pyx_t_13);
                      __pyx_cur_scope->__pyx_t_4 = __pyx_t_13;
                      __Pyx_XGIVEREF(__pyx_t_14);
                      __pyx_cur_scope->__pyx_t_5 = __pyx_t_14;
                      __Pyx_XGIVEREF(__pyx_t_15);
                      __pyx_cur_scope->__pyx_t_6 = __pyx_t_15;
                      __Pyx_XGIVEREF(__pyx_r);
                      __Pyx_RefNannyFinishContext();
                      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                      /* return from generator, awaiting value */
                      __pyx_generator->resume_label = 4;
                      return __pyx_r;
                      __pyx_L57_resume_from_await:;
                      __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                      __pyx_cur_scope->__pyx_t_0 = 0;
                      __Pyx_XGOTREF(__pyx_t_6);
                      __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                      __pyx_cur_scope->__pyx_t_1 = 0;
                      __Pyx_XGOTREF(__pyx_t_7);
                      __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                      __pyx_cur_scope->__pyx_t_2 = 0;
                      __Pyx_XGOTREF(__pyx_t_8);
                      __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
                      __pyx_cur_scope->__pyx_t_3 = 0;
                      __Pyx_XGOTREF(__pyx_t_9);
                      __pyx_t_13 = __pyx_cur_scope->__pyx_t_4;
                      __pyx_cur_scope->__pyx_t_4 = 0;
                      __Pyx_XGOTREF(__pyx_t_13);
                      __pyx_t_14 = __pyx_cur_scope->__pyx_t_5;
                      __pyx_cur_scope->__pyx_t_5 = 0;
                      __Pyx_XGOTREF(__pyx_t_14);
                      __pyx_t_15 = __pyx_cur_scope->__pyx_t_6;
                      __pyx_cur_scope->__pyx_t_6 = 0;
                      __Pyx_XGOTREF(__pyx_t_15);
                      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 371, __pyx_L49_error)
                    } else {
                      PyObject* exc_type = __Pyx_PyErr_Occurred();
                      if (exc_type) {
                        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                        else __PYX_ERR(1, 371, __pyx_L49_error)
                      }
                    }

                    /* "asyncpg/protocol/protocol.pyx":370
 *                 if buffer:
 *                     try:
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             await asyncio.wait_for(
 *                                 sink(buffer),
 */
                  }
                  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  goto __pyx_L56_try_end;
                  __pyx_L49_error:;
                  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;
                  /*except:*/ {
                    __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
                    if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(1, 370, __pyx_L51_except_error)
                    __Pyx_GOTREF(__pyx_t_3);
                    __Pyx_GOTREF(__pyx_t_5);
                    __Pyx_GOTREF(__pyx_t_4);
                    __pyx_t_10 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 370, __pyx_L51_except_error)
                    __Pyx_GOTREF(__pyx_t_10);
                    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL);
                    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                    if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 370, __pyx_L51_except_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_17);
                    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                    if (__pyx_t_2 < 0) __PYX_ERR(1, 370, __pyx_L51_except_error)
                    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
                    if (__pyx_t_1) {
                      __Pyx_GIVEREF(__pyx_t_3);
                      __Pyx_GIVEREF(__pyx_t_5);
                      __Pyx_XGIVEREF(__pyx_t_4);
                      __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4);
                      __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; 
                      __PYX_ERR(1, 370, __pyx_L51_except_error)
                    }
                    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                    goto __pyx_L50_exception_handled;
                  }
                  __pyx_L51_except_error:;
                  __Pyx_XGIVEREF(__pyx_t_13);
                  __Pyx_XGIVEREF(__pyx_t_14);
                  __Pyx_XGIVEREF(__pyx_t_15);
                  __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
                  goto __pyx_L35_error;
                  __pyx_L50_exception_handled:;
                  __Pyx_XGIVEREF(__pyx_t_13);
                  __Pyx_XGIVEREF(__pyx_t_14);
                  __Pyx_XGIVEREF(__pyx_t_15);
                  __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
                  __pyx_L56_try_end:;
                }
              }
              /*finally:*/ {
                /*normal exit:*/{
                  if (__pyx_t_7) {
                    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__48, NULL);
                    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                    if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 370, __pyx_L35_error)
                    __Pyx_GOTREF(__pyx_t_15);
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  }
                  goto __pyx_L48;
                }
                __pyx_L48:;
              }
              goto __pyx_L61;
              __pyx_L43_error:;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              goto __pyx_L35_error;
              __pyx_L61:;
            }

            /* "asyncpg/protocol/protocol.pyx":369
 *                 # the last CopyData message.
 *                 if buffer:
 *                     try:             # <<<<<<<<<<<<<<
 *                         with timer:
 *                             await asyncio.wait_for(
 */
          }
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L42_try_end;
          __pyx_L35_error:;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;

          /* "asyncpg/protocol/protocol.pyx":374
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())
 *                     except (Exception, asyncio.CancelledError) as ex:             # <<<<<<<<<<<<<<
 *                         # Abort the COPY operation on any error in
 *                         # output sink.
 */
          __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_3);
          __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 374, __pyx_L37_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_CancelledError); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 374, __pyx_L37_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_3);
          __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0;
          if (__pyx_t_18) {
            __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(1, 374, __pyx_L37_except_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_5);
            __pyx_cur_scope->__pyx_v_ex = __pyx_t_5;
            /*try:*/ {

              /* "asyncpg/protocol/protocol.pyx":377
 *                         # Abort the COPY operation on any error in
 *                         # output sink.
 *                         self._request_cancel()             # <<<<<<<<<<<<<<
 *                         # Make asyncio shut up about unretrieved
 *                         # QueryCanceledError
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_request_cancel); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 377, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_16 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
                __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_10);
                if (likely(__pyx_t_16)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                  __Pyx_INCREF(__pyx_t_16);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_10, function);
                }
              }
              __pyx_t_11 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 377, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

              /* "asyncpg/protocol/protocol.pyx":380
 *                         # Make asyncio shut up about unretrieved
 *                         # QueryCanceledError
 *                         waiter.add_done_callback(lambda f: f.exception())             # <<<<<<<<<<<<<<
 *                         raise
 * 
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 380, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_16 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_12BaseProtocol_8copy_out_lambda6, 0, __pyx_n_s_copy_out_locals_lambda, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 380, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_19 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
                __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_10);
                if (likely(__pyx_t_19)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                  __Pyx_INCREF(__pyx_t_19);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_10, function);
                }
              }
              __pyx_t_11 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_19, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_16);
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 380, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

              /* "asyncpg/protocol/protocol.pyx":381
 *                         # QueryCanceledError
 *                         waiter.add_done_callback(lambda f: f.exception())
 *                         raise             # <<<<<<<<<<<<<<
 * 
 *                 # done will be True upon receipt of CopyDone.
 */
              __Pyx_GIVEREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_5);
              __Pyx_XGIVEREF(__pyx_t_4);
              __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_5, __pyx_t_4);
              __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; 
              __PYX_ERR(1, 381, __pyx_L67_error)
            }

            /* "asyncpg/protocol/protocol.pyx":374
 *                                 sink(buffer),
 *                                 timeout=timer.get_remaining_budget())
 *                     except (Exception, asyncio.CancelledError) as ex:             # <<<<<<<<<<<<<<
 *                         # Abort the COPY operation on any error in
 *                         # output sink.
 */
            /*finally:*/ {
              __pyx_L67_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_assign
                __pyx_t_7 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_22 = 0;
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_17, &__pyx_t_22);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_15, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_15, &__pyx_t_14);
                __Pyx_XGOTREF(__pyx_t_7);
                __Pyx_XGOTREF(__pyx_t_15);
                __Pyx_XGOTREF(__pyx_t_14);
                __Pyx_XGOTREF(__pyx_t_13);
                __Pyx_XGOTREF(__pyx_t_17);
                __Pyx_XGOTREF(__pyx_t_22);
                __pyx_t_18 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
                {
                  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
                  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
                  __pyx_cur_scope->__pyx_v_ex = NULL;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_13);
                  __Pyx_XGIVEREF(__pyx_t_17);
                  __Pyx_XGIVEREF(__pyx_t_22);
                  __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_17, __pyx_t_22);
                }
                __Pyx_XGIVEREF(__pyx_t_7);
                __Pyx_XGIVEREF(__pyx_t_15);
                __Pyx_XGIVEREF(__pyx_t_14);
                __Pyx_ErrRestore(__pyx_t_7, __pyx_t_15, __pyx_t_14);
                __pyx_t_7 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_22 = 0;
                __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
                goto __pyx_L37_except_error;
              }
            }
          }
          goto __pyx_L37_except_error;
          __pyx_L37_except_error:;

          /* "asyncpg/protocol/protocol.pyx":369
 *                 # the last CopyData message.
 *                 if buffer:
 *                     try:             # <<<<<<<<<<<<<<
 *                         with timer:
 *                             await asyncio.wait_for(
 */
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_9, __pyx_t_8);
          goto __pyx_L9_error;
          __pyx_L42_try_end:;
        }

        /* "asyncpg/protocol/protocol.pyx":368
 *                 # buffer will be empty if CopyDone was received apart from
 *                 # the last CopyData message.
 *                 if buffer:             # <<<<<<<<<<<<<<
 *                     try:
 *                         with timer:
 */
      }

      /* "asyncpg/protocol/protocol.pyx":384
 * 
 *                 # done will be True upon receipt of CopyDone.
 *                 if done:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_done)) { __Pyx_RaiseUnboundLocalError("done"); __PYX_ERR(1, 384, __pyx_L9_error) }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_done); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 384, __pyx_L9_error)
      if (__pyx_t_1) {

        /* "asyncpg/protocol/protocol.pyx":385
 *                 # done will be True upon receipt of CopyDone.
 *                 if done:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 waiter = self._new_waiter(timer.get_remaining_budget())
 */
        goto __pyx_L12_break;

        /* "asyncpg/protocol/protocol.pyx":384
 * 
 *                 # done will be True upon receipt of CopyDone.
 *                 if done:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
      }

      /* "asyncpg/protocol/protocol.pyx":387
 *                     break
 * 
 *                 waiter = self._new_waiter(timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 387, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 387, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 387, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_waiter);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_waiter, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L12_break:;
  }

  /* "asyncpg/protocol/protocol.pyx":390
 * 
 *         finally:
 *             self.resume_reading()             # <<<<<<<<<<<<<<
 * 
 *         return status_msg
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_5 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L10;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_6 = 0; __pyx_t_22 = 0; __pyx_t_17 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_17, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_20 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_23 = __pyx_filename;
      {
        __pyx_t_5 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 390, __pyx_L75_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_17, __pyx_t_13);
      }
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_6);
      __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_6 = 0; __pyx_t_22 = 0; __pyx_t_17 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_20; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_23;
      goto __pyx_L1_error;
      __pyx_L75_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_17, __pyx_t_13);
      }
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_22 = 0; __pyx_t_17 = 0; __pyx_t_13 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L10:;
  }

  /* "asyncpg/protocol/protocol.pyx":392
 *             self.resume_reading()
 * 
 *         return status_msg             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_status_msg)) { __Pyx_RaiseUnboundLocalError("status_msg"); __PYX_ERR(1, 392, __pyx_L1_error) }
  __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_cur_scope->__pyx_v_status_msg);
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":341
 * 
 *     @cython.iterable_coroutine
 *     async def copy_out(self, copy_stmt, sink, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_33generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":395
 * 
 *     @cython.iterable_coroutine
 *     async def copy_in(self, copy_stmt, reader, data,             # <<<<<<<<<<<<<<
 *                       records, PreparedStatementState record_stmt, timeout):
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_32copy_in(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_32copy_in(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_copy_stmt = 0;
  PyObject *__pyx_v_reader = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_records = 0;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_record_stmt = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_in (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_copy_stmt,&__pyx_n_s_reader,&__pyx_n_s_data,&__pyx_n_s_records,&__pyx_n_s_record_stmt,&__pyx_n_s_timeout,0};
    PyObject* values[6] = {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  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_copy_stmt)) != 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_reader)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, 1); __PYX_ERR(1, 395, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, 2); __PYX_ERR(1, 395, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_records)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, 3); __PYX_ERR(1, 395, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_record_stmt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, 4); __PYX_ERR(1, 395, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, 5); __PYX_ERR(1, 395, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_in") < 0)) __PYX_ERR(1, 395, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      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);
    }
    __pyx_v_copy_stmt = values[0];
    __pyx_v_reader = values[1];
    __pyx_v_data = values[2];
    __pyx_v_records = values[3];
    __pyx_v_record_stmt = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[4]);
    __pyx_v_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_in", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 395, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record_stmt), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "record_stmt", 0))) __PYX_ERR(1, 396, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_31copy_in(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_copy_stmt, __pyx_v_reader, __pyx_v_data, __pyx_v_records, __pyx_v_record_stmt, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":524
 *             self._request_cancel()
 *             # Make asyncio shut up about unretrieved QueryCanceledError
 *             waiter.add_done_callback(lambda f: f.exception())             # <<<<<<<<<<<<<<
 *             raise
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7copy_in_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_12BaseProtocol_7copy_in_lambda7 = {"lambda7", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7copy_in_lambda7, METH_O, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7copy_in_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f) {
  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("lambda7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 524, __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(1, 524, __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;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":395
 * 
 *     @cython.iterable_coroutine
 *     async def copy_in(self, copy_stmt, reader, data,             # <<<<<<<<<<<<<<
 *                       records, PreparedStatementState record_stmt, timeout):
 *         cdef:
 */

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_31copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_copy_stmt, PyObject *__pyx_v_reader, PyObject *__pyx_v_data, PyObject *__pyx_v_records, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_record_stmt, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_in", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 395, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_copy_stmt = __pyx_v_copy_stmt;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_copy_stmt);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_copy_stmt);
  __pyx_cur_scope->__pyx_v_reader = __pyx_v_reader;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_reader);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reader);
  __pyx_cur_scope->__pyx_v_data = __pyx_v_data;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_data);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_data);
  __pyx_cur_scope->__pyx_v_records = __pyx_v_records;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_records);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_records);
  __pyx_cur_scope->__pyx_v_record_stmt = __pyx_v_record_stmt;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_record_stmt);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_record_stmt);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_33generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_copy_in, __pyx_n_s_BaseProtocol_copy_in, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 395, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_33generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  PyObject *__pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *(*__pyx_t_26)(PyObject *);
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  PyObject *__pyx_t_29 = NULL;
  int __pyx_t_30;
  char const *__pyx_t_31;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_in", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L23_resume_from_await;
    case 4: goto __pyx_L42_resume_from_await;
    case 5: goto __pyx_L67_resume_from_await;
    case 6: goto __pyx_L102_resume_from_await;
    case 7: goto __pyx_L121_resume_from_await;
    case 8: goto __pyx_L126_resume_from_await;
    case 9: goto __pyx_L137_resume_from_await;
    case 10: goto __pyx_L151_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 395, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":402
 *             Codec codec
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":403
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 403, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 403, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":402
 *             Codec codec
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":404
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":405
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 405, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 405, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":406
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":404
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":408
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 * 
 *         timeout = self._get_timeout_impl(timeout)
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":410
 *         self._check_state()
 * 
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         timer = Timer(timeout)
 * 
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":411
 * 
 *         timeout = self._get_timeout_impl(timeout)
 *         timer = Timer(timeout)             # <<<<<<<<<<<<<<
 * 
 *         waiter = self._new_waiter(timer.get_remaining_budget())
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __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_cur_scope->__pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_timer = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":413
 *         timer = Timer(timeout)
 * 
 *         waiter = self._new_waiter(timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 * 
 *         # Initiate COPY IN.
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 413, __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_3 = (__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_3)) __PYX_ERR(1, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/protocol.pyx":416
 * 
 *         # Initiate COPY IN.
 *         self._copy_in(copy_stmt)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_cur_scope->__pyx_v_copy_stmt))||((__pyx_cur_scope->__pyx_v_copy_stmt) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_cur_scope->__pyx_v_copy_stmt)->tp_name), 0))) __PYX_ERR(1, 416, __pyx_L1_error)
  __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._copy_in(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_cur_scope->__pyx_v_copy_stmt)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asyncpg/protocol/protocol.pyx":418
 *         self._copy_in(copy_stmt)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if record_stmt is not None:
 *                 # copy_in_records in binary mode
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/protocol.pyx":419
 * 
 *         try:
 *             if record_stmt is not None:             # <<<<<<<<<<<<<<
 *                 # copy_in_records in binary mode
 *                 wbuf = WriteBuffer.new()
 */
      __pyx_t_1 = (((PyObject *)__pyx_cur_scope->__pyx_v_record_stmt) != Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/protocol.pyx":421
 *             if record_stmt is not None:
 *                 # copy_in_records in binary mode
 *                 wbuf = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *                 # Signature
 *                 wbuf.write_bytes(_COPY_SIGNATURE)
 */
        __pyx_t_4 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 421, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_cur_scope->__pyx_v_wbuf = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":423
 *                 wbuf = WriteBuffer.new()
 *                 # Signature
 *                 wbuf.write_bytes(_COPY_SIGNATURE)             # <<<<<<<<<<<<<<
 *                 # Flags field
 *                 wbuf.write_int32(0)
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_bytes(__pyx_cur_scope->__pyx_v_wbuf, __pyx_kp_b_PGCOPY); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 423, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":425
 *                 wbuf.write_bytes(_COPY_SIGNATURE)
 *                 # Flags field
 *                 wbuf.write_int32(0)             # <<<<<<<<<<<<<<
 *                 # No header extension
 *                 wbuf.write_int32(0)
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int32(__pyx_cur_scope->__pyx_v_wbuf, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":427
 *                 wbuf.write_int32(0)
 *                 # No header extension
 *                 wbuf.write_int32(0)             # <<<<<<<<<<<<<<
 * 
 *                 record_stmt._ensure_rows_decoder()
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int32(__pyx_cur_scope->__pyx_v_wbuf, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":429
 *                 wbuf.write_int32(0)
 * 
 *                 record_stmt._ensure_rows_decoder()             # <<<<<<<<<<<<<<
 *                 codecs = record_stmt.rows_codecs
 *                 num_cols = len(codecs)
 */
        __pyx_t_4 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder(__pyx_cur_scope->__pyx_v_record_stmt); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 429, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":430
 * 
 *                 record_stmt._ensure_rows_decoder()
 *                 codecs = record_stmt.rows_codecs             # <<<<<<<<<<<<<<
 *                 num_cols = len(codecs)
 *                 settings = self.settings
 */
        __pyx_t_4 = __pyx_cur_scope->__pyx_v_record_stmt->rows_codecs;
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_cur_scope->__pyx_v_codecs = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":431
 *                 record_stmt._ensure_rows_decoder()
 *                 codecs = record_stmt.rows_codecs
 *                 num_cols = len(codecs)             # <<<<<<<<<<<<<<
 *                 settings = self.settings
 * 
 */
        if (unlikely(__pyx_cur_scope->__pyx_v_codecs == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(1, 431, __pyx_L8_error)
        }
        __pyx_t_9 = PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_codecs); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 431, __pyx_L8_error)
        __pyx_cur_scope->__pyx_v_num_cols = __pyx_t_9;

        /* "asyncpg/protocol/protocol.pyx":432
 *                 codecs = record_stmt.rows_codecs
 *                 num_cols = len(codecs)
 *                 settings = self.settings             # <<<<<<<<<<<<<<
 * 
 *                 for codec in codecs:
 */
        __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->settings);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_cur_scope->__pyx_v_settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":434
 *                 settings = self.settings
 * 
 *                 for codec in codecs:             # <<<<<<<<<<<<<<
 *                     if (not codec.has_encoder() or
 *                             codec.format != PG_FORMAT_BINARY):
 */
        if (unlikely(__pyx_cur_scope->__pyx_v_codecs == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(1, 434, __pyx_L8_error)
        }
        __pyx_t_4 = __pyx_cur_scope->__pyx_v_codecs; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
        for (;;) {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 434, __pyx_L8_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 434, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
          if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7asyncpg_8protocol_8protocol_Codec))))) __PYX_ERR(1, 434, __pyx_L8_error)
          __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_codec));
          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
          __Pyx_GIVEREF(__pyx_t_3);
          __pyx_t_3 = 0;

          /* "asyncpg/protocol/protocol.pyx":435
 * 
 *                 for codec in codecs:
 *                     if (not codec.has_encoder() or             # <<<<<<<<<<<<<<
 *                             codec.format != PG_FORMAT_BINARY):
 *                         raise apg_exc.InternalClientError(
 */
          __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder(__pyx_cur_scope->__pyx_v_codec); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 435, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 435, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_10 = ((!__pyx_t_1) != 0);
          if (!__pyx_t_10) {
          } else {
            __pyx_t_2 = __pyx_t_10;
            goto __pyx_L18_bool_binop_done;
          }

          /* "asyncpg/protocol/protocol.pyx":436
 *                 for codec in codecs:
 *                     if (not codec.has_encoder() or
 *                             codec.format != PG_FORMAT_BINARY):             # <<<<<<<<<<<<<<
 *                         raise apg_exc.InternalClientError(
 *                             'no binary format encoder for '
 */
          __pyx_t_10 = ((__pyx_cur_scope->__pyx_v_codec->format != __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_BINARY) != 0);
          __pyx_t_2 = __pyx_t_10;
          __pyx_L18_bool_binop_done:;

          /* "asyncpg/protocol/protocol.pyx":435
 * 
 *                 for codec in codecs:
 *                     if (not codec.has_encoder() or             # <<<<<<<<<<<<<<
 *                             codec.format != PG_FORMAT_BINARY):
 *                         raise apg_exc.InternalClientError(
 */
          if (unlikely(__pyx_t_2)) {

            /* "asyncpg/protocol/protocol.pyx":437
 *                     if (not codec.has_encoder() or
 *                             codec.format != PG_FORMAT_BINARY):
 *                         raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                             'no binary format encoder for '
 *                             'type {} (OID {})'.format(codec.name, codec.oid))
 */
            __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 437, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 437, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "asyncpg/protocol/protocol.pyx":439
 *                         raise apg_exc.InternalClientError(
 *                             'no binary format encoder for '
 *                             'type {} (OID {})'.format(codec.name, codec.oid))             # <<<<<<<<<<<<<<
 * 
 *                 if isinstance(records, collections.abc.AsyncIterable):
 */
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_no_binary_format_encoder_for_typ, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 439, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_13 = __Pyx_PyInt_From_uint32_t(__pyx_cur_scope->__pyx_v_codec->oid); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 439, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = NULL;
            __pyx_t_15 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
              if (likely(__pyx_t_14)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                __Pyx_INCREF(__pyx_t_14);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_12, function);
                __pyx_t_15 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_cur_scope->__pyx_v_codec->name, __pyx_t_13};
              __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 439, __pyx_L8_error)
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_cur_scope->__pyx_v_codec->name, __pyx_t_13};
              __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 439, __pyx_L8_error)
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            } else
            #endif
            {
              __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 439, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_16);
              if (__pyx_t_14) {
                __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
              }
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_codec->name);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_codec->name);
              PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_cur_scope->__pyx_v_codec->name);
              __Pyx_GIVEREF(__pyx_t_13);
              PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_t_13);
              __pyx_t_13 = 0;
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 439, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            }
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_11, function);
              }
            }
            __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5);
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 437, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __PYX_ERR(1, 437, __pyx_L8_error)

            /* "asyncpg/protocol/protocol.pyx":435
 * 
 *                 for codec in codecs:
 *                     if (not codec.has_encoder() or             # <<<<<<<<<<<<<<
 *                             codec.format != PG_FORMAT_BINARY):
 *                         raise apg_exc.InternalClientError(
 */
          }

          /* "asyncpg/protocol/protocol.pyx":434
 *                 settings = self.settings
 * 
 *                 for codec in codecs:             # <<<<<<<<<<<<<<
 *                     if (not codec.has_encoder() or
 *                             codec.format != PG_FORMAT_BINARY):
 */
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":441
 *                             'type {} (OID {})'.format(codec.name, codec.oid))
 * 
 *                 if isinstance(records, collections.abc.AsyncIterable):             # <<<<<<<<<<<<<<
 *                     async for row in records:
 *                         # Tuple header
 */
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 441, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 441, __pyx_L8_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_AsyncIterable); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 441, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_2 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_records, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 441, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_10 = (__pyx_t_2 != 0);
        if (__pyx_t_10) {

          /* "asyncpg/protocol/protocol.pyx":442
 * 
 *                 if isinstance(records, collections.abc.AsyncIterable):
 *                     async for row in records:             # <<<<<<<<<<<<<<
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)
 */
          __pyx_t_4 = __Pyx_Coroutine_GetAsyncIter(__pyx_cur_scope->__pyx_v_records); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 442, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          for (;;) {
            __pyx_t_3 = __Pyx_Coroutine_AsyncIterNext(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 442, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XGOTREF(__pyx_r);
            if (likely(__pyx_r)) {
              __Pyx_XGIVEREF(__pyx_t_4);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
              __Pyx_XGIVEREF(__pyx_t_6);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
              __Pyx_XGIVEREF(__pyx_t_7);
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
              __Pyx_XGIVEREF(__pyx_t_8);
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, awaiting value */
              __pyx_generator->resume_label = 3;
              return __pyx_r;
              __pyx_L23_resume_from_await:;
              __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_4);
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_6);
              __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
              __pyx_cur_scope->__pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_t_7);
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
              __pyx_cur_scope->__pyx_t_3 = 0;
              __Pyx_XGOTREF(__pyx_t_8);
              if (unlikely(!__pyx_sent_value)) {
                PyObject* exc_type = __Pyx_PyErr_Occurred();
                if (unlikely(exc_type && (exc_type == __Pyx_PyExc_StopAsyncIteration || ( exc_type != PyExc_StopIteration && exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, __Pyx_PyExc_StopAsyncIteration))))) {
                  PyErr_Clear();
                  break;
                }
                __PYX_ERR(1, 442, __pyx_L8_error)
              }
              __pyx_t_3 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_3);
            } else {
              PyObject* exc_type = __Pyx_PyErr_Occurred();
              if (unlikely(exc_type && (exc_type == __Pyx_PyExc_StopAsyncIteration || ( exc_type != PyExc_StopIteration && exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, __Pyx_PyExc_StopAsyncIteration))))) {
                PyErr_Clear();
                break;
              }
              __pyx_t_3 = NULL;
              if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_3) < 0) __PYX_ERR(1, 442, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_3);
            __pyx_t_3 = 0;

            /* "asyncpg/protocol/protocol.pyx":444
 *                     async for row in records:
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)             # <<<<<<<<<<<<<<
 *                         # Tuple data
 *                         for i in range(num_cols):
 */
            __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int16(__pyx_cur_scope->__pyx_v_wbuf, ((int16_t)__pyx_cur_scope->__pyx_v_num_cols)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 444, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "asyncpg/protocol/protocol.pyx":446
 *                         wbuf.write_int16(<int16_t>num_cols)
 *                         # Tuple data
 *                         for i in range(num_cols):             # <<<<<<<<<<<<<<
 *                             item = row[i]
 *                             if item is None:
 */
            __pyx_t_17 = __pyx_cur_scope->__pyx_v_num_cols;
            __pyx_t_18 = __pyx_t_17;
            for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
              __pyx_cur_scope->__pyx_v_i = __pyx_t_19;

              /* "asyncpg/protocol/protocol.pyx":447
 *                         # Tuple data
 *                         for i in range(num_cols):
 *                             item = row[i]             # <<<<<<<<<<<<<<
 *                             if item is None:
 *                                 wbuf.write_int32(-1)
 */
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_row, __pyx_cur_scope->__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_item);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_item, __pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":448
 *                         for i in range(num_cols):
 *                             item = row[i]
 *                             if item is None:             # <<<<<<<<<<<<<<
 *                                 wbuf.write_int32(-1)
 *                             else:
 */
              __pyx_t_10 = (__pyx_cur_scope->__pyx_v_item == Py_None);
              __pyx_t_2 = (__pyx_t_10 != 0);
              if (__pyx_t_2) {

                /* "asyncpg/protocol/protocol.pyx":449
 *                             item = row[i]
 *                             if item is None:
 *                                 wbuf.write_int32(-1)             # <<<<<<<<<<<<<<
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 */
                __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int32(__pyx_cur_scope->__pyx_v_wbuf, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 449, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                /* "asyncpg/protocol/protocol.pyx":448
 *                         for i in range(num_cols):
 *                             item = row[i]
 *                             if item is None:             # <<<<<<<<<<<<<<
 *                                 wbuf.write_int32(-1)
 *                             else:
 */
                goto __pyx_L26;
              }

              /* "asyncpg/protocol/protocol.pyx":451
 *                                 wbuf.write_int32(-1)
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)
 */
              /*else*/ {

                /* "asyncpg/protocol/protocol.pyx":452
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 *                                     codecs, i)             # <<<<<<<<<<<<<<
 *                                 codec.encode(settings, wbuf, item)
 * 
 */
                __pyx_t_20 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_codecs, __pyx_cur_scope->__pyx_v_i);

                /* "asyncpg/protocol/protocol.pyx":451
 *                                 wbuf.write_int32(-1)
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)
 */
                __pyx_t_3 = ((PyObject *)__pyx_t_20);
                __Pyx_INCREF(__pyx_t_3);
                __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_codec));
                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
                __Pyx_GIVEREF(__pyx_t_3);
                __pyx_t_3 = 0;

                /* "asyncpg/protocol/protocol.pyx":453
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)             # <<<<<<<<<<<<<<
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 */
                __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(__pyx_cur_scope->__pyx_v_codec, __pyx_cur_scope->__pyx_v_settings, __pyx_cur_scope->__pyx_v_wbuf, __pyx_cur_scope->__pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 453, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              __pyx_L26:;
            }

            /* "asyncpg/protocol/protocol.pyx":455
 *                                 codec.encode(settings, wbuf, item)
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:             # <<<<<<<<<<<<<<
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 */
            __pyx_t_3 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_cur_scope->__pyx_v_wbuf); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 455, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_11 = PyObject_RichCompare(__pyx_t_3, __pyx_int_524288, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 455, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 455, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (__pyx_t_2) {

              /* "asyncpg/protocol/protocol.pyx":456
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:             # <<<<<<<<<<<<<<
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 */
              /*with:*/ {
                __pyx_t_21 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 456, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_21);
                __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 456, __pyx_L28_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_11 = (__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_11)) __PYX_ERR(1, 456, __pyx_L28_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                /*try:*/ {
                  {
                    __Pyx_ExceptionSave(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24);
                    __Pyx_XGOTREF(__pyx_t_22);
                    __Pyx_XGOTREF(__pyx_t_23);
                    __Pyx_XGOTREF(__pyx_t_24);
                    /*try:*/ {

                      /* "asyncpg/protocol/protocol.pyx":457
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:
 *                                 await self.writing_allowed.wait()             # <<<<<<<<<<<<<<
 *                             self._write_copy_data_msg(wbuf)
 *                             wbuf = WriteBuffer.new()
 */
                      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 457, __pyx_L34_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 457, __pyx_L34_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                      __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_11 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 457, __pyx_L34_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_11);
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_XGOTREF(__pyx_r);
                      if (likely(__pyx_r)) {
                        __Pyx_XGIVEREF(__pyx_t_4);
                        __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
                        __Pyx_XGIVEREF(__pyx_t_6);
                        __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
                        __Pyx_XGIVEREF(__pyx_t_7);
                        __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
                        __Pyx_XGIVEREF(__pyx_t_8);
                        __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
                        __Pyx_XGIVEREF(__pyx_t_21);
                        __pyx_cur_scope->__pyx_t_4 = __pyx_t_21;
                        __Pyx_XGIVEREF(__pyx_t_22);
                        __pyx_cur_scope->__pyx_t_5 = __pyx_t_22;
                        __Pyx_XGIVEREF(__pyx_t_23);
                        __pyx_cur_scope->__pyx_t_6 = __pyx_t_23;
                        __Pyx_XGIVEREF(__pyx_t_24);
                        __pyx_cur_scope->__pyx_t_7 = __pyx_t_24;
                        __Pyx_XGIVEREF(__pyx_r);
                        __Pyx_RefNannyFinishContext();
                        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                        /* return from generator, awaiting value */
                        __pyx_generator->resume_label = 4;
                        return __pyx_r;
                        __pyx_L42_resume_from_await:;
                        __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
                        __pyx_cur_scope->__pyx_t_0 = 0;
                        __Pyx_XGOTREF(__pyx_t_4);
                        __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
                        __pyx_cur_scope->__pyx_t_1 = 0;
                        __Pyx_XGOTREF(__pyx_t_6);
                        __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
                        __pyx_cur_scope->__pyx_t_2 = 0;
                        __Pyx_XGOTREF(__pyx_t_7);
                        __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
                        __pyx_cur_scope->__pyx_t_3 = 0;
                        __Pyx_XGOTREF(__pyx_t_8);
                        __pyx_t_21 = __pyx_cur_scope->__pyx_t_4;
                        __pyx_cur_scope->__pyx_t_4 = 0;
                        __Pyx_XGOTREF(__pyx_t_21);
                        __pyx_t_22 = __pyx_cur_scope->__pyx_t_5;
                        __pyx_cur_scope->__pyx_t_5 = 0;
                        __Pyx_XGOTREF(__pyx_t_22);
                        __pyx_t_23 = __pyx_cur_scope->__pyx_t_6;
                        __pyx_cur_scope->__pyx_t_6 = 0;
                        __Pyx_XGOTREF(__pyx_t_23);
                        __pyx_t_24 = __pyx_cur_scope->__pyx_t_7;
                        __pyx_cur_scope->__pyx_t_7 = 0;
                        __Pyx_XGOTREF(__pyx_t_24);
                        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 457, __pyx_L34_error)
                      } else {
                        PyObject* exc_type = __Pyx_PyErr_Occurred();
                        if (exc_type) {
                          if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                          else __PYX_ERR(1, 457, __pyx_L34_error)
                        }
                      }

                      /* "asyncpg/protocol/protocol.pyx":456
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:             # <<<<<<<<<<<<<<
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 */
                    }
                    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                    goto __pyx_L41_try_end;
                    __pyx_L34_error:;
                    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                    /*except:*/ {
                      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
                      if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_5, &__pyx_t_3) < 0) __PYX_ERR(1, 456, __pyx_L36_except_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_12 = PyTuple_Pack(3, __pyx_t_11, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 456, __pyx_L36_except_error)
                      __Pyx_GOTREF(__pyx_t_12);
                      __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_12, NULL);
                      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                      if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 456, __pyx_L36_except_error)
                      __Pyx_GOTREF(__pyx_t_25);
                      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_25);
                      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
                      if (__pyx_t_2 < 0) __PYX_ERR(1, 456, __pyx_L36_except_error)
                      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
                      if (__pyx_t_10) {
                        __Pyx_GIVEREF(__pyx_t_11);
                        __Pyx_GIVEREF(__pyx_t_5);
                        __Pyx_XGIVEREF(__pyx_t_3);
                        __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_5, __pyx_t_3);
                        __pyx_t_11 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0; 
                        __PYX_ERR(1, 456, __pyx_L36_except_error)
                      }
                      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      goto __pyx_L35_exception_handled;
                    }
                    __pyx_L36_except_error:;
                    __Pyx_XGIVEREF(__pyx_t_22);
                    __Pyx_XGIVEREF(__pyx_t_23);
                    __Pyx_XGIVEREF(__pyx_t_24);
                    __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
                    goto __pyx_L8_error;
                    __pyx_L35_exception_handled:;
                    __Pyx_XGIVEREF(__pyx_t_22);
                    __Pyx_XGIVEREF(__pyx_t_23);
                    __Pyx_XGIVEREF(__pyx_t_24);
                    __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24);
                    __pyx_L41_try_end:;
                  }
                }
                /*finally:*/ {
                  /*normal exit:*/{
                    if (__pyx_t_21) {
                      __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_tuple__48, NULL);
                      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                      if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 456, __pyx_L8_error)
                      __Pyx_GOTREF(__pyx_t_24);
                      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                    }
                    goto __pyx_L33;
                  }
                  __pyx_L33:;
                }
                goto __pyx_L46;
                __pyx_L28_error:;
                __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                goto __pyx_L8_error;
                __pyx_L46:;
              }

              /* "asyncpg/protocol/protocol.pyx":458
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)             # <<<<<<<<<<<<<<
 *                             wbuf = WriteBuffer.new()
 *                 else:
 */
              __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_data_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject *)__pyx_cur_scope->__pyx_v_wbuf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 458, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":459
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 *                             wbuf = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *                 else:
 *                     for row in records:
 */
              __pyx_t_3 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 459, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_wbuf));
              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_wbuf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3));
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":455
 *                                 codec.encode(settings, wbuf, item)
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:             # <<<<<<<<<<<<<<
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 */
            }

            /* "asyncpg/protocol/protocol.pyx":442
 * 
 *                 if isinstance(records, collections.abc.AsyncIterable):
 *                     async for row in records:             # <<<<<<<<<<<<<<
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)
 */
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "asyncpg/protocol/protocol.pyx":441
 *                             'type {} (OID {})'.format(codec.name, codec.oid))
 * 
 *                 if isinstance(records, collections.abc.AsyncIterable):             # <<<<<<<<<<<<<<
 *                     async for row in records:
 *                         # Tuple header
 */
          goto __pyx_L20;
        }

        /* "asyncpg/protocol/protocol.pyx":461
 *                             wbuf = WriteBuffer.new()
 *                 else:
 *                     for row in records:             # <<<<<<<<<<<<<<
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)
 */
        /*else*/ {
          if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_records)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_records)) {
            __pyx_t_4 = __pyx_cur_scope->__pyx_v_records; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
            __pyx_t_26 = NULL;
          } else {
            __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_records); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 461, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_26 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 461, __pyx_L8_error)
          }
          for (;;) {
            if (likely(!__pyx_t_26)) {
              if (likely(PyList_CheckExact(__pyx_t_4))) {
                if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 461, __pyx_L8_error)
                #else
                __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 461, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                #endif
              } else {
                if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 461, __pyx_L8_error)
                #else
                __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 461, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                #endif
              }
            } else {
              __pyx_t_3 = __pyx_t_26(__pyx_t_4);
              if (unlikely(!__pyx_t_3)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                  else __PYX_ERR(1, 461, __pyx_L8_error)
                }
                break;
              }
              __Pyx_GOTREF(__pyx_t_3);
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_3);
            __pyx_t_3 = 0;

            /* "asyncpg/protocol/protocol.pyx":463
 *                     for row in records:
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)             # <<<<<<<<<<<<<<
 *                         # Tuple data
 *                         for i in range(num_cols):
 */
            __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int16(__pyx_cur_scope->__pyx_v_wbuf, ((int16_t)__pyx_cur_scope->__pyx_v_num_cols)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 463, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "asyncpg/protocol/protocol.pyx":465
 *                         wbuf.write_int16(<int16_t>num_cols)
 *                         # Tuple data
 *                         for i in range(num_cols):             # <<<<<<<<<<<<<<
 *                             item = row[i]
 *                             if item is None:
 */
            __pyx_t_17 = __pyx_cur_scope->__pyx_v_num_cols;
            __pyx_t_18 = __pyx_t_17;
            for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
              __pyx_cur_scope->__pyx_v_i = __pyx_t_19;

              /* "asyncpg/protocol/protocol.pyx":466
 *                         # Tuple data
 *                         for i in range(num_cols):
 *                             item = row[i]             # <<<<<<<<<<<<<<
 *                             if item is None:
 *                                 wbuf.write_int32(-1)
 */
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_row, __pyx_cur_scope->__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 466, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_item);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_item, __pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":467
 *                         for i in range(num_cols):
 *                             item = row[i]
 *                             if item is None:             # <<<<<<<<<<<<<<
 *                                 wbuf.write_int32(-1)
 *                             else:
 */
              __pyx_t_10 = (__pyx_cur_scope->__pyx_v_item == Py_None);
              __pyx_t_2 = (__pyx_t_10 != 0);
              if (__pyx_t_2) {

                /* "asyncpg/protocol/protocol.pyx":468
 *                             item = row[i]
 *                             if item is None:
 *                                 wbuf.write_int32(-1)             # <<<<<<<<<<<<<<
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 */
                __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int32(__pyx_cur_scope->__pyx_v_wbuf, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 468, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                /* "asyncpg/protocol/protocol.pyx":467
 *                         for i in range(num_cols):
 *                             item = row[i]
 *                             if item is None:             # <<<<<<<<<<<<<<
 *                                 wbuf.write_int32(-1)
 *                             else:
 */
                goto __pyx_L51;
              }

              /* "asyncpg/protocol/protocol.pyx":470
 *                                 wbuf.write_int32(-1)
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)
 */
              /*else*/ {

                /* "asyncpg/protocol/protocol.pyx":471
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 *                                     codecs, i)             # <<<<<<<<<<<<<<
 *                                 codec.encode(settings, wbuf, item)
 * 
 */
                __pyx_t_20 = PyTuple_GET_ITEM(__pyx_cur_scope->__pyx_v_codecs, __pyx_cur_scope->__pyx_v_i);

                /* "asyncpg/protocol/protocol.pyx":470
 *                                 wbuf.write_int32(-1)
 *                             else:
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)
 */
                __pyx_t_3 = ((PyObject *)__pyx_t_20);
                __Pyx_INCREF(__pyx_t_3);
                __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_codec));
                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_codec, ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)__pyx_t_3));
                __Pyx_GIVEREF(__pyx_t_3);
                __pyx_t_3 = 0;

                /* "asyncpg/protocol/protocol.pyx":472
 *                                 codec = <Codec>cpython.PyTuple_GET_ITEM(
 *                                     codecs, i)
 *                                 codec.encode(settings, wbuf, item)             # <<<<<<<<<<<<<<
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 */
                __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode(__pyx_cur_scope->__pyx_v_codec, __pyx_cur_scope->__pyx_v_settings, __pyx_cur_scope->__pyx_v_wbuf, __pyx_cur_scope->__pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 472, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              __pyx_L51:;
            }

            /* "asyncpg/protocol/protocol.pyx":474
 *                                 codec.encode(settings, wbuf, item)
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:             # <<<<<<<<<<<<<<
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 */
            __pyx_t_3 = __pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(__pyx_cur_scope->__pyx_v_wbuf); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_524288, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 474, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 474, __pyx_L8_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (__pyx_t_2) {

              /* "asyncpg/protocol/protocol.pyx":475
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:             # <<<<<<<<<<<<<<
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 */
              /*with:*/ {
                __pyx_t_21 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 475, __pyx_L8_error)
                __Pyx_GOTREF(__pyx_t_21);
                __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L53_error)
                __Pyx_GOTREF(__pyx_t_3);
                __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_5 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 475, __pyx_L53_error)
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                /*try:*/ {
                  {
                    __Pyx_ExceptionSave(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
                    __Pyx_XGOTREF(__pyx_t_24);
                    __Pyx_XGOTREF(__pyx_t_23);
                    __Pyx_XGOTREF(__pyx_t_22);
                    /*try:*/ {

                      /* "asyncpg/protocol/protocol.pyx":476
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:
 *                                 await self.writing_allowed.wait()             # <<<<<<<<<<<<<<
 *                             self._write_copy_data_msg(wbuf)
 *                             wbuf = WriteBuffer.new()
 */
                      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 476, __pyx_L59_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 476, __pyx_L59_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                      __pyx_t_3 = NULL;
                      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
                        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
                        if (likely(__pyx_t_3)) {
                          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                          __Pyx_INCREF(__pyx_t_3);
                          __Pyx_INCREF(function);
                          __Pyx_DECREF_SET(__pyx_t_11, function);
                        }
                      }
                      __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 476, __pyx_L59_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
                      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __Pyx_XGOTREF(__pyx_r);
                      if (likely(__pyx_r)) {
                        __Pyx_XGIVEREF(__pyx_t_4);
                        __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
                        __Pyx_XGIVEREF(__pyx_t_6);
                        __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
                        __Pyx_XGIVEREF(__pyx_t_7);
                        __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
                        __Pyx_XGIVEREF(__pyx_t_8);
                        __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
                        __pyx_cur_scope->__pyx_t_8 = __pyx_t_9;
                        __Pyx_XGIVEREF(__pyx_t_21);
                        __pyx_cur_scope->__pyx_t_4 = __pyx_t_21;
                        __Pyx_XGIVEREF(__pyx_t_22);
                        __pyx_cur_scope->__pyx_t_5 = __pyx_t_22;
                        __Pyx_XGIVEREF(__pyx_t_23);
                        __pyx_cur_scope->__pyx_t_6 = __pyx_t_23;
                        __Pyx_XGIVEREF(__pyx_t_24);
                        __pyx_cur_scope->__pyx_t_7 = __pyx_t_24;
                        __pyx_cur_scope->__pyx_t_9 = __pyx_t_26;
                        __Pyx_XGIVEREF(__pyx_r);
                        __Pyx_RefNannyFinishContext();
                        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                        /* return from generator, awaiting value */
                        __pyx_generator->resume_label = 5;
                        return __pyx_r;
                        __pyx_L67_resume_from_await:;
                        __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
                        __pyx_cur_scope->__pyx_t_0 = 0;
                        __Pyx_XGOTREF(__pyx_t_4);
                        __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
                        __pyx_cur_scope->__pyx_t_1 = 0;
                        __Pyx_XGOTREF(__pyx_t_6);
                        __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
                        __pyx_cur_scope->__pyx_t_2 = 0;
                        __Pyx_XGOTREF(__pyx_t_7);
                        __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
                        __pyx_cur_scope->__pyx_t_3 = 0;
                        __Pyx_XGOTREF(__pyx_t_8);
                        __pyx_t_9 = __pyx_cur_scope->__pyx_t_8;
                        __pyx_t_21 = __pyx_cur_scope->__pyx_t_4;
                        __pyx_cur_scope->__pyx_t_4 = 0;
                        __Pyx_XGOTREF(__pyx_t_21);
                        __pyx_t_22 = __pyx_cur_scope->__pyx_t_5;
                        __pyx_cur_scope->__pyx_t_5 = 0;
                        __Pyx_XGOTREF(__pyx_t_22);
                        __pyx_t_23 = __pyx_cur_scope->__pyx_t_6;
                        __pyx_cur_scope->__pyx_t_6 = 0;
                        __Pyx_XGOTREF(__pyx_t_23);
                        __pyx_t_24 = __pyx_cur_scope->__pyx_t_7;
                        __pyx_cur_scope->__pyx_t_7 = 0;
                        __Pyx_XGOTREF(__pyx_t_24);
                        __pyx_t_26 = __pyx_cur_scope->__pyx_t_9;
                        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 476, __pyx_L59_error)
                      } else {
                        PyObject* exc_type = __Pyx_PyErr_Occurred();
                        if (exc_type) {
                          if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                          else __PYX_ERR(1, 476, __pyx_L59_error)
                        }
                      }

                      /* "asyncpg/protocol/protocol.pyx":475
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:
 *                             with timer:             # <<<<<<<<<<<<<<
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 */
                    }
                    __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
                    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
                    __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
                    goto __pyx_L66_try_end;
                    __pyx_L59_error:;
                    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                    /*except:*/ {
                      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
                      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_3) < 0) __PYX_ERR(1, 475, __pyx_L61_except_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_12 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 475, __pyx_L61_except_error)
                      __Pyx_GOTREF(__pyx_t_12);
                      __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_12, NULL);
                      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                      if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 475, __pyx_L61_except_error)
                      __Pyx_GOTREF(__pyx_t_25);
                      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_25);
                      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
                      if (__pyx_t_2 < 0) __PYX_ERR(1, 475, __pyx_L61_except_error)
                      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
                      if (__pyx_t_10) {
                        __Pyx_GIVEREF(__pyx_t_5);
                        __Pyx_GIVEREF(__pyx_t_11);
                        __Pyx_XGIVEREF(__pyx_t_3);
                        __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_11, __pyx_t_3);
                        __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_3 = 0; 
                        __PYX_ERR(1, 475, __pyx_L61_except_error)
                      }
                      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      goto __pyx_L60_exception_handled;
                    }
                    __pyx_L61_except_error:;
                    __Pyx_XGIVEREF(__pyx_t_24);
                    __Pyx_XGIVEREF(__pyx_t_23);
                    __Pyx_XGIVEREF(__pyx_t_22);
                    __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
                    goto __pyx_L8_error;
                    __pyx_L60_exception_handled:;
                    __Pyx_XGIVEREF(__pyx_t_24);
                    __Pyx_XGIVEREF(__pyx_t_23);
                    __Pyx_XGIVEREF(__pyx_t_22);
                    __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22);
                    __pyx_L66_try_end:;
                  }
                }
                /*finally:*/ {
                  /*normal exit:*/{
                    if (__pyx_t_21) {
                      __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_tuple__48, NULL);
                      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                      if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 475, __pyx_L8_error)
                      __Pyx_GOTREF(__pyx_t_22);
                      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                    }
                    goto __pyx_L58;
                  }
                  __pyx_L58:;
                }
                goto __pyx_L71;
                __pyx_L53_error:;
                __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
                goto __pyx_L8_error;
                __pyx_L71:;
              }

              /* "asyncpg/protocol/protocol.pyx":477
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)             # <<<<<<<<<<<<<<
 *                             wbuf = WriteBuffer.new()
 * 
 */
              __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_data_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject *)__pyx_cur_scope->__pyx_v_wbuf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":478
 *                                 await self.writing_allowed.wait()
 *                             self._write_copy_data_msg(wbuf)
 *                             wbuf = WriteBuffer.new()             # <<<<<<<<<<<<<<
 * 
 *                 # End of binary copy.
 */
              __pyx_t_3 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new()); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 478, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_wbuf));
              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_wbuf, ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_3));
              __Pyx_GIVEREF(__pyx_t_3);
              __pyx_t_3 = 0;

              /* "asyncpg/protocol/protocol.pyx":474
 *                                 codec.encode(settings, wbuf, item)
 * 
 *                         if wbuf.len() >= _COPY_BUFFER_SIZE:             # <<<<<<<<<<<<<<
 *                             with timer:
 *                                 await self.writing_allowed.wait()
 */
            }

            /* "asyncpg/protocol/protocol.pyx":461
 *                             wbuf = WriteBuffer.new()
 *                 else:
 *                     for row in records:             # <<<<<<<<<<<<<<
 *                         # Tuple header
 *                         wbuf.write_int16(<int16_t>num_cols)
 */
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L20:;

        /* "asyncpg/protocol/protocol.pyx":481
 * 
 *                 # End of binary copy.
 *                 wbuf.write_int16(-1)             # <<<<<<<<<<<<<<
 *                 self._write_copy_data_msg(wbuf)
 * 
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_cur_scope->__pyx_v_wbuf->__pyx_vtab)->write_int16(__pyx_cur_scope->__pyx_v_wbuf, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 481, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":482
 *                 # End of binary copy.
 *                 wbuf.write_int16(-1)
 *                 self._write_copy_data_msg(wbuf)             # <<<<<<<<<<<<<<
 * 
 *             elif reader is not None:
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_data_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject *)__pyx_cur_scope->__pyx_v_wbuf)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 482, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":419
 * 
 *         try:
 *             if record_stmt is not None:             # <<<<<<<<<<<<<<
 *                 # copy_in_records in binary mode
 *                 wbuf = WriteBuffer.new()
 */
        goto __pyx_L14;
      }

      /* "asyncpg/protocol/protocol.pyx":484
 *                 self._write_copy_data_msg(wbuf)
 * 
 *             elif reader is not None:             # <<<<<<<<<<<<<<
 *                 try:
 *                     aiter = reader.__aiter__
 */
      __pyx_t_10 = (__pyx_cur_scope->__pyx_v_reader != Py_None);
      __pyx_t_2 = (__pyx_t_10 != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/protocol.pyx":485
 * 
 *             elif reader is not None:
 *                 try:             # <<<<<<<<<<<<<<
 *                     aiter = reader.__aiter__
 *                 except AttributeError:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
          __Pyx_XGOTREF(__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_23);
          /*try:*/ {

            /* "asyncpg/protocol/protocol.pyx":486
 *             elif reader is not None:
 *                 try:
 *                     aiter = reader.__aiter__             # <<<<<<<<<<<<<<
 *                 except AttributeError:
 *                     raise TypeError('reader is not an asynchronous iterable')
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_reader, __pyx_n_s_aiter); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 486, __pyx_L72_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            __pyx_cur_scope->__pyx_v_aiter = __pyx_t_4;
            __pyx_t_4 = 0;

            /* "asyncpg/protocol/protocol.pyx":485
 * 
 *             elif reader is not None:
 *                 try:             # <<<<<<<<<<<<<<
 *                     aiter = reader.__aiter__
 *                 except AttributeError:
 */
          }

          /* "asyncpg/protocol/protocol.pyx":490
 *                     raise TypeError('reader is not an asynchronous iterable')
 *                 else:
 *                     iterator = aiter()             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
          /*else:*/ {
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_aiter);
            __pyx_t_3 = __pyx_cur_scope->__pyx_v_aiter; __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_4 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 490, __pyx_L74_except_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GIVEREF(__pyx_t_4);
            __pyx_cur_scope->__pyx_v_iterator = __pyx_t_4;
            __pyx_t_4 = 0;
          }
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
          goto __pyx_L77_try_end;
          __pyx_L72_error:;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;

          /* "asyncpg/protocol/protocol.pyx":487
 *                 try:
 *                     aiter = reader.__aiter__
 *                 except AttributeError:             # <<<<<<<<<<<<<<
 *                     raise TypeError('reader is not an asynchronous iterable')
 *                 else:
 */
          __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
          if (__pyx_t_15) {
            __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_11) < 0) __PYX_ERR(1, 487, __pyx_L74_except_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_11);

            /* "asyncpg/protocol/protocol.pyx":488
 *                     aiter = reader.__aiter__
 *                 except AttributeError:
 *                     raise TypeError('reader is not an asynchronous iterable')             # <<<<<<<<<<<<<<
 *                 else:
 *                     iterator = aiter()
 */
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 488, __pyx_L74_except_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_Raise(__pyx_t_5, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __PYX_ERR(1, 488, __pyx_L74_except_error)
          }
          goto __pyx_L74_except_error;
          __pyx_L74_except_error:;

          /* "asyncpg/protocol/protocol.pyx":485
 * 
 *             elif reader is not None:
 *                 try:             # <<<<<<<<<<<<<<
 *                     aiter = reader.__aiter__
 *                 except AttributeError:
 */
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          goto __pyx_L8_error;
          __pyx_L77_try_end:;
        }

        /* "asyncpg/protocol/protocol.pyx":492
 *                     iterator = aiter()
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     while True:
 *                         # We rely on protocol flow control to moderate the
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_23);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_21);
          /*try:*/ {

            /* "asyncpg/protocol/protocol.pyx":493
 * 
 *                 try:
 *                     while True:             # <<<<<<<<<<<<<<
 *                         # We rely on protocol flow control to moderate the
 *                         # rate of data messages.
 */
            while (1) {

              /* "asyncpg/protocol/protocol.pyx":496
 *                         # We rely on protocol flow control to moderate the
 *                         # rate of data messages.
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             await self.writing_allowed.wait()
 *                         with timer:
 */
              /*with:*/ {
                __pyx_t_24 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 496, __pyx_L80_error)
                __Pyx_GOTREF(__pyx_t_24);
                __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 496, __pyx_L88_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_11 = (__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_11)) __PYX_ERR(1, 496, __pyx_L88_error)
                __Pyx_GOTREF(__pyx_t_11);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                /*try:*/ {
                  {
                    __Pyx_ExceptionSave(&__pyx_t_25, &__pyx_t_27, &__pyx_t_28);
                    __Pyx_XGOTREF(__pyx_t_25);
                    __Pyx_XGOTREF(__pyx_t_27);
                    __Pyx_XGOTREF(__pyx_t_28);
                    /*try:*/ {

                      /* "asyncpg/protocol/protocol.pyx":497
 *                         # rate of data messages.
 *                         with timer:
 *                             await self.writing_allowed.wait()             # <<<<<<<<<<<<<<
 *                         with timer:
 *                             chunk = await asyncio.wait_for(
 */
                      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 497, __pyx_L94_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 497, __pyx_L94_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_11 = (__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_11)) __PYX_ERR(1, 497, __pyx_L94_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_11);
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_XGOTREF(__pyx_r);
                      if (likely(__pyx_r)) {
                        __Pyx_XGIVEREF(__pyx_t_6);
                        __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                        __Pyx_XGIVEREF(__pyx_t_7);
                        __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                        __Pyx_XGIVEREF(__pyx_t_8);
                        __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                        __Pyx_XGIVEREF(__pyx_t_21);
                        __pyx_cur_scope->__pyx_t_3 = __pyx_t_21;
                        __Pyx_XGIVEREF(__pyx_t_22);
                        __pyx_cur_scope->__pyx_t_4 = __pyx_t_22;
                        __Pyx_XGIVEREF(__pyx_t_23);
                        __pyx_cur_scope->__pyx_t_5 = __pyx_t_23;
                        __Pyx_XGIVEREF(__pyx_t_24);
                        __pyx_cur_scope->__pyx_t_6 = __pyx_t_24;
                        __Pyx_XGIVEREF(__pyx_t_25);
                        __pyx_cur_scope->__pyx_t_7 = __pyx_t_25;
                        __Pyx_XGIVEREF(__pyx_t_27);
                        __pyx_cur_scope->__pyx_t_10 = __pyx_t_27;
                        __Pyx_XGIVEREF(__pyx_t_28);
                        __pyx_cur_scope->__pyx_t_11 = __pyx_t_28;
                        __Pyx_XGIVEREF(__pyx_r);
                        __Pyx_RefNannyFinishContext();
                        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                        /* return from generator, awaiting value */
                        __pyx_generator->resume_label = 6;
                        return __pyx_r;
                        __pyx_L102_resume_from_await:;
                        __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                        __pyx_cur_scope->__pyx_t_0 = 0;
                        __Pyx_XGOTREF(__pyx_t_6);
                        __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                        __pyx_cur_scope->__pyx_t_1 = 0;
                        __Pyx_XGOTREF(__pyx_t_7);
                        __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                        __pyx_cur_scope->__pyx_t_2 = 0;
                        __Pyx_XGOTREF(__pyx_t_8);
                        __pyx_t_21 = __pyx_cur_scope->__pyx_t_3;
                        __pyx_cur_scope->__pyx_t_3 = 0;
                        __Pyx_XGOTREF(__pyx_t_21);
                        __pyx_t_22 = __pyx_cur_scope->__pyx_t_4;
                        __pyx_cur_scope->__pyx_t_4 = 0;
                        __Pyx_XGOTREF(__pyx_t_22);
                        __pyx_t_23 = __pyx_cur_scope->__pyx_t_5;
                        __pyx_cur_scope->__pyx_t_5 = 0;
                        __Pyx_XGOTREF(__pyx_t_23);
                        __pyx_t_24 = __pyx_cur_scope->__pyx_t_6;
                        __pyx_cur_scope->__pyx_t_6 = 0;
                        __Pyx_XGOTREF(__pyx_t_24);
                        __pyx_t_25 = __pyx_cur_scope->__pyx_t_7;
                        __pyx_cur_scope->__pyx_t_7 = 0;
                        __Pyx_XGOTREF(__pyx_t_25);
                        __pyx_t_27 = __pyx_cur_scope->__pyx_t_10;
                        __pyx_cur_scope->__pyx_t_10 = 0;
                        __Pyx_XGOTREF(__pyx_t_27);
                        __pyx_t_28 = __pyx_cur_scope->__pyx_t_11;
                        __pyx_cur_scope->__pyx_t_11 = 0;
                        __Pyx_XGOTREF(__pyx_t_28);
                        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 497, __pyx_L94_error)
                      } else {
                        PyObject* exc_type = __Pyx_PyErr_Occurred();
                        if (exc_type) {
                          if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
                          else __PYX_ERR(1, 497, __pyx_L94_error)
                        }
                      }

                      /* "asyncpg/protocol/protocol.pyx":496
 *                         # We rely on protocol flow control to moderate the
 *                         # rate of data messages.
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             await self.writing_allowed.wait()
 *                         with timer:
 */
                    }
                    __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
                    __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
                    __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
                    goto __pyx_L101_try_end;
                    __pyx_L94_error:;
                    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;
                    /*except:*/ {
                      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
                      if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(1, 496, __pyx_L96_except_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_GOTREF(__pyx_t_4);
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_5 = PyTuple_Pack(3, __pyx_t_11, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 496, __pyx_L96_except_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __pyx_t_29 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_5, NULL);
                      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                      if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 496, __pyx_L96_except_error)
                      __Pyx_GOTREF(__pyx_t_29);
                      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_29);
                      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
                      if (__pyx_t_2 < 0) __PYX_ERR(1, 496, __pyx_L96_except_error)
                      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
                      if (__pyx_t_10) {
                        __Pyx_GIVEREF(__pyx_t_11);
                        __Pyx_GIVEREF(__pyx_t_4);
                        __Pyx_XGIVEREF(__pyx_t_3);
                        __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_4, __pyx_t_3);
                        __pyx_t_11 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
                        __PYX_ERR(1, 496, __pyx_L96_except_error)
                      }
                      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      goto __pyx_L95_exception_handled;
                    }
                    __pyx_L96_except_error:;
                    __Pyx_XGIVEREF(__pyx_t_25);
                    __Pyx_XGIVEREF(__pyx_t_27);
                    __Pyx_XGIVEREF(__pyx_t_28);
                    __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_27, __pyx_t_28);
                    goto __pyx_L80_error;
                    __pyx_L95_exception_handled:;
                    __Pyx_XGIVEREF(__pyx_t_25);
                    __Pyx_XGIVEREF(__pyx_t_27);
                    __Pyx_XGIVEREF(__pyx_t_28);
                    __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_27, __pyx_t_28);
                    __pyx_L101_try_end:;
                  }
                }
                /*finally:*/ {
                  /*normal exit:*/{
                    if (__pyx_t_24) {
                      __pyx_t_28 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_tuple__48, NULL);
                      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                      if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 496, __pyx_L80_error)
                      __Pyx_GOTREF(__pyx_t_28);
                      __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
                    }
                    goto __pyx_L93;
                  }
                  __pyx_L93:;
                }
                goto __pyx_L106;
                __pyx_L88_error:;
                __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                goto __pyx_L80_error;
                __pyx_L106:;
              }

              /* "asyncpg/protocol/protocol.pyx":498
 *                         with timer:
 *                             await self.writing_allowed.wait()
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             chunk = await asyncio.wait_for(
 *                                 iterator.__anext__(),
 */
              /*with:*/ {
                __pyx_t_24 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_exit); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 498, __pyx_L80_error)
                __Pyx_GOTREF(__pyx_t_24);
                __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 498, __pyx_L107_error)
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_11 = NULL;
                if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
                  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
                  if (likely(__pyx_t_11)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                    __Pyx_INCREF(__pyx_t_11);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_4, function);
                  }
                }
                __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 498, __pyx_L107_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                /*try:*/ {
                  {
                    __Pyx_ExceptionSave(&__pyx_t_28, &__pyx_t_27, &__pyx_t_25);
                    __Pyx_XGOTREF(__pyx_t_28);
                    __Pyx_XGOTREF(__pyx_t_27);
                    __Pyx_XGOTREF(__pyx_t_25);
                    /*try:*/ {

                      /* "asyncpg/protocol/protocol.pyx":499
 *                             await self.writing_allowed.wait()
 *                         with timer:
 *                             chunk = await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 iterator.__anext__(),
 *                                 timeout=timer.get_remaining_budget())
 */
                      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 499, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait_for); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 499, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_4);
                      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                      /* "asyncpg/protocol/protocol.pyx":500
 *                         with timer:
 *                             chunk = await asyncio.wait_for(
 *                                 iterator.__anext__(),             # <<<<<<<<<<<<<<
 *                                 timeout=timer.get_remaining_budget())
 *                         self._write_copy_data_msg(chunk)
 */
                      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_iterator, __pyx_n_s_anext); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 500, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __pyx_t_5 = NULL;
                      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
                        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
                        if (likely(__pyx_t_5)) {
                          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                          __Pyx_INCREF(__pyx_t_5);
                          __Pyx_INCREF(function);
                          __Pyx_DECREF_SET(__pyx_t_11, function);
                        }
                      }
                      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
                      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 500, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

                      /* "asyncpg/protocol/protocol.pyx":499
 *                             await self.writing_allowed.wait()
 *                         with timer:
 *                             chunk = await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 iterator.__anext__(),
 *                                 timeout=timer.get_remaining_budget())
 */
                      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 499, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_11);
                      __Pyx_GIVEREF(__pyx_t_3);
                      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
                      __pyx_t_3 = 0;

                      /* "asyncpg/protocol/protocol.pyx":501
 *                             chunk = await asyncio.wait_for(
 *                                 iterator.__anext__(),
 *                                 timeout=timer.get_remaining_budget())             # <<<<<<<<<<<<<<
 *                         self._write_copy_data_msg(chunk)
 *                 except builtins.StopAsyncIteration:
 */
                      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 501, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_3);
                      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_timer, __pyx_n_s_get_remaining_budget); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 501, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_12);
                      __pyx_t_16 = NULL;
                      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
                        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
                        if (likely(__pyx_t_16)) {
                          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                          __Pyx_INCREF(__pyx_t_16);
                          __Pyx_INCREF(function);
                          __Pyx_DECREF_SET(__pyx_t_12, function);
                        }
                      }
                      __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
                      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 501, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_t_5) < 0) __PYX_ERR(1, 501, __pyx_L113_error)
                      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                      /* "asyncpg/protocol/protocol.pyx":499
 *                             await self.writing_allowed.wait()
 *                         with timer:
 *                             chunk = await asyncio.wait_for(             # <<<<<<<<<<<<<<
 *                                 iterator.__anext__(),
 *                                 timeout=timer.get_remaining_budget())
 */
                      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 499, __pyx_L113_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
                      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __Pyx_XGOTREF(__pyx_r);
                      if (likely(__pyx_r)) {
                        __Pyx_XGIVEREF(__pyx_t_6);
                        __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
                        __Pyx_XGIVEREF(__pyx_t_7);
                        __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
                        __Pyx_XGIVEREF(__pyx_t_8);
                        __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
                        __Pyx_XGIVEREF(__pyx_t_21);
                        __pyx_cur_scope->__pyx_t_3 = __pyx_t_21;
                        __Pyx_XGIVEREF(__pyx_t_22);
                        __pyx_cur_scope->__pyx_t_4 = __pyx_t_22;
                        __Pyx_XGIVEREF(__pyx_t_23);
                        __pyx_cur_scope->__pyx_t_5 = __pyx_t_23;
                        __Pyx_XGIVEREF(__pyx_t_24);
                        __pyx_cur_scope->__pyx_t_6 = __pyx_t_24;
                        __Pyx_XGIVEREF(__pyx_t_25);
                        __pyx_cur_scope->__pyx_t_7 = __pyx_t_25;
                        __Pyx_XGIVEREF(__pyx_t_27);
                        __pyx_cur_scope->__pyx_t_10 = __pyx_t_27;
                        __Pyx_XGIVEREF(__pyx_t_28);
                        __pyx_cur_scope->__pyx_t_11 = __pyx_t_28;
                        __Pyx_XGIVEREF(__pyx_r);
                        __Pyx_RefNannyFinishContext();
                        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
                        /* return from generator, awaiting value */
                        __pyx_generator->resume_label = 7;
                        return __pyx_r;
                        __pyx_L121_resume_from_await:;
                        __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
                        __pyx_cur_scope->__pyx_t_0 = 0;
                        __Pyx_XGOTREF(__pyx_t_6);
                        __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
                        __pyx_cur_scope->__pyx_t_1 = 0;
                        __Pyx_XGOTREF(__pyx_t_7);
                        __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
                        __pyx_cur_scope->__pyx_t_2 = 0;
                        __Pyx_XGOTREF(__pyx_t_8);
                        __pyx_t_21 = __pyx_cur_scope->__pyx_t_3;
                        __pyx_cur_scope->__pyx_t_3 = 0;
                        __Pyx_XGOTREF(__pyx_t_21);
                        __pyx_t_22 = __pyx_cur_scope->__pyx_t_4;
                        __pyx_cur_scope->__pyx_t_4 = 0;
                        __Pyx_XGOTREF(__pyx_t_22);
                        __pyx_t_23 = __pyx_cur_scope->__pyx_t_5;
                        __pyx_cur_scope->__pyx_t_5 = 0;
                        __Pyx_XGOTREF(__pyx_t_23);
                        __pyx_t_24 = __pyx_cur_scope->__pyx_t_6;
                        __pyx_cur_scope->__pyx_t_6 = 0;
                        __Pyx_XGOTREF(__pyx_t_24);
                        __pyx_t_25 = __pyx_cur_scope->__pyx_t_7;
                        __pyx_cur_scope->__pyx_t_7 = 0;
                        __Pyx_XGOTREF(__pyx_t_25);
                        __pyx_t_27 = __pyx_cur_scope->__pyx_t_10;
                        __pyx_cur_scope->__pyx_t_10 = 0;
                        __Pyx_XGOTREF(__pyx_t_27);
                        __pyx_t_28 = __pyx_cur_scope->__pyx_t_11;
                        __pyx_cur_scope->__pyx_t_11 = 0;
                        __Pyx_XGOTREF(__pyx_t_28);
                        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 499, __pyx_L113_error)
                        __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
                      } else {
                        __pyx_t_5 = NULL;
                        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 499, __pyx_L113_error)
                        __Pyx_GOTREF(__pyx_t_5);
                      }
                      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_chunk);
                      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_chunk, __pyx_t_5);
                      __Pyx_GIVEREF(__pyx_t_5);
                      __pyx_t_5 = 0;

                      /* "asyncpg/protocol/protocol.pyx":498
 *                         with timer:
 *                             await self.writing_allowed.wait()
 *                         with timer:             # <<<<<<<<<<<<<<
 *                             chunk = await asyncio.wait_for(
 *                                 iterator.__anext__(),
 */
                    }
                    __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
                    __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
                    __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
                    goto __pyx_L120_try_end;
                    __pyx_L113_error:;
                    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;
                    /*except:*/ {
                      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
                      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_11) < 0) __PYX_ERR(1, 498, __pyx_L115_except_error)
                      __Pyx_GOTREF(__pyx_t_5);
                      __Pyx_GOTREF(__pyx_t_3);
                      __Pyx_GOTREF(__pyx_t_11);
                      __pyx_t_4 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 498, __pyx_L115_except_error)
                      __Pyx_GOTREF(__pyx_t_4);
                      __pyx_t_29 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_4, NULL);
                      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                      if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 498, __pyx_L115_except_error)
                      __Pyx_GOTREF(__pyx_t_29);
                      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_29);
                      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
                      if (__pyx_t_10 < 0) __PYX_ERR(1, 498, __pyx_L115_except_error)
                      __pyx_t_2 = ((!(__pyx_t_10 != 0)) != 0);
                      if (__pyx_t_2) {
                        __Pyx_GIVEREF(__pyx_t_5);
                        __Pyx_GIVEREF(__pyx_t_3);
                        __Pyx_XGIVEREF(__pyx_t_11);
                        __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_3, __pyx_t_11);
                        __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_11 = 0; 
                        __PYX_ERR(1, 498, __pyx_L115_except_error)
                      }
                      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
                      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                      goto __pyx_L114_exception_handled;
                    }
                    __pyx_L115_except_error:;
                    __Pyx_XGIVEREF(__pyx_t_28);
                    __Pyx_XGIVEREF(__pyx_t_27);
                    __Pyx_XGIVEREF(__pyx_t_25);
                    __Pyx_ExceptionReset(__pyx_t_28, __pyx_t_27, __pyx_t_25);
                    goto __pyx_L80_error;
                    __pyx_L114_exception_handled:;
                    __Pyx_XGIVEREF(__pyx_t_28);
                    __Pyx_XGIVEREF(__pyx_t_27);
                    __Pyx_XGIVEREF(__pyx_t_25);
                    __Pyx_ExceptionReset(__pyx_t_28, __pyx_t_27, __pyx_t_25);
                    __pyx_L120_try_end:;
                  }
                }
                /*finally:*/ {
                  /*normal exit:*/{
                    if (__pyx_t_24) {
                      __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_tuple__48, NULL);
                      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                      if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 498, __pyx_L80_error)
                      __Pyx_GOTREF(__pyx_t_25);
                      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
                    }
                    goto __pyx_L112;
                  }
                  __pyx_L112:;
                }
                goto __pyx_L125;
                __pyx_L107_error:;
                __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                goto __pyx_L80_error;
                __pyx_L125:;
              }

              /* "asyncpg/protocol/protocol.pyx":502
 *                                 iterator.__anext__(),
 *                                 timeout=timer.get_remaining_budget())
 *                         self._write_copy_data_msg(chunk)             # <<<<<<<<<<<<<<
 *                 except builtins.StopAsyncIteration:
 *                     pass
 */
              if (unlikely(!__pyx_cur_scope->__pyx_v_chunk)) { __Pyx_RaiseUnboundLocalError("chunk"); __PYX_ERR(1, 502, __pyx_L80_error) }
              __pyx_t_11 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_data_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_chunk); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 502, __pyx_L80_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }

            /* "asyncpg/protocol/protocol.pyx":492
 *                     iterator = aiter()
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     while True:
 *                         # We rely on protocol flow control to moderate the
 */
          }
          __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
          goto __pyx_L85_try_end;
          __pyx_L80_error:;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;

          /* "asyncpg/protocol/protocol.pyx":503
 *                                 timeout=timer.get_remaining_budget())
 *                         self._write_copy_data_msg(chunk)
 *                 except builtins.StopAsyncIteration:             # <<<<<<<<<<<<<<
 *                     pass
 *             else:
 */
          __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_3, &__pyx_t_5);
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_builtins); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 503, __pyx_L82_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_StopAsyncIteration); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 503, __pyx_L82_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_11, __pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_ErrRestore(__pyx_t_11, __pyx_t_3, __pyx_t_5);
          __pyx_t_11 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0;
          if (__pyx_t_15) {
            __Pyx_ErrRestore(0,0,0);
            goto __pyx_L81_exception_handled;
          }
          goto __pyx_L82_except_error;
          __pyx_L82_except_error:;

          /* "asyncpg/protocol/protocol.pyx":492
 *                     iterator = aiter()
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     while True:
 *                         # We rely on protocol flow control to moderate the
 */
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21);
          goto __pyx_L8_error;
          __pyx_L81_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21);
          __pyx_L85_try_end:;
        }

        /* "asyncpg/protocol/protocol.pyx":484
 *                 self._write_copy_data_msg(wbuf)
 * 
 *             elif reader is not None:             # <<<<<<<<<<<<<<
 *                 try:
 *                     aiter = reader.__aiter__
 */
        goto __pyx_L14;
      }

      /* "asyncpg/protocol/protocol.pyx":507
 *             else:
 *                 # Buffer passed in directly.
 *                 await self.writing_allowed.wait()             # <<<<<<<<<<<<<<
 *                 self._write_copy_data_msg(data)
 * 
 */
      /*else*/ {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 507, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wait); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 507, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 507, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 8;
          return __pyx_r;
          __pyx_L126_resume_from_await:;
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 507, __pyx_L8_error)
        } else {
          PyObject* exc_type = __Pyx_PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
            else __PYX_ERR(1, 507, __pyx_L8_error)
          }
        }

        /* "asyncpg/protocol/protocol.pyx":508
 *                 # Buffer passed in directly.
 *                 await self.writing_allowed.wait()
 *                 self._write_copy_data_msg(data)             # <<<<<<<<<<<<<<
 * 
 *         except asyncio.TimeoutError:
 */
        __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_data_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 508, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_L14:;

      /* "asyncpg/protocol/protocol.pyx":418
 *         self._copy_in(copy_stmt)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if record_stmt is not None:
 *                 # copy_in_records in binary mode
 */
    }
    __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_L13_try_end;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 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;

    /* "asyncpg/protocol/protocol.pyx":510
 *                 self._write_copy_data_msg(data)
 * 
 *         except asyncio.TimeoutError:             # <<<<<<<<<<<<<<
 *             self._write_copy_fail_msg('TimeoutError')
 *             self._on_timeout(self.waiter)
 */
    __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_11, &__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 510, __pyx_L10_except_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L10_except_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_ErrRestore(__pyx_t_5, __pyx_t_11, __pyx_t_3);
    __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_3 = 0;
    if (__pyx_t_15) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_5) < 0) __PYX_ERR(1, 510, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GOTREF(__pyx_t_5);

      /* "asyncpg/protocol/protocol.pyx":511
 * 
 *         except asyncio.TimeoutError:
 *             self._write_copy_fail_msg('TimeoutError')             # <<<<<<<<<<<<<<
 *             self._on_timeout(self.waiter)
 *             try:
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_fail_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), __pyx_n_u_TimeoutError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 511, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/protocol.pyx":512
 *         except asyncio.TimeoutError:
 *             self._write_copy_fail_msg('TimeoutError')
 *             self._on_timeout(self.waiter)             # <<<<<<<<<<<<<<
 *             try:
 *                 await waiter
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_on_timeout); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 512, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_16 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_16)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_4 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_16, __pyx_cur_scope->__pyx_v_self->waiter) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_cur_scope->__pyx_v_self->waiter);
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/protocol.pyx":513
 *             self._write_copy_fail_msg('TimeoutError')
 *             self._on_timeout(self.waiter)
 *             try:             # <<<<<<<<<<<<<<
 *                 await waiter
 *             except TimeoutError:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        __Pyx_XGOTREF(__pyx_t_21);
        __Pyx_XGOTREF(__pyx_t_22);
        __Pyx_XGOTREF(__pyx_t_23);
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":514
 *             self._on_timeout(self.waiter)
 *             try:
 *                 await waiter             # <<<<<<<<<<<<<<
 *             except TimeoutError:
 *                 raise
 */
          __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
          __Pyx_XGOTREF(__pyx_r);
          if (likely(__pyx_r)) {
            __Pyx_XGIVEREF(__pyx_t_3);
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
            __Pyx_XGIVEREF(__pyx_t_5);
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
            __Pyx_XGIVEREF(__pyx_t_6);
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
            __Pyx_XGIVEREF(__pyx_t_7);
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_7;
            __Pyx_XGIVEREF(__pyx_t_8);
            __pyx_cur_scope->__pyx_t_4 = __pyx_t_8;
            __Pyx_XGIVEREF(__pyx_t_11);
            __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
            __Pyx_XGIVEREF(__pyx_t_21);
            __pyx_cur_scope->__pyx_t_6 = __pyx_t_21;
            __Pyx_XGIVEREF(__pyx_t_22);
            __pyx_cur_scope->__pyx_t_7 = __pyx_t_22;
            __Pyx_XGIVEREF(__pyx_t_23);
            __pyx_cur_scope->__pyx_t_10 = __pyx_t_23;
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_SwapException(__pyx_generator);
            /* return from generator, awaiting value */
            __pyx_generator->resume_label = 9;
            return __pyx_r;
            __pyx_L137_resume_from_await:;
            __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
            __pyx_cur_scope->__pyx_t_0 = 0;
            __Pyx_XGOTREF(__pyx_t_3);
            __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1 = 0;
            __Pyx_XGOTREF(__pyx_t_5);
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
            __pyx_cur_scope->__pyx_t_2 = 0;
            __Pyx_XGOTREF(__pyx_t_6);
            __pyx_t_7 = __pyx_cur_scope->__pyx_t_3;
            __pyx_cur_scope->__pyx_t_3 = 0;
            __Pyx_XGOTREF(__pyx_t_7);
            __pyx_t_8 = __pyx_cur_scope->__pyx_t_4;
            __pyx_cur_scope->__pyx_t_4 = 0;
            __Pyx_XGOTREF(__pyx_t_8);
            __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
            __pyx_cur_scope->__pyx_t_5 = 0;
            __Pyx_XGOTREF(__pyx_t_11);
            __pyx_t_21 = __pyx_cur_scope->__pyx_t_6;
            __pyx_cur_scope->__pyx_t_6 = 0;
            __Pyx_XGOTREF(__pyx_t_21);
            __pyx_t_22 = __pyx_cur_scope->__pyx_t_7;
            __pyx_cur_scope->__pyx_t_7 = 0;
            __Pyx_XGOTREF(__pyx_t_22);
            __pyx_t_23 = __pyx_cur_scope->__pyx_t_10;
            __pyx_cur_scope->__pyx_t_10 = 0;
            __Pyx_XGOTREF(__pyx_t_23);
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 514, __pyx_L129_error)
          } else {
            PyObject* exc_type = __Pyx_PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
              else __PYX_ERR(1, 514, __pyx_L129_error)
            }
          }

          /* "asyncpg/protocol/protocol.pyx":513
 *             self._write_copy_fail_msg('TimeoutError')
 *             self._on_timeout(self.waiter)
 *             try:             # <<<<<<<<<<<<<<
 *                 await waiter
 *             except TimeoutError:
 */
        }

        /* "asyncpg/protocol/protocol.pyx":518
 *                 raise
 *             else:
 *                 raise apg_exc.InternalClientError('TimoutError was not raised')             # <<<<<<<<<<<<<<
 * 
 *         except (Exception, asyncio.CancelledError) as e:
 */
        /*else:*/ {
          __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 518, __pyx_L131_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 518, __pyx_L131_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_16);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_16, function);
            }
          }
          __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_12, __pyx_kp_u_TimoutError_was_not_raised) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_kp_u_TimoutError_was_not_raised);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 518, __pyx_L131_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_Raise(__pyx_t_4, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __PYX_ERR(1, 518, __pyx_L131_except_error)
        }
        __pyx_L129_error:;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":515
 *             try:
 *                 await waiter
 *             except TimeoutError:             # <<<<<<<<<<<<<<
 *                 raise
 *             else:
 */
        __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_16, &__pyx_t_12);
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 515, __pyx_L131_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_13);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_ErrRestore(__pyx_t_4, __pyx_t_16, __pyx_t_12);
        __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_12 = 0;
        if (__pyx_t_15) {
          __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_16, &__pyx_t_4) < 0) __PYX_ERR(1, 515, __pyx_L131_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GOTREF(__pyx_t_4);

          /* "asyncpg/protocol/protocol.pyx":516
 *                 await waiter
 *             except TimeoutError:
 *                 raise             # <<<<<<<<<<<<<<
 *             else:
 *                 raise apg_exc.InternalClientError('TimoutError was not raised')
 */
          __Pyx_GIVEREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_4);
          __Pyx_ErrRestoreWithState(__pyx_t_12, __pyx_t_16, __pyx_t_4);
          __pyx_t_12 = 0; __pyx_t_16 = 0; __pyx_t_4 = 0; 
          __PYX_ERR(1, 516, __pyx_L131_except_error)
        }
        goto __pyx_L131_except_error;
        __pyx_L131_except_error:;

        /* "asyncpg/protocol/protocol.pyx":513
 *             self._write_copy_fail_msg('TimeoutError')
 *             self._on_timeout(self.waiter)
 *             try:             # <<<<<<<<<<<<<<
 *                 await waiter
 *             except TimeoutError:
 */
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        goto __pyx_L10_except_error;
      }
    }

    /* "asyncpg/protocol/protocol.pyx":520
 *                 raise apg_exc.InternalClientError('TimoutError was not raised')
 * 
 *         except (Exception, asyncio.CancelledError) as e:             # <<<<<<<<<<<<<<
 *             self._write_copy_fail_msg(str(e))
 *             self._request_cancel()
 */
    __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_11, &__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 520, __pyx_L10_except_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_CancelledError); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 520, __pyx_L10_except_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_5, __pyx_t_16);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_ErrRestore(__pyx_t_5, __pyx_t_11, __pyx_t_3);
    __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_3 = 0;
    if (__pyx_t_15) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_5) < 0) __PYX_ERR(1, 520, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __pyx_cur_scope->__pyx_v_e = __pyx_t_11;
      /*try:*/ {

        /* "asyncpg/protocol/protocol.pyx":521
 * 
 *         except (Exception, asyncio.CancelledError) as e:
 *             self._write_copy_fail_msg(str(e))             # <<<<<<<<<<<<<<
 *             self._request_cancel()
 *             # Make asyncio shut up about unretrieved QueryCanceledError
 */
        __pyx_t_16 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_e); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 521, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_fail_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_t_16)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 521, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":522
 *         except (Exception, asyncio.CancelledError) as e:
 *             self._write_copy_fail_msg(str(e))
 *             self._request_cancel()             # <<<<<<<<<<<<<<
 *             # Make asyncio shut up about unretrieved QueryCanceledError
 *             waiter.add_done_callback(lambda f: f.exception())
 */
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_request_cancel); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 522, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
          }
        }
        __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_16);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 522, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":524
 *             self._request_cancel()
 *             # Make asyncio shut up about unretrieved QueryCanceledError
 *             waiter.add_done_callback(lambda f: f.exception())             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 524, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_12BaseProtocol_7copy_in_lambda7, 0, __pyx_n_s_copy_in_locals_lambda, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 524, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
          }
        }
        __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_12);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 524, __pyx_L145_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "asyncpg/protocol/protocol.pyx":525
 *             # Make asyncio shut up about unretrieved QueryCanceledError
 *             waiter.add_done_callback(lambda f: f.exception())
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         self._write_copy_done_msg()
 */
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_11, __pyx_t_5);
        __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_5 = 0; 
        __PYX_ERR(1, 525, __pyx_L145_error)
      }

      /* "asyncpg/protocol/protocol.pyx":520
 *                 raise apg_exc.InternalClientError('TimoutError was not raised')
 * 
 *         except (Exception, asyncio.CancelledError) as e:             # <<<<<<<<<<<<<<
 *             self._write_copy_fail_msg(str(e))
 *             self._request_cancel()
 */
      /*finally:*/ {
        __pyx_L145_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_assign
          __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_27 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_27);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_23);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_24);
          __Pyx_XGOTREF(__pyx_t_25);
          __Pyx_XGOTREF(__pyx_t_27);
          __pyx_t_15 = __pyx_lineno; __pyx_t_30 = __pyx_clineno; __pyx_t_31 = __pyx_filename;
          {
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e);
            __pyx_cur_scope->__pyx_v_e = NULL;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_24);
            __Pyx_XGIVEREF(__pyx_t_25);
            __Pyx_XGIVEREF(__pyx_t_27);
            __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_27);
          }
          __Pyx_XGIVEREF(__pyx_t_23);
          __Pyx_XGIVEREF(__pyx_t_22);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ErrRestore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
          __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_27 = 0;
          __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_30; __pyx_filename = __pyx_t_31;
          goto __pyx_L10_except_error;
        }
      }
    }
    goto __pyx_L10_except_error;
    __pyx_L10_except_error:;

    /* "asyncpg/protocol/protocol.pyx":418
 *         self._copy_in(copy_stmt)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if record_stmt is not None:
 *                 # copy_in_records in binary mode
 */
    __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_L13_try_end:;
  }

  /* "asyncpg/protocol/protocol.pyx":527
 *             raise
 * 
 *         self._write_copy_done_msg()             # <<<<<<<<<<<<<<
 * 
 *         status_msg = await waiter
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write_copy_done_msg(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asyncpg/protocol/protocol.pyx":529
 *         self._write_copy_done_msg()
 * 
 *         status_msg = await waiter             # <<<<<<<<<<<<<<
 * 
 *         return status_msg
 */
  __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
  __Pyx_XGOTREF(__pyx_r);
  if (likely(__pyx_r)) {
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, awaiting value */
    __pyx_generator->resume_label = 10;
    return __pyx_r;
    __pyx_L151_resume_from_await:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 529, __pyx_L1_error)
    __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
  } else {
    __pyx_t_5 = NULL;
    if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(1, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_cur_scope->__pyx_v_status_msg = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "asyncpg/protocol/protocol.pyx":531
 *         status_msg = await waiter
 * 
 *         return status_msg             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_cur_scope->__pyx_v_status_msg);
  goto __pyx_L0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":395
 * 
 *     @cython.iterable_coroutine
 *     async def copy_in(self, copy_stmt, reader, data,             # <<<<<<<<<<<<<<
 *                       records, PreparedStatementState record_stmt, timeout):
 *         cdef:
 */

  /* 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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_36generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":534
 * 
 *     @cython.iterable_coroutine
 *     async def close_statement(self, PreparedStatementState state, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_35close_statement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_35close_statement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close_statement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_state,&__pyx_n_s_timeout,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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_state)) != 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_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("close_statement", 1, 2, 2, 1); __PYX_ERR(1, 534, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "close_statement") < 0)) __PYX_ERR(1, 534, __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_state = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)values[0]);
    __pyx_v_timeout = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("close_statement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 534, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.close_statement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState, 1, "state", 0))) __PYX_ERR(1, 534, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_34close_statement(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_state, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_34close_statement(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *__pyx_v_state, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close_statement", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 534, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_state = __pyx_v_state;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_state);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_36generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_close_statement, __pyx_n_s_BaseProtocol_close_statement, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 534, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.close_statement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_36generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close_statement", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    case 3: goto __pyx_L29_resume_from_await;
    case 4: goto __pyx_L32_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 534, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":535
 *     @cython.iterable_coroutine
 *     async def close_statement(self, PreparedStatementState state, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":536
 *     async def close_statement(self, PreparedStatementState state, timeout):
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 536, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 536, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":535
 *     @cython.iterable_coroutine
 *     async def close_statement(self, PreparedStatementState state, timeout):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":537
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":538
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 538, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 538, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":539
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         self._check_state()
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":537
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":541
 *             self.cancel_sent_waiter = None
 * 
 *         self._check_state()             # <<<<<<<<<<<<<<
 * 
 *         if state.refs != 0:
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_check_state(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":543
 *         self._check_state()
 * 
 *         if state.refs != 0:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError(
 *                 'cannot close prepared statement; refs == {} != 0'.format(
 */
  __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_state->refs != 0) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/protocol.pyx":544
 * 
 *         if state.refs != 0:
 *             raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                 'cannot close prepared statement; refs == {} != 0'.format(
 *                     state.refs))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":545
 *         if state.refs != 0:
 *             raise apg_exc.InternalClientError(
 *                 'cannot close prepared statement; refs == {} != 0'.format(             # <<<<<<<<<<<<<<
 *                     state.refs))
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cannot_close_prepared_statement, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);

    /* "asyncpg/protocol/protocol.pyx":546
 *             raise apg_exc.InternalClientError(
 *                 'cannot close prepared statement; refs == {} != 0'.format(
 *                     state.refs))             # <<<<<<<<<<<<<<
 * 
 *         timeout = self._get_timeout_impl(timeout)
 */
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_state->refs); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 544, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":543
 *         self._check_state()
 * 
 *         if state.refs != 0:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError(
 *                 'cannot close prepared statement; refs == {} != 0'.format(
 */
  }

  /* "asyncpg/protocol/protocol.pyx":548
 *                     state.refs))
 * 
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 *         waiter = self._new_waiter(timeout)
 *         try:
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":549
 * 
 *         timeout = self._get_timeout_impl(timeout)
 *         waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             self._close(state.name, False)  # network op
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":550
 *         timeout = self._get_timeout_impl(timeout)
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._close(state.name, False)  # network op
 *             state.closed = True
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":551
 *         waiter = self._new_waiter(timeout)
 *         try:
 *             self._close(state.name, False)  # network op             # <<<<<<<<<<<<<<
 *             state.closed = True
 *         except Exception as ex:
 */
        __pyx_t_3 = __pyx_cur_scope->__pyx_v_state->name;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_5 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._close(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self), ((PyObject*)__pyx_t_3), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 551, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "asyncpg/protocol/protocol.pyx":552
 *         try:
 *             self._close(state.name, False)  # network op
 *             state.closed = True             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 */
        __pyx_cur_scope->__pyx_v_state->closed = 1;

        /* "asyncpg/protocol/protocol.pyx":550
 *         timeout = self._get_timeout_impl(timeout)
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._close(state.name, False)  # network op
 *             state.closed = True
 */
      }
      __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_L17_try_end;
      __pyx_L12_error:;
      __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_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asyncpg/protocol/protocol.pyx":553
 *             self._close(state.name, False)  # network op
 *             state.closed = True
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
      __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_12) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.close_statement", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(1, 553, __pyx_L14_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_v_ex = __pyx_t_3;
        /*try:*/ {

          /* "asyncpg/protocol/protocol.pyx":554
 *             state.closed = True
 *         except Exception as ex:
 *             waiter.set_exception(ex)             # <<<<<<<<<<<<<<
 *             self._coreproto_error()
 *         finally:
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 554, __pyx_L23_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_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_cur_scope->__pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_cur_scope->__pyx_v_ex);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 554, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "asyncpg/protocol/protocol.pyx":555
 *         except Exception as ex:
 *             waiter.set_exception(ex)
 *             self._coreproto_error()             # <<<<<<<<<<<<<<
 *         finally:
 *             return await waiter
 */
          __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_coreproto_error(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 555, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }

        /* "asyncpg/protocol/protocol.pyx":553
 *             self._close(state.name, False)  # network op
 *             state.closed = True
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(ex)
 *             self._coreproto_error()
 */
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
            __pyx_cur_scope->__pyx_v_ex = NULL;
            goto __pyx_L24;
          }
          __pyx_L23_error:;
          /*exception exit:*/{
            __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_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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;
            {
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ex);
              __Pyx_DECREF(__pyx_cur_scope->__pyx_v_ex);
              __pyx_cur_scope->__pyx_v_ex = NULL;
            }
            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_L14_except_error;
          }
          __pyx_L24:;
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L13_exception_handled;
      }
      goto __pyx_L14_except_error;
      __pyx_L14_except_error:;

      /* "asyncpg/protocol/protocol.pyx":550
 *         timeout = self._get_timeout_impl(timeout)
 *         waiter = self._new_waiter(timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             self._close(state.name, False)  # network op
 *             state.closed = True
 */
      __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_L10_error;
      __pyx_L13_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_L17_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":557
 *             self._coreproto_error()
 *         finally:
 *             return await waiter             # <<<<<<<<<<<<<<
 * 
 *     def is_closed(self):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 3;
        return __pyx_r;
        __pyx_L29_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 557, __pyx_L1_error)
        __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_4 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(1, 557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L10_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 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_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_18);
      {
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_9);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_9;
          __Pyx_XGIVEREF(__pyx_t_10);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_10;
          __Pyx_XGIVEREF(__pyx_t_11);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_11;
          __Pyx_XGIVEREF(__pyx_t_18);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_18;
          __Pyx_XGIVEREF(__pyx_t_19);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_19;
          __Pyx_XGIVEREF(__pyx_t_20);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_20;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L32_resume_from_await:;
          __pyx_t_9 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_10 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_10);
          __pyx_t_11 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_11);
          __pyx_t_18 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_19 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_19);
          __pyx_t_20 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_20);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 557, __pyx_L31_error)
          __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
        } else {
          __pyx_t_4 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(1, 557, __pyx_L31_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L30_return;
      }
      __pyx_L30_return:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L0;
      __pyx_L31_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":534
 * 
 *     @cython.iterable_coroutine
 *     async def close_statement(self, PreparedStatementState state, timeout):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("close_statement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":559
 *             return await waiter
 * 
 *     def is_closed(self):             # <<<<<<<<<<<<<<
 *         return self.closing
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_38is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_38is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_closed (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_37is_closed(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_37is_closed(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("is_closed", 0);

  /* "asyncpg/protocol/protocol.pyx":560
 * 
 *     def is_closed(self):
 *         return self.closing             # <<<<<<<<<<<<<<
 * 
 *     def is_connected(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->closing); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":559
 *             return await waiter
 * 
 *     def is_closed(self):             # <<<<<<<<<<<<<<
 *         return self.closing
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.is_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":562
 *         return self.closing
 * 
 *     def is_connected(self):             # <<<<<<<<<<<<<<
 *         return not self.closing and self.con_status == CONNECTION_OK
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_40is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_40is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_39is_connected(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_39is_connected(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_connected", 0);

  /* "asyncpg/protocol/protocol.pyx":563
 * 
 *     def is_connected(self):
 *         return not self.closing and self.con_status == CONNECTION_OK             # <<<<<<<<<<<<<<
 * 
 *     def abort(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (!(__pyx_v_self->closing != 0));
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->__pyx_base.con_status == __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_OK);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":562
 *         return self.closing
 * 
 *     def is_connected(self):             # <<<<<<<<<<<<<<
 *         return not self.closing and self.con_status == CONNECTION_OK
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":565
 *         return not self.closing and self.con_status == CONNECTION_OK
 * 
 *     def abort(self):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_42abort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_42abort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abort (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_41abort(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_41abort(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("abort", 0);

  /* "asyncpg/protocol/protocol.pyx":566
 * 
 *     def abort(self):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             return
 *         self.closing = True
 */
  __pyx_t_1 = (__pyx_v_self->closing != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":567
 *     def abort(self):
 *         if self.closing:
 *             return             # <<<<<<<<<<<<<<
 *         self.closing = True
 *         self._handle_waiter_on_connection_lost(None)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":566
 * 
 *     def abort(self):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             return
 *         self.closing = True
 */
  }

  /* "asyncpg/protocol/protocol.pyx":568
 *         if self.closing:
 *             return
 *         self.closing = True             # <<<<<<<<<<<<<<
 *         self._handle_waiter_on_connection_lost(None)
 *         self._terminate()
 */
  __pyx_v_self->closing = 1;

  /* "asyncpg/protocol/protocol.pyx":569
 *             return
 *         self.closing = True
 *         self._handle_waiter_on_connection_lost(None)             # <<<<<<<<<<<<<<
 *         self._terminate()
 *         self.transport.abort()
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_handle_waiter_on_connection_lost(__pyx_v_self, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":570
 *         self.closing = True
 *         self._handle_waiter_on_connection_lost(None)
 *         self._terminate()             # <<<<<<<<<<<<<<
 *         self.transport.abort()
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._terminate(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":571
 *         self._handle_waiter_on_connection_lost(None)
 *         self._terminate()
 *         self.transport.abort()             # <<<<<<<<<<<<<<
 * 
 *     @cython.iterable_coroutine
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.transport, __pyx_n_s_abort); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 571, __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(1, 571, __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;

  /* "asyncpg/protocol/protocol.pyx":565
 *         return not self.closing and self.con_status == CONNECTION_OK
 * 
 *     def abort(self):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             return
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.abort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_45generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":574
 * 
 *     @cython.iterable_coroutine
 *     async def close(self, timeout):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_44close(PyObject *__pyx_v_self, PyObject *__pyx_v_timeout); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_44close(PyObject *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_43close(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_timeout));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_43close(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 574, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_timeout);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_45generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_close, __pyx_n_s_BaseProtocol_close, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 574, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_45generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  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_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_await;
    case 2: goto __pyx_L8_resume_from_await;
    case 3: goto __pyx_L10_resume_from_await;
    case 4: goto __pyx_L12_resume_from_await;
    case 5: goto __pyx_L22_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 574, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":575
 *     @cython.iterable_coroutine
 *     async def close(self, timeout):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->closing != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":576
 *     async def close(self, timeout):
 *         if self.closing:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.closing = True
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":575
 *     @cython.iterable_coroutine
 *     async def close(self, timeout):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":578
 *             return
 * 
 *         self.closing = True             # <<<<<<<<<<<<<<
 * 
 *         if self.cancel_sent_waiter is not None:
 */
  __pyx_cur_scope->__pyx_v_self->closing = 1;

  /* "asyncpg/protocol/protocol.pyx":580
 *         self.closing = True
 * 
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":581
 * 
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 * 
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L6_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 581, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 581, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":582
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 * 
 *         if self.cancel_waiter is not None:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":580
 *         self.closing = True
 * 
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":584
 *             self.cancel_sent_waiter = None
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 * 
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":585
 * 
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 * 
 *         if self.waiter is not None:
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L8_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 585, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 585, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":584
 *             self.cancel_sent_waiter = None
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":587
 *             await self.cancel_waiter
 * 
 *         if self.waiter is not None:             # <<<<<<<<<<<<<<
 *             # If there is a query running, cancel it
 *             self._request_cancel()
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":589
 *         if self.waiter is not None:
 *             # If there is a query running, cancel it
 *             self._request_cancel()             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_request_cancel); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 589, __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_3 = (__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_3)) __PYX_ERR(1, 589, __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;

    /* "asyncpg/protocol/protocol.pyx":590
 *             # If there is a query running, cancel it
 *             self._request_cancel()
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 *             if self.cancel_waiter is not None:
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 3;
      return __pyx_r;
      __pyx_L10_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 590, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 590, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":591
 *             self._request_cancel()
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 *             if self.cancel_waiter is not None:
 *                 await self.cancel_waiter
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":592
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 *             if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *                 await self.cancel_waiter
 * 
 */
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/protocol.pyx":593
 *             self.cancel_sent_waiter = None
 *             if self.cancel_waiter is not None:
 *                 await self.cancel_waiter             # <<<<<<<<<<<<<<
 * 
 *         assert self.waiter is None
 */
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, awaiting value */
        __pyx_generator->resume_label = 4;
        return __pyx_r;
        __pyx_L12_resume_from_await:;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 593, __pyx_L1_error)
      } else {
        PyObject* exc_type = __Pyx_PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
          else __PYX_ERR(1, 593, __pyx_L1_error)
        }
      }

      /* "asyncpg/protocol/protocol.pyx":592
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 *             if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *                 await self.cancel_waiter
 * 
 */
    }

    /* "asyncpg/protocol/protocol.pyx":587
 *             await self.cancel_waiter
 * 
 *         if self.waiter is not None:             # <<<<<<<<<<<<<<
 *             # If there is a query running, cancel it
 *             self._request_cancel()
 */
  }

  /* "asyncpg/protocol/protocol.pyx":595
 *                 await self.cancel_waiter
 * 
 *         assert self.waiter is None             # <<<<<<<<<<<<<<
 * 
 *         timeout = self._get_timeout_impl(timeout)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->waiter == Py_None);
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(1, 595, __pyx_L1_error)
    }
  }
  #endif

  /* "asyncpg/protocol/protocol.pyx":597
 *         assert self.waiter is None
 * 
 *         timeout = self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 * 
 *         # Ask the server to terminate the connection and wait for it
 */
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_timeout);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_timeout, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":601
 *         # Ask the server to terminate the connection and wait for it
 *         # to drop.
 *         self.waiter = self._new_waiter(timeout)             # <<<<<<<<<<<<<<
 *         self._terminate()
 *         try:
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->waiter);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->waiter);
  __pyx_cur_scope->__pyx_v_self->waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":602
 *         # to drop.
 *         self.waiter = self._new_waiter(timeout)
 *         self._terminate()             # <<<<<<<<<<<<<<
 *         try:
 *             await self.waiter
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._terminate(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":603
 *         self.waiter = self._new_waiter(timeout)
 *         self._terminate()
 *         try:             # <<<<<<<<<<<<<<
 *             await self.waiter
 *         except ConnectionResetError:
 */
  /*try:*/ {
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":604
 *         self._terminate()
 *         try:
 *             await self.waiter             # <<<<<<<<<<<<<<
 *         except ConnectionResetError:
 *             # There appears to be a difference in behaviour of asyncio
 */
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->waiter);
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_t_8);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_8;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, awaiting value */
          __pyx_generator->resume_label = 5;
          return __pyx_r;
          __pyx_L22_resume_from_await:;
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          __pyx_t_8 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_8);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 604, __pyx_L16_error)
        } else {
          PyObject* exc_type = __Pyx_PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
            else __PYX_ERR(1, 604, __pyx_L16_error)
          }
        }

        /* "asyncpg/protocol/protocol.pyx":603
 *         self.waiter = self._new_waiter(timeout)
 *         self._terminate()
 *         try:             # <<<<<<<<<<<<<<
 *             await self.waiter
 *         except ConnectionResetError:
 */
      }
      __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_L21_try_end;
      __pyx_L16_error:;
      __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;

      /* "asyncpg/protocol/protocol.pyx":605
 *         try:
 *             await self.waiter
 *         except ConnectionResetError:             # <<<<<<<<<<<<<<
 *             # There appears to be a difference in behaviour of asyncio
 *             # in Windows, where, instead of calling protocol.connection_lost()
 */
      __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ConnectionResetError); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 605, __pyx_L18_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_9);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0;
      if (__pyx_t_10) {
        __Pyx_ErrRestore(0,0,0);
        goto __pyx_L17_exception_handled;
      }
      goto __pyx_L18_except_error;
      __pyx_L18_except_error:;

      /* "asyncpg/protocol/protocol.pyx":603
 *         self.waiter = self._new_waiter(timeout)
 *         self._terminate()
 *         try:             # <<<<<<<<<<<<<<
 *             await self.waiter
 *         except ConnectionResetError:
 */
      __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_L14_error;
      __pyx_L17_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_L21_try_end:;
    }
  }

  /* "asyncpg/protocol/protocol.pyx":611
 *             pass
 *         finally:
 *             self.waiter = None             # <<<<<<<<<<<<<<
 *         self.transport.abort()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->waiter);
      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->waiter);
      __pyx_cur_scope->__pyx_v_self->waiter = Py_None;
      goto __pyx_L15;
    }
    __pyx_L14_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_assign
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 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_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->waiter);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->waiter);
        __pyx_cur_scope->__pyx_v_self->waiter = Py_None;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
    }
    __pyx_L15:;
  }

  /* "asyncpg/protocol/protocol.pyx":612
 *         finally:
 *             self.waiter = None
 *         self.transport.abort()             # <<<<<<<<<<<<<<
 * 
 *     def _request_cancel(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->__pyx_base.transport, __pyx_n_s_abort); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_5 = (__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_5)) __PYX_ERR(1, 612, __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;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":574
 * 
 *     @cython.iterable_coroutine
 *     async def close(self, timeout):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             return
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  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_9);
  __Pyx_AddTraceback("close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":614
 *         self.transport.abort()
 * 
 *     def _request_cancel(self):             # <<<<<<<<<<<<<<
 *         self.cancel_waiter = self.create_future()
 *         self.cancel_sent_waiter = self.create_future()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_47_request_cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_47_request_cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_request_cancel (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_46_request_cancel(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_46_request_cancel(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_v_con = 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("_request_cancel", 0);

  /* "asyncpg/protocol/protocol.pyx":615
 * 
 *     def _request_cancel(self):
 *         self.cancel_waiter = self.create_future()             # <<<<<<<<<<<<<<
 *         self.cancel_sent_waiter = self.create_future()
 * 
 */
  __Pyx_INCREF(__pyx_v_self->create_future);
  __pyx_t_2 = __pyx_v_self->create_future; __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(1, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->cancel_waiter);
  __Pyx_DECREF(__pyx_v_self->cancel_waiter);
  __pyx_v_self->cancel_waiter = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":616
 *     def _request_cancel(self):
 *         self.cancel_waiter = self.create_future()
 *         self.cancel_sent_waiter = self.create_future()             # <<<<<<<<<<<<<<
 * 
 *         con = self.get_connection()
 */
  __Pyx_INCREF(__pyx_v_self->create_future);
  __pyx_t_2 = __pyx_v_self->create_future; __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(1, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->cancel_sent_waiter);
  __Pyx_DECREF(__pyx_v_self->cancel_sent_waiter);
  __pyx_v_self->cancel_sent_waiter = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":618
 *         self.cancel_sent_waiter = self.create_future()
 * 
 *         con = self.get_connection()             # <<<<<<<<<<<<<<
 *         if con is not None:
 *             # if 'con' is None it means that the connection object has been
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_connection(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_con = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":619
 * 
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             # if 'con' is None it means that the connection object has been
 *             # garbage collected and that the transport will soon be aborted.
 */
  __pyx_t_4 = (__pyx_v_con != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "asyncpg/protocol/protocol.pyx":622
 *             # if 'con' is None it means that the connection object has been
 *             # garbage collected and that the transport will soon be aborted.
 *             con._cancel_current_command(self.cancel_sent_waiter)             # <<<<<<<<<<<<<<
 *         else:
 *             self.loop.call_exception_handler({
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_con, __pyx_n_s_cancel_current_command); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __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_self->cancel_sent_waiter) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->cancel_sent_waiter);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __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;

    /* "asyncpg/protocol/protocol.pyx":619
 * 
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             # if 'con' is None it means that the connection object has been
 *             # garbage collected and that the transport will soon be aborted.
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":624
 *             con._cancel_current_command(self.cancel_sent_waiter)
 *         else:
 *             self.loop.call_exception_handler({             # <<<<<<<<<<<<<<
 *                 'message': 'asyncpg.Protocol has no reference to its '
 *                            'Connection object and yet a cancellation '
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->loop, __pyx_n_s_call_exception_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "asyncpg/protocol/protocol.pyx":625
 *         else:
 *             self.loop.call_exception_handler({
 *                 'message': 'asyncpg.Protocol has no reference to its '             # <<<<<<<<<<<<<<
 *                            'Connection object and yet a cancellation '
 *                            'was requested. Please report this at '
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_message, __pyx_kp_u_asyncpg_Protocol_has_no_referenc) < 0) __PYX_ERR(1, 625, __pyx_L1_error)
    __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(1, 624, __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;

    /* "asyncpg/protocol/protocol.pyx":630
 *                            'github.com/magicstack/asyncpg.'
 *             })
 *             self.abort()             # <<<<<<<<<<<<<<
 * 
 *         if self.state == PROTOCOL_PREPARE:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_abort); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 630, __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(1, 630, __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;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/protocol.pyx":632
 *             self.abort()
 * 
 *         if self.state == PROTOCOL_PREPARE:             # <<<<<<<<<<<<<<
 *             # we need to send a SYNC to server if we cancel during the PREPARE phase
 *             # because the PREPARE sequence does not send a SYNC itself.
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_PREPARE) != 0);
  if (__pyx_t_5) {

    /* "asyncpg/protocol/protocol.pyx":638
 *             # because then we would issue two SYNCs and we would get two ReadyForQuery
 *             # replies, which our current state machine implementation cannot handle
 *             self._write(SYNC_MESSAGE)             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_CANCELLED)
 * 
 */
    __pyx_t_1 = __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 638, __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;

    /* "asyncpg/protocol/protocol.pyx":632
 *             self.abort()
 * 
 *         if self.state == PROTOCOL_PREPARE:             # <<<<<<<<<<<<<<
 *             # we need to send a SYNC to server if we cancel during the PREPARE phase
 *             # because the PREPARE sequence does not send a SYNC itself.
 */
  }

  /* "asyncpg/protocol/protocol.pyx":639
 *             # replies, which our current state machine implementation cannot handle
 *             self._write(SYNC_MESSAGE)
 *         self._set_state(PROTOCOL_CANCELLED)             # <<<<<<<<<<<<<<
 * 
 *     def _on_timeout(self, fut):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CANCELLED); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":614
 *         self.transport.abort()
 * 
 *     def _request_cancel(self):             # <<<<<<<<<<<<<<
 *         self.cancel_waiter = self.create_future()
 *         self.cancel_sent_waiter = self.create_future()
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._request_cancel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_con);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":641
 *         self._set_state(PROTOCOL_CANCELLED)
 * 
 *     def _on_timeout(self, fut):             # <<<<<<<<<<<<<<
 *         if self.waiter is not fut or fut.done() or \
 *                 self.cancel_waiter is not None or \
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_49_on_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_fut); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_49_on_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_fut) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_48_on_timeout(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_fut));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_48_on_timeout(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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;
  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("_on_timeout", 0);

  /* "asyncpg/protocol/protocol.pyx":642
 * 
 *     def _on_timeout(self, fut):
 *         if self.waiter is not fut or fut.done() or \             # <<<<<<<<<<<<<<
 *                 self.cancel_waiter is not None or \
 *                 self.timeout_handle is None:
 */
  __pyx_t_2 = (__pyx_v_self->waiter != __pyx_v_fut);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_fut, __pyx_n_s_done); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 642, __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(1, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asyncpg/protocol/protocol.pyx":643
 *     def _on_timeout(self, fut):
 *         if self.waiter is not fut or fut.done() or \
 *                 self.cancel_waiter is not None or \             # <<<<<<<<<<<<<<
 *                 self.timeout_handle is None:
 *             return
 */
  __pyx_t_3 = (__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asyncpg/protocol/protocol.pyx":644
 *         if self.waiter is not fut or fut.done() or \
 *                 self.cancel_waiter is not None or \
 *                 self.timeout_handle is None:             # <<<<<<<<<<<<<<
 *             return
 *         self._request_cancel()
 */
  __pyx_t_2 = (__pyx_v_self->timeout_handle == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;

  /* "asyncpg/protocol/protocol.pyx":642
 * 
 *     def _on_timeout(self, fut):
 *         if self.waiter is not fut or fut.done() or \             # <<<<<<<<<<<<<<
 *                 self.cancel_waiter is not None or \
 *                 self.timeout_handle is None:
 */
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":645
 *                 self.cancel_waiter is not None or \
 *                 self.timeout_handle is None:
 *             return             # <<<<<<<<<<<<<<
 *         self._request_cancel()
 *         self.waiter.set_exception(asyncio.TimeoutError())
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":642
 * 
 *     def _on_timeout(self, fut):
 *         if self.waiter is not fut or fut.done() or \             # <<<<<<<<<<<<<<
 *                 self.cancel_waiter is not None or \
 *                 self.timeout_handle is None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":646
 *                 self.timeout_handle is None:
 *             return
 *         self._request_cancel()             # <<<<<<<<<<<<<<
 *         self.waiter.set_exception(asyncio.TimeoutError())
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_request_cancel); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 646, __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(1, 646, __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;

  /* "asyncpg/protocol/protocol.pyx":647
 *             return
 *         self._request_cancel()
 *         self.waiter.set_exception(asyncio.TimeoutError())             # <<<<<<<<<<<<<<
 * 
 *     def _on_waiter_completed(self, fut):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 647, __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 && likely(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_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __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_4)) __PYX_ERR(1, 647, __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;

  /* "asyncpg/protocol/protocol.pyx":641
 *         self._set_state(PROTOCOL_CANCELLED)
 * 
 *     def _on_timeout(self, fut):             # <<<<<<<<<<<<<<
 *         if self.waiter is not fut or fut.done() or \
 *                 self.cancel_waiter is not None or \
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":649
 *         self.waiter.set_exception(asyncio.TimeoutError())
 * 
 *     def _on_waiter_completed(self, fut):             # <<<<<<<<<<<<<<
 *         if fut is not self.waiter or self.cancel_waiter is not None:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_51_on_waiter_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_fut); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_51_on_waiter_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_fut) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_waiter_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_50_on_waiter_completed(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_fut));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_50_on_waiter_completed(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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("_on_waiter_completed", 0);

  /* "asyncpg/protocol/protocol.pyx":650
 * 
 *     def _on_waiter_completed(self, fut):
 *         if fut is not self.waiter or self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             return
 *         if fut.cancelled():
 */
  __pyx_t_2 = (__pyx_v_fut != __pyx_v_self->waiter);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":651
 *     def _on_waiter_completed(self, fut):
 *         if fut is not self.waiter or self.cancel_waiter is not None:
 *             return             # <<<<<<<<<<<<<<
 *         if fut.cancelled():
 *             if self.timeout_handle:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":650
 * 
 *     def _on_waiter_completed(self, fut):
 *         if fut is not self.waiter or self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             return
 *         if fut.cancelled():
 */
  }

  /* "asyncpg/protocol/protocol.pyx":652
 *         if fut is not self.waiter or self.cancel_waiter is not None:
 *             return
 *         if fut.cancelled():             # <<<<<<<<<<<<<<
 *             if self.timeout_handle:
 *                 self.timeout_handle.cancel()
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_fut, __pyx_n_s_cancelled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 652, __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(1, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 652, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":653
 *             return
 *         if fut.cancelled():
 *             if self.timeout_handle:             # <<<<<<<<<<<<<<
 *                 self.timeout_handle.cancel()
 *                 self.timeout_handle = None
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->timeout_handle); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 653, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "asyncpg/protocol/protocol.pyx":654
 *         if fut.cancelled():
 *             if self.timeout_handle:
 *                 self.timeout_handle.cancel()             # <<<<<<<<<<<<<<
 *                 self.timeout_handle = None
 *             self._request_cancel()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->timeout_handle, __pyx_n_s_cancel); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 654, __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(1, 654, __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;

      /* "asyncpg/protocol/protocol.pyx":655
 *             if self.timeout_handle:
 *                 self.timeout_handle.cancel()
 *                 self.timeout_handle = None             # <<<<<<<<<<<<<<
 *             self._request_cancel()
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->timeout_handle);
      __Pyx_DECREF(__pyx_v_self->timeout_handle);
      __pyx_v_self->timeout_handle = Py_None;

      /* "asyncpg/protocol/protocol.pyx":653
 *             return
 *         if fut.cancelled():
 *             if self.timeout_handle:             # <<<<<<<<<<<<<<
 *                 self.timeout_handle.cancel()
 *                 self.timeout_handle = None
 */
    }

    /* "asyncpg/protocol/protocol.pyx":656
 *                 self.timeout_handle.cancel()
 *                 self.timeout_handle = None
 *             self._request_cancel()             # <<<<<<<<<<<<<<
 * 
 *     def _create_future_fallback(self):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_request_cancel); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 656, __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(1, 656, __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;

    /* "asyncpg/protocol/protocol.pyx":652
 *         if fut is not self.waiter or self.cancel_waiter is not None:
 *             return
 *         if fut.cancelled():             # <<<<<<<<<<<<<<
 *             if self.timeout_handle:
 *                 self.timeout_handle.cancel()
 */
  }

  /* "asyncpg/protocol/protocol.pyx":649
 *         self.waiter.set_exception(asyncio.TimeoutError())
 * 
 *     def _on_waiter_completed(self, fut):             # <<<<<<<<<<<<<<
 *         if fut is not self.waiter or self.cancel_waiter is not None:
 *             return
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_waiter_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":658
 *             self._request_cancel()
 * 
 *     def _create_future_fallback(self):             # <<<<<<<<<<<<<<
 *         return asyncio.Future(loop=self.loop)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_53_create_future_fallback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_53_create_future_fallback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_create_future_fallback (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_52_create_future_fallback(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_52_create_future_fallback(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_future_fallback", 0);

  /* "asyncpg/protocol/protocol.pyx":659
 * 
 *     def _create_future_fallback(self):
 *         return asyncio.Future(loop=self.loop)             # <<<<<<<<<<<<<<
 * 
 *     cdef _handle_waiter_on_connection_lost(self, cause):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Future); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_loop, __pyx_v_self->loop) < 0) __PYX_ERR(1, 659, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":658
 *             self._request_cancel()
 * 
 *     def _create_future_fallback(self):             # <<<<<<<<<<<<<<
 *         return asyncio.Future(loop=self.loop)
 * 
 */

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

/* "asyncpg/protocol/protocol.pyx":661
 *         return asyncio.Future(loop=self.loop)
 * 
 *     cdef _handle_waiter_on_connection_lost(self, cause):             # <<<<<<<<<<<<<<
 *         if self.waiter is not None and not self.waiter.done():
 *             exc = apg_exc.ConnectionDoesNotExistError(
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__handle_waiter_on_connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_cause) {
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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("_handle_waiter_on_connection_lost", 0);

  /* "asyncpg/protocol/protocol.pyx":662
 * 
 *     cdef _handle_waiter_on_connection_lost(self, cause):
 *         if self.waiter is not None and not self.waiter.done():             # <<<<<<<<<<<<<<
 *             exc = apg_exc.ConnectionDoesNotExistError(
 *                 'connection was closed in the middle of '
 */
  __pyx_t_2 = (__pyx_v_self->waiter != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 662, __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(1, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 662, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":663
 *     cdef _handle_waiter_on_connection_lost(self, cause):
 *         if self.waiter is not None and not self.waiter.done():
 *             exc = apg_exc.ConnectionDoesNotExistError(             # <<<<<<<<<<<<<<
 *                 'connection was closed in the middle of '
 *                 'operation')
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ConnectionDoesNotExistError); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_kp_u_connection_was_closed_in_the_mid) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_connection_was_closed_in_the_mid);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_exc = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":666
 *                 'connection was closed in the middle of '
 *                 'operation')
 *             if cause is not None:             # <<<<<<<<<<<<<<
 *                 exc.__cause__ = cause
 *             self.waiter.set_exception(exc)
 */
    __pyx_t_1 = (__pyx_v_cause != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/protocol.pyx":667
 *                 'operation')
 *             if cause is not None:
 *                 exc.__cause__ = cause             # <<<<<<<<<<<<<<
 *             self.waiter.set_exception(exc)
 *         self.waiter = None
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_exc, __pyx_n_s_cause, __pyx_v_cause) < 0) __PYX_ERR(1, 667, __pyx_L1_error)

      /* "asyncpg/protocol/protocol.pyx":666
 *                 'connection was closed in the middle of '
 *                 'operation')
 *             if cause is not None:             # <<<<<<<<<<<<<<
 *                 exc.__cause__ = cause
 *             self.waiter.set_exception(exc)
 */
    }

    /* "asyncpg/protocol/protocol.pyx":668
 *             if cause is not None:
 *                 exc.__cause__ = cause
 *             self.waiter.set_exception(exc)             # <<<<<<<<<<<<<<
 *         self.waiter = None
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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_exc) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_exc);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":662
 * 
 *     cdef _handle_waiter_on_connection_lost(self, cause):
 *         if self.waiter is not None and not self.waiter.done():             # <<<<<<<<<<<<<<
 *             exc = apg_exc.ConnectionDoesNotExistError(
 *                 'connection was closed in the middle of '
 */
  }

  /* "asyncpg/protocol/protocol.pyx":669
 *                 exc.__cause__ = cause
 *             self.waiter.set_exception(exc)
 *         self.waiter = None             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_server_parameter(self, name, val):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->waiter);
  __Pyx_DECREF(__pyx_v_self->waiter);
  __pyx_v_self->waiter = Py_None;

  /* "asyncpg/protocol/protocol.pyx":661
 *         return asyncio.Future(loop=self.loop)
 * 
 *     cdef _handle_waiter_on_connection_lost(self, cause):             # <<<<<<<<<<<<<<
 *         if self.waiter is not None and not self.waiter.done():
 *             exc = apg_exc.ConnectionDoesNotExistError(
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._handle_waiter_on_connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":671
 *         self.waiter = None
 * 
 *     cdef _set_server_parameter(self, name, val):             # <<<<<<<<<<<<<<
 *         self.settings.add_setting(name, val)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__set_server_parameter(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  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("_set_server_parameter", 0);

  /* "asyncpg/protocol/protocol.pyx":672
 * 
 *     cdef _set_server_parameter(self, name, val):
 *         self.settings.add_setting(name, val)             # <<<<<<<<<<<<<<
 * 
 *     def _get_timeout(self, timeout):
 */
  if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(1, 672, __pyx_L1_error)
  if (!(likely(PyUnicode_CheckExact(__pyx_v_val))||((__pyx_v_val) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_val)->tp_name), 0))) __PYX_ERR(1, 672, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_setting(__pyx_v_self->settings, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_val)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":671
 *         self.waiter = None
 * 
 *     cdef _set_server_parameter(self, name, val):             # <<<<<<<<<<<<<<
 *         self.settings.add_setting(name, val)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._set_server_parameter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":674
 *         self.settings.add_setting(name, val)
 * 
 *     def _get_timeout(self, timeout):             # <<<<<<<<<<<<<<
 *         if timeout is not None:
 *             try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_55_get_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_timeout); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_55_get_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_54_get_timeout(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_timeout));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_54_get_timeout(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout) {
  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;
  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("_get_timeout", 0);
  __Pyx_INCREF(__pyx_v_timeout);

  /* "asyncpg/protocol/protocol.pyx":675
 * 
 *     def _get_timeout(self, timeout):
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             try:
 *                 if type(timeout) is bool:
 */
  __pyx_t_1 = (__pyx_v_timeout != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":676
 *     def _get_timeout(self, timeout):
 *         if timeout is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 if type(timeout) is bool:
 *                     raise ValueError
 */
    {
      __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:*/ {

        /* "asyncpg/protocol/protocol.pyx":677
 *         if timeout is not None:
 *             try:
 *                 if type(timeout) is bool:             # <<<<<<<<<<<<<<
 *                     raise ValueError
 *                 timeout = float(timeout)
 */
        __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_timeout)) == ((PyObject*)&PyBool_Type));
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (unlikely(__pyx_t_1)) {

          /* "asyncpg/protocol/protocol.pyx":678
 *             try:
 *                 if type(timeout) is bool:
 *                     raise ValueError             # <<<<<<<<<<<<<<
 *                 timeout = float(timeout)
 *             except ValueError:
 */
          __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
          __PYX_ERR(1, 678, __pyx_L4_error)

          /* "asyncpg/protocol/protocol.pyx":677
 *         if timeout is not None:
 *             try:
 *                 if type(timeout) is bool:             # <<<<<<<<<<<<<<
 *                     raise ValueError
 *                 timeout = float(timeout)
 */
        }

        /* "asyncpg/protocol/protocol.pyx":679
 *                 if type(timeout) is bool:
 *                     raise ValueError
 *                 timeout = float(timeout)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 raise ValueError(
 */
        __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_v_timeout); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":676
 *     def _get_timeout(self, timeout):
 *         if timeout is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 if type(timeout) is bool:
 *                     raise ValueError
 */
      }
      __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_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "asyncpg/protocol/protocol.pyx":680
 *                     raise ValueError
 *                 timeout = float(timeout)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'invalid timeout value: expected non-negative float '
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._get_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(1, 680, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_9);

        /* "asyncpg/protocol/protocol.pyx":683
 *                 raise ValueError(
 *                     'invalid timeout value: expected non-negative float '
 *                     '(got {!r})'.format(timeout)) from None             # <<<<<<<<<<<<<<
 * 
 *         return self._get_timeout_impl(timeout)
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_timeout_value_expected_n, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 683, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_timeout);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 683, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "asyncpg/protocol/protocol.pyx":681
 *                 timeout = float(timeout)
 *             except ValueError:
 *                 raise ValueError(             # <<<<<<<<<<<<<<
 *                     'invalid timeout value: expected non-negative float '
 *                     '(got {!r})'.format(timeout)) from None
 */
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 681, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "asyncpg/protocol/protocol.pyx":683
 *                 raise ValueError(
 *                     'invalid timeout value: expected non-negative float '
 *                     '(got {!r})'.format(timeout)) from None             # <<<<<<<<<<<<<<
 * 
 *         return self._get_timeout_impl(timeout)
 */
        __Pyx_Raise(__pyx_t_11, 0, 0, Py_None);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(1, 681, __pyx_L6_except_error)
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "asyncpg/protocol/protocol.pyx":676
 *     def _get_timeout(self, timeout):
 *         if timeout is not None:
 *             try:             # <<<<<<<<<<<<<<
 *                 if type(timeout) is bool:
 *                     raise ValueError
 */
      __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_L9_try_end:;
    }

    /* "asyncpg/protocol/protocol.pyx":675
 * 
 *     def _get_timeout(self, timeout):
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             try:
 *                 if type(timeout) is bool:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":685
 *                     '(got {!r})'.format(timeout)) from None
 * 
 *         return self._get_timeout_impl(timeout)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _get_timeout_impl(self, timeout):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(__pyx_v_self, __pyx_v_timeout); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":674
 *         self.settings.add_setting(name, val)
 * 
 *     def _get_timeout(self, timeout):             # <<<<<<<<<<<<<<
 *         if timeout is not None:
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __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("asyncpg.protocol.protocol.BaseProtocol._get_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":687
 *         return self._get_timeout_impl(timeout)
 * 
 *     cdef inline _get_timeout_impl(self, timeout):             # <<<<<<<<<<<<<<
 *         if timeout is None:
 *             timeout = self.get_connection()._config.command_timeout
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  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("_get_timeout_impl", 0);
  __Pyx_INCREF(__pyx_v_timeout);

  /* "asyncpg/protocol/protocol.pyx":688
 * 
 *     cdef inline _get_timeout_impl(self, timeout):
 *         if timeout is None:             # <<<<<<<<<<<<<<
 *             timeout = self.get_connection()._config.command_timeout
 *         elif timeout is NO_TIMEOUT:
 */
  __pyx_t_1 = (__pyx_v_timeout == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":689
 *     cdef inline _get_timeout_impl(self, timeout):
 *         if timeout is None:
 *             timeout = self.get_connection()._config.command_timeout             # <<<<<<<<<<<<<<
 *         elif timeout is NO_TIMEOUT:
 *             timeout = None
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_connection(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_config); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 689, __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_command_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/protocol.pyx":688
 * 
 *     cdef inline _get_timeout_impl(self, timeout):
 *         if timeout is None:             # <<<<<<<<<<<<<<
 *             timeout = self.get_connection()._config.command_timeout
 *         elif timeout is NO_TIMEOUT:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":690
 *         if timeout is None:
 *             timeout = self.get_connection()._config.command_timeout
 *         elif timeout is NO_TIMEOUT:             # <<<<<<<<<<<<<<
 *             timeout = None
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NO_TIMEOUT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = (__pyx_v_timeout == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":691
 *             timeout = self.get_connection()._config.command_timeout
 *         elif timeout is NO_TIMEOUT:
 *             timeout = None             # <<<<<<<<<<<<<<
 *         else:
 *             timeout = float(timeout)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_timeout, Py_None);

    /* "asyncpg/protocol/protocol.pyx":690
 *         if timeout is None:
 *             timeout = self.get_connection()._config.command_timeout
 *         elif timeout is NO_TIMEOUT:             # <<<<<<<<<<<<<<
 *             timeout = None
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":693
 *             timeout = None
 *         else:
 *             timeout = float(timeout)             # <<<<<<<<<<<<<<
 * 
 *         if timeout is not None and timeout <= 0:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/protocol.pyx":695
 *             timeout = float(timeout)
 * 
 *         if timeout is not None and timeout <= 0:             # <<<<<<<<<<<<<<
 *             raise asyncio.TimeoutError()
 *         return timeout
 */
  __pyx_t_2 = (__pyx_v_timeout != Py_None);
  __pyx_t_5 = (__pyx_t_2 != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_timeout, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 695, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 695, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_5;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "asyncpg/protocol/protocol.pyx":696
 * 
 *         if timeout is not None and timeout <= 0:
 *             raise asyncio.TimeoutError()             # <<<<<<<<<<<<<<
 *         return timeout
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 696, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":695
 *             timeout = float(timeout)
 * 
 *         if timeout is not None and timeout <= 0:             # <<<<<<<<<<<<<<
 *             raise asyncio.TimeoutError()
 *         return timeout
 */
  }

  /* "asyncpg/protocol/protocol.pyx":697
 *         if timeout is not None and timeout <= 0:
 *             raise asyncio.TimeoutError()
 *         return timeout             # <<<<<<<<<<<<<<
 * 
 *     cdef _check_state(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_timeout);
  __pyx_r = __pyx_v_timeout;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":687
 *         return self._get_timeout_impl(timeout)
 * 
 *     cdef inline _get_timeout_impl(self, timeout):             # <<<<<<<<<<<<<<
 *         if timeout is None:
 *             timeout = self.get_connection()._config.command_timeout
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._get_timeout_impl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":699
 *         return timeout
 * 
 *     cdef _check_state(self):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             raise apg_exc.InterfaceError(
 */

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

  /* "asyncpg/protocol/protocol.pyx":700
 * 
 *     cdef _check_state(self):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is cancelling')
 */
  __pyx_t_1 = (__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/protocol.pyx":701
 *     cdef _check_state(self):
 *         if self.cancel_waiter is not None:
 *             raise apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'cannot perform operation: another operation is cancelling')
 *         if self.closing:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 701, __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 && unlikely(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_u_cannot_perform_operation_another) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_cannot_perform_operation_another);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 701, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":700
 * 
 *     cdef _check_state(self):
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is cancelling')
 */
  }

  /* "asyncpg/protocol/protocol.pyx":703
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is cancelling')
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: connection is closed')
 */
  __pyx_t_2 = (__pyx_v_self->closing != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/protocol.pyx":704
 *                 'cannot perform operation: another operation is cancelling')
 *         if self.closing:
 *             raise apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'cannot perform operation: connection is closed')
 *         if self.waiter is not None or self.timeout_handle is not None:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 704, __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 && 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_kp_u_cannot_perform_operation_connect) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_cannot_perform_operation_connect);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 704, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":703
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is cancelling')
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: connection is closed')
 */
  }

  /* "asyncpg/protocol/protocol.pyx":706
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: connection is closed')
 *         if self.waiter is not None or self.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is in progress')
 */
  __pyx_t_1 = (__pyx_v_self->waiter != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_2 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_self->timeout_handle != Py_None);
  __pyx_t_1 = (__pyx_t_6 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/protocol.pyx":707
 *                 'cannot perform operation: connection is closed')
 *         if self.waiter is not None or self.timeout_handle is not None:
 *             raise apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'cannot perform operation: another operation is in progress')
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 707, __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 && unlikely(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_u_cannot_perform_operation_another_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_cannot_perform_operation_another_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 707, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 707, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":706
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: connection is closed')
 *         if self.waiter is not None or self.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is in progress')
 */
  }

  /* "asyncpg/protocol/protocol.pyx":699
 *         return timeout
 * 
 *     cdef _check_state(self):             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             raise apg_exc.InterfaceError(
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._check_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":710
 *                 'cannot perform operation: another operation is in progress')
 * 
 *     def _is_cancelling(self):             # <<<<<<<<<<<<<<
 *         return (
 *             self.cancel_waiter is not None or
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_57_is_cancelling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_57_is_cancelling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_cancelling (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_56_is_cancelling(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_56_is_cancelling(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_cancelling", 0);

  /* "asyncpg/protocol/protocol.pyx":711
 * 
 *     def _is_cancelling(self):
 *         return (             # <<<<<<<<<<<<<<
 *             self.cancel_waiter is not None or
 *             self.cancel_sent_waiter is not None
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asyncpg/protocol/protocol.pyx":712
 *     def _is_cancelling(self):
 *         return (
 *             self.cancel_waiter is not None or             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter is not None
 *         )
 */
  __pyx_t_2 = (__pyx_v_self->cancel_waiter != Py_None);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "asyncpg/protocol/protocol.pyx":713
 *         return (
 *             self.cancel_waiter is not None or
 *             self.cancel_sent_waiter is not None             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_2 = (__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":710
 *                 'cannot perform operation: another operation is in progress')
 * 
 *     def _is_cancelling(self):             # <<<<<<<<<<<<<<
 *         return (
 *             self.cancel_waiter is not None or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._is_cancelling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_60generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "asyncpg/protocol/protocol.pyx":717
 * 
 *     @cython.iterable_coroutine
 *     async def _wait_for_cancellation(self):             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_59_wait_for_cancellation(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_59_wait_for_cancellation(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_wait_for_cancellation (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_58_wait_for_cancellation(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_58_wait_for_cancellation(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_wait_for_cancellation", 0);
  __pyx_cur_scope = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation(__pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 717, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_IterableCoroutine_New((__pyx_coroutine_body_t) __pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_60generator10, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_wait_for_cancellation, __pyx_n_s_BaseProtocol__wait_for_cancellat, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!gen)) __PYX_ERR(1, 717, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._wait_for_cancellation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7asyncpg_8protocol_8protocol_12BaseProtocol_60generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *__pyx_cur_scope = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_wait_for_cancellation", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L5_resume_from_await;
    case 2: goto __pyx_L7_resume_from_await;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 717, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":718
 *     @cython.iterable_coroutine
 *     async def _wait_for_cancellation(self):
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":719
 *     async def _wait_for_cancellation(self):
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter             # <<<<<<<<<<<<<<
 *             self.cancel_sent_waiter = None
 *         if self.cancel_waiter is not None:
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L5_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 719, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 719, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":720
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None             # <<<<<<<<<<<<<<
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->cancel_sent_waiter);
    __pyx_cur_scope->__pyx_v_self->cancel_sent_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":718
 *     @cython.iterable_coroutine
 *     async def _wait_for_cancellation(self):
 *         if self.cancel_sent_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":721
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 * 
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":722
 *             self.cancel_sent_waiter = None
 *         if self.cancel_waiter is not None:
 *             await self.cancel_waiter             # <<<<<<<<<<<<<<
 * 
 *     cdef _coreproto_error(self):
 */
    __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->cancel_waiter);
    __Pyx_XGOTREF(__pyx_r);
    if (likely(__pyx_r)) {
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, awaiting value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L7_resume_from_await:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 722, __pyx_L1_error)
    } else {
      PyObject* exc_type = __Pyx_PyErr_Occurred();
      if (exc_type) {
        if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
        else __PYX_ERR(1, 722, __pyx_L1_error)
      }
    }

    /* "asyncpg/protocol/protocol.pyx":721
 *             await self.cancel_sent_waiter
 *             self.cancel_sent_waiter = None
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             await self.cancel_waiter
 * 
 */
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asyncpg/protocol/protocol.pyx":717
 * 
 *     @cython.iterable_coroutine
 *     async def _wait_for_cancellation(self):             # <<<<<<<<<<<<<<
 *         if self.cancel_sent_waiter is not None:
 *             await self.cancel_sent_waiter
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_wait_for_cancellation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":724
 *             await self.cancel_waiter
 * 
 *     cdef _coreproto_error(self):             # <<<<<<<<<<<<<<
 *         try:
 *             if self.waiter is not None:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__coreproto_error(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  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;
  int __pyx_t_7;
  char const *__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("_coreproto_error", 0);

  /* "asyncpg/protocol/protocol.pyx":725
 * 
 *     cdef _coreproto_error(self):
 *         try:             # <<<<<<<<<<<<<<
 *             if self.waiter is not None:
 *                 if not self.waiter.done():
 */
  /*try:*/ {

    /* "asyncpg/protocol/protocol.pyx":726
 *     cdef _coreproto_error(self):
 *         try:
 *             if self.waiter is not None:             # <<<<<<<<<<<<<<
 *                 if not self.waiter.done():
 *                     raise apg_exc.InternalClientError(
 */
    __pyx_t_1 = (__pyx_v_self->waiter != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/protocol.pyx":727
 *         try:
 *             if self.waiter is not None:
 *                 if not self.waiter.done():             # <<<<<<<<<<<<<<
 *                     raise apg_exc.InternalClientError(
 *                         'waiter is not done while handling critical '
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 727, __pyx_L4_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_3 = (__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_3)) __PYX_ERR(1, 727, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 727, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = ((!__pyx_t_2) != 0);
      if (unlikely(__pyx_t_1)) {

        /* "asyncpg/protocol/protocol.pyx":728
 *             if self.waiter is not None:
 *                 if not self.waiter.done():
 *                     raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                         'waiter is not done while handling critical '
 *                         'protocol error')
 */
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 728, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 728, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(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_u_waiter_is_not_done_while_handlin) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_waiter_is_not_done_while_handlin);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 728, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(1, 728, __pyx_L4_error)

        /* "asyncpg/protocol/protocol.pyx":727
 *         try:
 *             if self.waiter is not None:
 *                 if not self.waiter.done():             # <<<<<<<<<<<<<<
 *                     raise apg_exc.InternalClientError(
 *                         'waiter is not done while handling critical '
 */
      }

      /* "asyncpg/protocol/protocol.pyx":731
 *                         'waiter is not done while handling critical '
 *                         'protocol error')
 *                 self.waiter = None             # <<<<<<<<<<<<<<
 *         finally:
 *             self.abort()
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->waiter);
      __Pyx_DECREF(__pyx_v_self->waiter);
      __pyx_v_self->waiter = Py_None;

      /* "asyncpg/protocol/protocol.pyx":726
 *     cdef _coreproto_error(self):
 *         try:
 *             if self.waiter is not None:             # <<<<<<<<<<<<<<
 *                 if not self.waiter.done():
 *                     raise apg_exc.InternalClientError(
 */
    }
  }

  /* "asyncpg/protocol/protocol.pyx":733
 *                 self.waiter = None
 *         finally:
 *             self.abort()             # <<<<<<<<<<<<<<
 * 
 *     cdef _new_waiter(self, timeout):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_abort); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 733, __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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
      {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_abort); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 733, __pyx_L9_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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 733, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
      goto __pyx_L1_error;
      __pyx_L9_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __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;
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "asyncpg/protocol/protocol.pyx":724
 *             await self.cancel_waiter
 * 
 *     cdef _coreproto_error(self):             # <<<<<<<<<<<<<<
 *         try:
 *             if self.waiter is not None:
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._coreproto_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":735
 *             self.abort()
 * 
 *     cdef _new_waiter(self, timeout):             # <<<<<<<<<<<<<<
 *         if self.waiter is not None:
 *             raise apg_exc.InterfaceError(
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__new_waiter(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_timeout) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_new_waiter", 0);

  /* "asyncpg/protocol/protocol.pyx":736
 * 
 *     cdef _new_waiter(self, timeout):
 *         if self.waiter is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is in progress')
 */
  __pyx_t_1 = (__pyx_v_self->waiter != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_2)) {

    /* "asyncpg/protocol/protocol.pyx":737
 *     cdef _new_waiter(self, timeout):
 *         if self.waiter is not None:
 *             raise apg_exc.InterfaceError(             # <<<<<<<<<<<<<<
 *                 'cannot perform operation: another operation is in progress')
 *         self.waiter = self.create_future()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 737, __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 && unlikely(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_u_cannot_perform_operation_another_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_cannot_perform_operation_another_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 737, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":736
 * 
 *     cdef _new_waiter(self, timeout):
 *         if self.waiter is not None:             # <<<<<<<<<<<<<<
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is in progress')
 */
  }

  /* "asyncpg/protocol/protocol.pyx":739
 *             raise apg_exc.InterfaceError(
 *                 'cannot perform operation: another operation is in progress')
 *         self.waiter = self.create_future()             # <<<<<<<<<<<<<<
 *         if timeout is not None:
 *             self.timeout_handle = self.loop.call_later(
 */
  __Pyx_INCREF(__pyx_v_self->create_future);
  __pyx_t_5 = __pyx_v_self->create_future; __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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->waiter);
  __Pyx_DECREF(__pyx_v_self->waiter);
  __pyx_v_self->waiter = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":740
 *                 'cannot perform operation: another operation is in progress')
 *         self.waiter = self.create_future()
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             self.timeout_handle = self.loop.call_later(
 *                 timeout, self.timeout_callback, self.waiter)
 */
  __pyx_t_2 = (__pyx_v_timeout != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":741
 *         self.waiter = self.create_future()
 *         if timeout is not None:
 *             self.timeout_handle = self.loop.call_later(             # <<<<<<<<<<<<<<
 *                 timeout, self.timeout_callback, self.waiter)
 *         self.waiter.add_done_callback(self.completed_callback)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->loop, __pyx_n_s_call_later); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "asyncpg/protocol/protocol.pyx":742
 *         if timeout is not None:
 *             self.timeout_handle = self.loop.call_later(
 *                 timeout, self.timeout_callback, self.waiter)             # <<<<<<<<<<<<<<
 *         self.waiter.add_done_callback(self.completed_callback)
 *         return self.waiter
 */
    __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_timeout, __pyx_v_self->timeout_callback, __pyx_v_self->waiter};
      __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(1, 741, __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_timeout, __pyx_v_self->timeout_callback, __pyx_v_self->waiter};
      __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(1, 741, __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(1, 741, __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_timeout);
      __Pyx_GIVEREF(__pyx_v_timeout);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_timeout);
      __Pyx_INCREF(__pyx_v_self->timeout_callback);
      __Pyx_GIVEREF(__pyx_v_self->timeout_callback);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self->timeout_callback);
      __Pyx_INCREF(__pyx_v_self->waiter);
      __Pyx_GIVEREF(__pyx_v_self->waiter);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_self->waiter);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 741, __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;

    /* "asyncpg/protocol/protocol.pyx":741
 *         self.waiter = self.create_future()
 *         if timeout is not None:
 *             self.timeout_handle = self.loop.call_later(             # <<<<<<<<<<<<<<
 *                 timeout, self.timeout_callback, self.waiter)
 *         self.waiter.add_done_callback(self.completed_callback)
 */
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->timeout_handle);
    __Pyx_DECREF(__pyx_v_self->timeout_handle);
    __pyx_v_self->timeout_handle = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asyncpg/protocol/protocol.pyx":740
 *                 'cannot perform operation: another operation is in progress')
 *         self.waiter = self.create_future()
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             self.timeout_handle = self.loop.call_later(
 *                 timeout, self.timeout_callback, self.waiter)
 */
  }

  /* "asyncpg/protocol/protocol.pyx":743
 *             self.timeout_handle = self.loop.call_later(
 *                 timeout, self.timeout_callback, self.waiter)
 *         self.waiter.add_done_callback(self.completed_callback)             # <<<<<<<<<<<<<<
 *         return self.waiter
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_self->completed_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->completed_callback);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":744
 *                 timeout, self.timeout_callback, self.waiter)
 *         self.waiter.add_done_callback(self.completed_callback)
 *         return self.waiter             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__connect(self, object waiter):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->waiter);
  __pyx_r = __pyx_v_self->waiter;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":735
 *             self.abort()
 * 
 *     cdef _new_waiter(self, timeout):             # <<<<<<<<<<<<<<
 *         if self.waiter is not None:
 *             raise apg_exc.InterfaceError(
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._new_waiter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":746
 *         return self.waiter
 * 
 *     cdef _on_result__connect(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(True)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__connect(CYTHON_UNUSED struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_result__connect", 0);

  /* "asyncpg/protocol/protocol.pyx":747
 * 
 *     cdef _on_result__connect(self, object waiter):
 *         waiter.set_result(True)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__prepare(self, object waiter):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_2, Py_True);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 747, __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;

  /* "asyncpg/protocol/protocol.pyx":746
 *         return self.waiter
 * 
 *     cdef _on_result__connect(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(True)
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_result__connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":749
 *         waiter.set_result(True)
 * 
 *     cdef _on_result__prepare(self, object waiter):             # <<<<<<<<<<<<<<
 *         if PG_DEBUG:
 *             if self.statement is None:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__prepare(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_result__prepare", 0);

  /* "asyncpg/protocol/protocol.pyx":750
 * 
 *     cdef _on_result__prepare(self, object waiter):
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(
 */
  __pyx_t_1 = (PG_DEBUG != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":751
 *     cdef _on_result__prepare(self, object waiter):
 *         if PG_DEBUG:
 *             if self.statement is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_on_result__prepare: statement is None')
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->statement) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/protocol.pyx":752
 *         if PG_DEBUG:
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     '_on_result__prepare: statement is None')
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 752, __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 && unlikely(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_u_on_result__prepare_statement_is) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_on_result__prepare_statement_is);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 752, __pyx_L1_error)

      /* "asyncpg/protocol/protocol.pyx":751
 *     cdef _on_result__prepare(self, object waiter):
 *         if PG_DEBUG:
 *             if self.statement is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_on_result__prepare: statement is None')
 */
    }

    /* "asyncpg/protocol/protocol.pyx":750
 * 
 *     cdef _on_result__prepare(self, object waiter):
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(
 */
  }

  /* "asyncpg/protocol/protocol.pyx":755
 *                     '_on_result__prepare: statement is None')
 * 
 *         if self.result_param_desc is not None:             # <<<<<<<<<<<<<<
 *             self.statement._set_args_desc(self.result_param_desc)
 *         if self.result_row_desc is not None:
 */
  __pyx_t_2 = (__pyx_v_self->__pyx_base.result_param_desc != ((PyObject*)Py_None));
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":756
 * 
 *         if self.result_param_desc is not None:
 *             self.statement._set_args_desc(self.result_param_desc)             # <<<<<<<<<<<<<<
 *         if self.result_row_desc is not None:
 *             self.statement._set_row_desc(self.result_row_desc)
 */
    __pyx_t_3 = __pyx_v_self->__pyx_base.result_param_desc;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_args_desc(__pyx_v_self->statement, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asyncpg/protocol/protocol.pyx":755
 *                     '_on_result__prepare: statement is None')
 * 
 *         if self.result_param_desc is not None:             # <<<<<<<<<<<<<<
 *             self.statement._set_args_desc(self.result_param_desc)
 *         if self.result_row_desc is not None:
 */
  }

  /* "asyncpg/protocol/protocol.pyx":757
 *         if self.result_param_desc is not None:
 *             self.statement._set_args_desc(self.result_param_desc)
 *         if self.result_row_desc is not None:             # <<<<<<<<<<<<<<
 *             self.statement._set_row_desc(self.result_row_desc)
 *         waiter.set_result(self.statement)
 */
  __pyx_t_1 = (__pyx_v_self->__pyx_base.result_row_desc != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":758
 *             self.statement._set_args_desc(self.result_param_desc)
 *         if self.result_row_desc is not None:
 *             self.statement._set_row_desc(self.result_row_desc)             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.statement)
 * 
 */
    __pyx_t_5 = __pyx_v_self->__pyx_base.result_row_desc;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_row_desc(__pyx_v_self->statement, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asyncpg/protocol/protocol.pyx":757
 *         if self.result_param_desc is not None:
 *             self.statement._set_args_desc(self.result_param_desc)
 *         if self.result_row_desc is not None:             # <<<<<<<<<<<<<<
 *             self.statement._set_row_desc(self.result_row_desc)
 *         waiter.set_result(self.statement)
 */
  }

  /* "asyncpg/protocol/protocol.pyx":759
 *         if self.result_row_desc is not None:
 *             self.statement._set_row_desc(self.result_row_desc)
 *         waiter.set_result(self.statement)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__bind_and_exec(self, object waiter):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 759, __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, ((PyObject *)__pyx_v_self->statement)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_self->statement));
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "asyncpg/protocol/protocol.pyx":749
 *         waiter.set_result(True)
 * 
 *     cdef _on_result__prepare(self, object waiter):             # <<<<<<<<<<<<<<
 *         if PG_DEBUG:
 *             if self.statement is None:
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_result__prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":761
 *         waiter.set_result(self.statement)
 * 
 *     cdef _on_result__bind_and_exec(self, object waiter):             # <<<<<<<<<<<<<<
 *         if self.return_extra:
 *             waiter.set_result((
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind_and_exec(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_result__bind_and_exec", 0);

  /* "asyncpg/protocol/protocol.pyx":762
 * 
 *     cdef _on_result__bind_and_exec(self, object waiter):
 *         if self.return_extra:             # <<<<<<<<<<<<<<
 *             waiter.set_result((
 *                 self.result,
 */
  __pyx_t_1 = (__pyx_v_self->return_extra != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":763
 *     cdef _on_result__bind_and_exec(self, object waiter):
 *         if self.return_extra:
 *             waiter.set_result((             # <<<<<<<<<<<<<<
 *                 self.result,
 *                 self.result_status_msg,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asyncpg/protocol/protocol.pyx":766
 *                 self.result,
 *                 self.result_status_msg,
 *                 self.result_execute_completed))             # <<<<<<<<<<<<<<
 *         else:
 *             waiter.set_result(self.result)
 */
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.result_execute_completed); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "asyncpg/protocol/protocol.pyx":764
 *         if self.return_extra:
 *             waiter.set_result((
 *                 self.result,             # <<<<<<<<<<<<<<
 *                 self.result_status_msg,
 *                 self.result_execute_completed))
 */
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_self->__pyx_base.result);
    __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->__pyx_base.result);
    __Pyx_INCREF(__pyx_v_self->__pyx_base.result_status_msg);
    __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result_status_msg);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self->__pyx_base.result_status_msg);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
    __pyx_t_4 = 0;
    __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_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 763, __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;

    /* "asyncpg/protocol/protocol.pyx":762
 * 
 *     cdef _on_result__bind_and_exec(self, object waiter):
 *         if self.return_extra:             # <<<<<<<<<<<<<<
 *             waiter.set_result((
 *                 self.result,
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":768
 *                 self.result_execute_completed))
 *         else:
 *             waiter.set_result(self.result)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__bind(self, object waiter):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 768, __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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_self->__pyx_base.result) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->__pyx_base.result);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 768, __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_L3:;

  /* "asyncpg/protocol/protocol.pyx":761
 *         waiter.set_result(self.statement)
 * 
 *     cdef _on_result__bind_and_exec(self, object waiter):             # <<<<<<<<<<<<<<
 *         if self.return_extra:
 *             waiter.set_result((
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_result__bind_and_exec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":770
 *             waiter.set_result(self.result)
 * 
 *     cdef _on_result__bind(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_result__bind", 0);

  /* "asyncpg/protocol/protocol.pyx":771
 * 
 *     cdef _on_result__bind(self, object waiter):
 *         waiter.set_result(self.result)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__close_stmt_or_portal(self, object waiter):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 771, __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_self->__pyx_base.result) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base.result);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __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;

  /* "asyncpg/protocol/protocol.pyx":770
 *             waiter.set_result(self.result)
 * 
 *     cdef _on_result__bind(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result)
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_result__bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":773
 *         waiter.set_result(self.result)
 * 
 *     cdef _on_result__close_stmt_or_portal(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__close_stmt_or_portal(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_result__close_stmt_or_portal", 0);

  /* "asyncpg/protocol/protocol.pyx":774
 * 
 *     cdef _on_result__close_stmt_or_portal(self, object waiter):
 *         waiter.set_result(self.result)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__simple_query(self, object waiter):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 774, __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_self->__pyx_base.result) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base.result);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __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;

  /* "asyncpg/protocol/protocol.pyx":773
 *         waiter.set_result(self.result)
 * 
 *     cdef _on_result__close_stmt_or_portal(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result)
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_result__close_stmt_or_portal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":776
 *         waiter.set_result(self.result)
 * 
 *     cdef _on_result__simple_query(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result_status_msg.decode(self.encoding))
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__simple_query(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_result__simple_query", 0);

  /* "asyncpg/protocol/protocol.pyx":777
 * 
 *     cdef _on_result__simple_query(self, object waiter):
 *         waiter.set_result(self.result_status_msg.decode(self.encoding))             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__copy_out(self, object waiter):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.result_status_msg, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 777, __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_self->__pyx_base.encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->__pyx_base.encoding);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __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(1, 777, __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;

  /* "asyncpg/protocol/protocol.pyx":776
 *         waiter.set_result(self.result)
 * 
 *     cdef _on_result__simple_query(self, object waiter):             # <<<<<<<<<<<<<<
 *         waiter.set_result(self.result_status_msg.decode(self.encoding))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_result__simple_query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":779
 *         waiter.set_result(self.result_status_msg.decode(self.encoding))
 * 
 *     cdef _on_result__copy_out(self, object waiter):             # <<<<<<<<<<<<<<
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE
 *         if copy_done:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_out(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  int __pyx_v_copy_done;
  PyObject *__pyx_v_status_msg = NULL;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_result__copy_out", 0);

  /* "asyncpg/protocol/protocol.pyx":780
 * 
 *     cdef _on_result__copy_out(self, object waiter):
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE             # <<<<<<<<<<<<<<
 *         if copy_done:
 *             status_msg = self.result_status_msg.decode(self.encoding)
 */
  __pyx_v_copy_done = (__pyx_v_self->__pyx_base.state == __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE);

  /* "asyncpg/protocol/protocol.pyx":781
 *     cdef _on_result__copy_out(self, object waiter):
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE
 *         if copy_done:             # <<<<<<<<<<<<<<
 *             status_msg = self.result_status_msg.decode(self.encoding)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_copy_done != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":782
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE
 *         if copy_done:
 *             status_msg = self.result_status_msg.decode(self.encoding)             # <<<<<<<<<<<<<<
 *         else:
 *             status_msg = None
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.result_status_msg, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __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_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_self->__pyx_base.encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->__pyx_base.encoding);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_status_msg = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "asyncpg/protocol/protocol.pyx":781
 *     cdef _on_result__copy_out(self, object waiter):
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE
 *         if copy_done:             # <<<<<<<<<<<<<<
 *             status_msg = self.result_status_msg.decode(self.encoding)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":784
 *             status_msg = self.result_status_msg.decode(self.encoding)
 *         else:
 *             status_msg = None             # <<<<<<<<<<<<<<
 * 
 *         # We need to put some backpressure on Postgres
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_status_msg = Py_None;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/protocol.pyx":788
 *         # We need to put some backpressure on Postgres
 *         # here in case the sink is slow to process the output.
 *         self.pause_reading()             # <<<<<<<<<<<<<<
 * 
 *         waiter.set_result((self.result, copy_done, status_msg))
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_pause_reading(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":790
 *         self.pause_reading()
 * 
 *         waiter.set_result((self.result, copy_done, status_msg))             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result__copy_in(self, object waiter):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_copy_done); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.result);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->__pyx_base.result);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_status_msg);
  __Pyx_GIVEREF(__pyx_v_status_msg);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_status_msg);
  __pyx_t_4 = 0;
  __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_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 790, __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;

  /* "asyncpg/protocol/protocol.pyx":779
 *         waiter.set_result(self.result_status_msg.decode(self.encoding))
 * 
 *     cdef _on_result__copy_out(self, object waiter):             # <<<<<<<<<<<<<<
 *         cdef bint copy_done = self.state == PROTOCOL_COPY_OUT_DONE
 *         if copy_done:
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_result__copy_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_status_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":792
 *         waiter.set_result((self.result, copy_done, status_msg))
 * 
 *     cdef _on_result__copy_in(self, object waiter):             # <<<<<<<<<<<<<<
 *         status_msg = self.result_status_msg.decode(self.encoding)
 *         waiter.set_result(status_msg)
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_in(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  PyObject *__pyx_v_status_msg = NULL;
  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_result__copy_in", 0);

  /* "asyncpg/protocol/protocol.pyx":793
 * 
 *     cdef _on_result__copy_in(self, object waiter):
 *         status_msg = self.result_status_msg.decode(self.encoding)             # <<<<<<<<<<<<<<
 *         waiter.set_result(status_msg)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.result_status_msg, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 793, __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_self->__pyx_base.encoding) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base.encoding);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_status_msg = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":794
 *     cdef _on_result__copy_in(self, object waiter):
 *         status_msg = self.result_status_msg.decode(self.encoding)
 *         waiter.set_result(status_msg)             # <<<<<<<<<<<<<<
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 794, __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_status_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_status_msg);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __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;

  /* "asyncpg/protocol/protocol.pyx":792
 *         waiter.set_result((self.result, copy_done, status_msg))
 * 
 *     cdef _on_result__copy_in(self, object waiter):             # <<<<<<<<<<<<<<
 *         status_msg = self.result_status_msg.decode(self.encoding)
 *         waiter.set_result(status_msg)
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_result__copy_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_status_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":796
 *         waiter.set_result(status_msg)
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):             # <<<<<<<<<<<<<<
 *         if PG_DEBUG:
 *             if self.statement is None:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__decode_row(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, char const *__pyx_v_buf, Py_ssize_t __pyx_v_buf_len) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decode_row", 0);

  /* "asyncpg/protocol/protocol.pyx":797
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(
 */
  __pyx_t_1 = (PG_DEBUG != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":798
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 *         if PG_DEBUG:
 *             if self.statement is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_decode_row: statement is None')
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->statement) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (unlikely(__pyx_t_2)) {

      /* "asyncpg/protocol/protocol.pyx":799
 *         if PG_DEBUG:
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     '_decode_row: statement is None')
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 799, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 799, __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 && unlikely(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_u_decode_row_statement_is_None) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_decode_row_statement_is_None);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 799, __pyx_L1_error)

      /* "asyncpg/protocol/protocol.pyx":798
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 *         if PG_DEBUG:
 *             if self.statement is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError(
 *                     '_decode_row: statement is None')
 */
    }

    /* "asyncpg/protocol/protocol.pyx":797
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if self.statement is None:
 *                 raise apg_exc.InternalClientError(
 */
  }

  /* "asyncpg/protocol/protocol.pyx":802
 *                     '_decode_row: statement is None')
 * 
 *         return self.statement._decode_row(buf, buf_len)             # <<<<<<<<<<<<<<
 * 
 *     cdef _dispatch_result(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__decode_row(__pyx_v_self->statement, __pyx_v_buf, __pyx_v_buf_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":796
 *         waiter.set_result(status_msg)
 * 
 *     cdef _decode_row(self, const char* buf, ssize_t buf_len):             # <<<<<<<<<<<<<<
 *         if PG_DEBUG:
 *             if self.statement is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._decode_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":804
 *         return self.statement._decode_row(buf, buf_len)
 * 
 *     cdef _dispatch_result(self):             # <<<<<<<<<<<<<<
 *         waiter = self.waiter
 *         self.waiter = None
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__dispatch_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_v_waiter = NULL;
  PyObject *__pyx_v_exc = NULL;
  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;
  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;
  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("_dispatch_result", 0);

  /* "asyncpg/protocol/protocol.pyx":805
 * 
 *     cdef _dispatch_result(self):
 *         waiter = self.waiter             # <<<<<<<<<<<<<<
 *         self.waiter = None
 * 
 */
  __pyx_t_1 = __pyx_v_self->waiter;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_waiter = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":806
 *     cdef _dispatch_result(self):
 *         waiter = self.waiter
 *         self.waiter = None             # <<<<<<<<<<<<<<
 * 
 *         if PG_DEBUG:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->waiter);
  __Pyx_DECREF(__pyx_v_self->waiter);
  __pyx_v_self->waiter = Py_None;

  /* "asyncpg/protocol/protocol.pyx":808
 *         self.waiter = None
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if waiter is None:
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 */
  __pyx_t_2 = (PG_DEBUG != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":809
 * 
 *         if PG_DEBUG:
 *             if waiter is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 * 
 */
    __pyx_t_2 = (__pyx_v_waiter == Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (unlikely(__pyx_t_3)) {

      /* "asyncpg/protocol/protocol.pyx":810
 *         if PG_DEBUG:
 *             if waiter is None:
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')             # <<<<<<<<<<<<<<
 * 
 *         if waiter.cancelled():
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 810, __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 && unlikely(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_kp_u_on_result_waiter_is_None) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_on_result_waiter_is_None);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 810, __pyx_L1_error)

      /* "asyncpg/protocol/protocol.pyx":809
 * 
 *         if PG_DEBUG:
 *             if waiter is None:             # <<<<<<<<<<<<<<
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 * 
 */
    }

    /* "asyncpg/protocol/protocol.pyx":808
 *         self.waiter = None
 * 
 *         if PG_DEBUG:             # <<<<<<<<<<<<<<
 *             if waiter is None:
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 */
  }

  /* "asyncpg/protocol/protocol.pyx":812
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 * 
 *         if waiter.cancelled():             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_cancelled); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 812, __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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":813
 * 
 *         if waiter.cancelled():
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if waiter.done():
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":812
 *                 raise apg_exc.InternalClientError('_on_result: waiter is None')
 * 
 *         if waiter.cancelled():             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":815
 *             return
 * 
 *         if waiter.done():             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('_on_result: waiter is done')
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 815, __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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 815, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "asyncpg/protocol/protocol.pyx":816
 * 
 *         if waiter.done():
 *             raise apg_exc.InternalClientError('_on_result: waiter is done')             # <<<<<<<<<<<<<<
 * 
 *         if self.result_type == RESULT_FAILED:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 816, __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 && 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_kp_u_on_result_waiter_is_done) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_on_result_waiter_is_done);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(1, 816, __pyx_L1_error)

    /* "asyncpg/protocol/protocol.pyx":815
 *             return
 * 
 *         if waiter.done():             # <<<<<<<<<<<<<<
 *             raise apg_exc.InternalClientError('_on_result: waiter is done')
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":818
 *             raise apg_exc.InternalClientError('_on_result: waiter is done')
 * 
 *         if self.result_type == RESULT_FAILED:             # <<<<<<<<<<<<<<
 *             if isinstance(self.result, dict):
 *                 exc = apg_exc_base.PostgresError.new(
 */
  __pyx_t_3 = ((__pyx_v_self->__pyx_base.result_type == __pyx_e_7asyncpg_8protocol_8protocol_RESULT_FAILED) != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":819
 * 
 *         if self.result_type == RESULT_FAILED:
 *             if isinstance(self.result, dict):             # <<<<<<<<<<<<<<
 *                 exc = apg_exc_base.PostgresError.new(
 *                     self.result, query=self.last_query)
 */
    __pyx_t_1 = __pyx_v_self->__pyx_base.result;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = PyDict_Check(__pyx_t_1); 
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/protocol.pyx":820
 *         if self.result_type == RESULT_FAILED:
 *             if isinstance(self.result, dict):
 *                 exc = apg_exc_base.PostgresError.new(             # <<<<<<<<<<<<<<
 *                     self.result, query=self.last_query)
 *             else:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_apg_exc_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PostgresError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "asyncpg/protocol/protocol.pyx":821
 *             if isinstance(self.result, dict):
 *                 exc = apg_exc_base.PostgresError.new(
 *                     self.result, query=self.last_query)             # <<<<<<<<<<<<<<
 *             else:
 *                 exc = self.result
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_self->__pyx_base.result);
      __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->__pyx_base.result);
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 821, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_query, __pyx_v_self->last_query) < 0) __PYX_ERR(1, 821, __pyx_L1_error)

      /* "asyncpg/protocol/protocol.pyx":820
 *         if self.result_type == RESULT_FAILED:
 *             if isinstance(self.result, dict):
 *                 exc = apg_exc_base.PostgresError.new(             # <<<<<<<<<<<<<<
 *                     self.result, query=self.last_query)
 *             else:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_exc = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "asyncpg/protocol/protocol.pyx":819
 * 
 *         if self.result_type == RESULT_FAILED:
 *             if isinstance(self.result, dict):             # <<<<<<<<<<<<<<
 *                 exc = apg_exc_base.PostgresError.new(
 *                     self.result, query=self.last_query)
 */
      goto __pyx_L8;
    }

    /* "asyncpg/protocol/protocol.pyx":823
 *                     self.result, query=self.last_query)
 *             else:
 *                 exc = self.result             # <<<<<<<<<<<<<<
 *             waiter.set_exception(exc)
 *             return
 */
    /*else*/ {
      __pyx_t_6 = __pyx_v_self->__pyx_base.result;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_exc = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __pyx_L8:;

    /* "asyncpg/protocol/protocol.pyx":824
 *             else:
 *                 exc = self.result
 *             waiter.set_exception(exc)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __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_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_exc) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_exc);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/protocol.pyx":825
 *                 exc = self.result
 *             waiter.set_exception(exc)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":818
 *             raise apg_exc.InternalClientError('_on_result: waiter is done')
 * 
 *         if self.result_type == RESULT_FAILED:             # <<<<<<<<<<<<<<
 *             if isinstance(self.result, dict):
 *                 exc = apg_exc_base.PostgresError.new(
 */
  }

  /* "asyncpg/protocol/protocol.pyx":827
 *             return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.state == PROTOCOL_AUTH:
 *                 self._on_result__connect(waiter)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "asyncpg/protocol/protocol.pyx":828
 * 
 *         try:
 *             if self.state == PROTOCOL_AUTH:             # <<<<<<<<<<<<<<
 *                 self._on_result__connect(waiter)
 * 
 */
      switch (__pyx_v_self->__pyx_base.state) {
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_AUTH:

        /* "asyncpg/protocol/protocol.pyx":829
 *         try:
 *             if self.state == PROTOCOL_AUTH:
 *                 self._on_result__connect(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_PREPARE:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__connect(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 829, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":828
 * 
 *         try:
 *             if self.state == PROTOCOL_AUTH:             # <<<<<<<<<<<<<<
 *                 self._on_result__connect(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_PREPARE:

        /* "asyncpg/protocol/protocol.pyx":832
 * 
 *             elif self.state == PROTOCOL_PREPARE:
 *                 self._on_result__prepare(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__prepare(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 832, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":831
 *                 self._on_result__connect(waiter)
 * 
 *             elif self.state == PROTOCOL_PREPARE:             # <<<<<<<<<<<<<<
 *                 self._on_result__prepare(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE:

        /* "asyncpg/protocol/protocol.pyx":835
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE:
 *                 self._on_result__bind_and_exec(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE_MANY:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__bind_and_exec(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 835, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":834
 *                 self._on_result__prepare(waiter)
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE:             # <<<<<<<<<<<<<<
 *                 self._on_result__bind_and_exec(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND_EXECUTE_MANY:

        /* "asyncpg/protocol/protocol.pyx":838
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE_MANY:
 *                 self._on_result__bind_and_exec(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_EXECUTE:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__bind_and_exec(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 838, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":837
 *                 self._on_result__bind_and_exec(waiter)
 * 
 *             elif self.state == PROTOCOL_BIND_EXECUTE_MANY:             # <<<<<<<<<<<<<<
 *                 self._on_result__bind_and_exec(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_EXECUTE:

        /* "asyncpg/protocol/protocol.pyx":841
 * 
 *             elif self.state == PROTOCOL_EXECUTE:
 *                 self._on_result__bind_and_exec(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_BIND:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__bind_and_exec(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 841, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":840
 *                 self._on_result__bind_and_exec(waiter)
 * 
 *             elif self.state == PROTOCOL_EXECUTE:             # <<<<<<<<<<<<<<
 *                 self._on_result__bind_and_exec(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_BIND:

        /* "asyncpg/protocol/protocol.pyx":844
 * 
 *             elif self.state == PROTOCOL_BIND:
 *                 self._on_result__bind(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_CLOSE_STMT_PORTAL:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__bind(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 844, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":843
 *                 self._on_result__bind_and_exec(waiter)
 * 
 *             elif self.state == PROTOCOL_BIND:             # <<<<<<<<<<<<<<
 *                 self._on_result__bind(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_CLOSE_STMT_PORTAL:

        /* "asyncpg/protocol/protocol.pyx":847
 * 
 *             elif self.state == PROTOCOL_CLOSE_STMT_PORTAL:
 *                 self._on_result__close_stmt_or_portal(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_SIMPLE_QUERY:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__close_stmt_or_portal(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 847, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":846
 *                 self._on_result__bind(waiter)
 * 
 *             elif self.state == PROTOCOL_CLOSE_STMT_PORTAL:             # <<<<<<<<<<<<<<
 *                 self._on_result__close_stmt_or_portal(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_SIMPLE_QUERY:

        /* "asyncpg/protocol/protocol.pyx":850
 * 
 *             elif self.state == PROTOCOL_SIMPLE_QUERY:
 *                 self._on_result__simple_query(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA or
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__simple_query(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 850, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":849
 *                 self._on_result__close_stmt_or_portal(waiter)
 * 
 *             elif self.state == PROTOCOL_SIMPLE_QUERY:             # <<<<<<<<<<<<<<
 *                 self._on_result__simple_query(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DATA:

        /* "asyncpg/protocol/protocol.pyx":852
 *                 self._on_result__simple_query(waiter)
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA or             # <<<<<<<<<<<<<<
 *                     self.state == PROTOCOL_COPY_OUT_DONE):
 *                 self._on_result__copy_out(waiter)
 */
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_OUT_DONE:

        /* "asyncpg/protocol/protocol.pyx":854
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA or
 *                     self.state == PROTOCOL_COPY_OUT_DONE):
 *                 self._on_result__copy_out(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_COPY_IN_DATA:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__copy_out(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 854, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":852
 *                 self._on_result__simple_query(waiter)
 * 
 *             elif (self.state == PROTOCOL_COPY_OUT_DATA or             # <<<<<<<<<<<<<<
 *                     self.state == PROTOCOL_COPY_OUT_DONE):
 *                 self._on_result__copy_out(waiter)
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_COPY_IN_DATA:

        /* "asyncpg/protocol/protocol.pyx":857
 * 
 *             elif self.state == PROTOCOL_COPY_IN_DATA:
 *                 self._on_result__copy_in(waiter)             # <<<<<<<<<<<<<<
 * 
 *             elif self.state == PROTOCOL_TERMINATING:
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_result__copy_in(__pyx_v_self, __pyx_v_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 857, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "asyncpg/protocol/protocol.pyx":856
 *                 self._on_result__copy_out(waiter)
 * 
 *             elif self.state == PROTOCOL_COPY_IN_DATA:             # <<<<<<<<<<<<<<
 *                 self._on_result__copy_in(waiter)
 * 
 */
        break;
        case __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_TERMINATING:

        /* "asyncpg/protocol/protocol.pyx":859
 *                 self._on_result__copy_in(waiter)
 * 
 *             elif self.state == PROTOCOL_TERMINATING:             # <<<<<<<<<<<<<<
 *                 # We are waiting for the connection to drop, so
 *                 # ignore any stray results at this point.
 */
        break;
        default:

        /* "asyncpg/protocol/protocol.pyx":865
 * 
 *             else:
 *                 raise apg_exc.InternalClientError(             # <<<<<<<<<<<<<<
 *                     'got result for unknown protocol state {}'.
 *                     format(self.state))
 */
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_apg_exc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 865, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_InternalClientError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "asyncpg/protocol/protocol.pyx":866
 *             else:
 *                 raise apg_exc.InternalClientError(
 *                     'got result for unknown protocol state {}'.             # <<<<<<<<<<<<<<
 *                     format(self.state))
 * 
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_got_result_for_unknown_protocol, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 866, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_1);

        /* "asyncpg/protocol/protocol.pyx":867
 *                 raise apg_exc.InternalClientError(
 *                     'got result for unknown protocol state {}'.
 *                     format(self.state))             # <<<<<<<<<<<<<<
 * 
 *         except Exception as exc:
 */
        __pyx_t_10 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_self->__pyx_base.state); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 867, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 867, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(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_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 865, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(1, 865, __pyx_L9_error)
        break;
      }

      /* "asyncpg/protocol/protocol.pyx":827
 *             return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.state == PROTOCOL_AUTH:
 *                 self._on_result__connect(waiter)
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L14_try_end;
    __pyx_L9_error:;
    __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_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/protocol.pyx":869
 *                     format(self.state))
 * 
 *         except Exception as exc:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(exc)
 * 
 */
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_12) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._dispatch_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(1, 869, __pyx_L11_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_exc = __pyx_t_4;
      /*try:*/ {

        /* "asyncpg/protocol/protocol.pyx":870
 * 
 *         except Exception as exc:
 *             waiter.set_exception(exc)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_result(self):
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 870, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_v_exc) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_exc);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }

      /* "asyncpg/protocol/protocol.pyx":869
 *                     format(self.state))
 * 
 *         except Exception as exc:             # <<<<<<<<<<<<<<
 *             waiter.set_exception(exc)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_exc);
          __pyx_v_exc = NULL;
          goto __pyx_L21;
        }
        __pyx_L20_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_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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;
          {
            __Pyx_DECREF(__pyx_v_exc);
            __pyx_v_exc = NULL;
          }
          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_L11_except_error;
        }
        __pyx_L21:;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L10_exception_handled;
    }
    goto __pyx_L11_except_error;
    __pyx_L11_except_error:;

    /* "asyncpg/protocol/protocol.pyx":827
 *             return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.state == PROTOCOL_AUTH:
 *                 self._on_result__connect(waiter)
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L10_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L14_try_end:;
  }

  /* "asyncpg/protocol/protocol.pyx":804
 *         return self.statement._decode_row(buf, buf_len)
 * 
 *     cdef _dispatch_result(self):             # <<<<<<<<<<<<<<
 *         waiter = self.waiter
 *         self.waiter = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._dispatch_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_waiter);
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":872
 *             waiter.set_exception(exc)
 * 
 *     cdef _on_result(self):             # <<<<<<<<<<<<<<
 *         if self.timeout_handle is not None:
 *             self.timeout_handle.cancel()
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_result", 0);

  /* "asyncpg/protocol/protocol.pyx":873
 * 
 *     cdef _on_result(self):
 *         if self.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             self.timeout_handle.cancel()
 *             self.timeout_handle = None
 */
  __pyx_t_1 = (__pyx_v_self->timeout_handle != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":874
 *     cdef _on_result(self):
 *         if self.timeout_handle is not None:
 *             self.timeout_handle.cancel()             # <<<<<<<<<<<<<<
 *             self.timeout_handle = None
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->timeout_handle, __pyx_n_s_cancel); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 874, __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_3 = (__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_3)) __PYX_ERR(1, 874, __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;

    /* "asyncpg/protocol/protocol.pyx":875
 *         if self.timeout_handle is not None:
 *             self.timeout_handle.cancel()
 *             self.timeout_handle = None             # <<<<<<<<<<<<<<
 * 
 *         if self.cancel_waiter is not None:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->timeout_handle);
    __Pyx_DECREF(__pyx_v_self->timeout_handle);
    __pyx_v_self->timeout_handle = Py_None;

    /* "asyncpg/protocol/protocol.pyx":873
 * 
 *     cdef _on_result(self):
 *         if self.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             self.timeout_handle.cancel()
 *             self.timeout_handle = None
 */
  }

  /* "asyncpg/protocol/protocol.pyx":877
 *             self.timeout_handle = None
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             # We have received the result of a cancelled command.
 *             if not self.cancel_waiter.done():
 */
  __pyx_t_2 = (__pyx_v_self->cancel_waiter != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":879
 *         if self.cancel_waiter is not None:
 *             # We have received the result of a cancelled command.
 *             if not self.cancel_waiter.done():             # <<<<<<<<<<<<<<
 *                 # The cancellation future might have been cancelled
 *                 # by the cancellation of the entire task running the query.
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cancel_waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 879, __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_3 = (__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_3)) __PYX_ERR(1, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 879, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = ((!__pyx_t_1) != 0);
    if (__pyx_t_2) {

      /* "asyncpg/protocol/protocol.pyx":882
 *                 # The cancellation future might have been cancelled
 *                 # by the cancellation of the entire task running the query.
 *                 self.cancel_waiter.set_result(None)             # <<<<<<<<<<<<<<
 *             self.cancel_waiter = None
 *             if self.waiter is not None and self.waiter.done():
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->cancel_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 882, __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, Py_None) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_None);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 882, __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;

      /* "asyncpg/protocol/protocol.pyx":879
 *         if self.cancel_waiter is not None:
 *             # We have received the result of a cancelled command.
 *             if not self.cancel_waiter.done():             # <<<<<<<<<<<<<<
 *                 # The cancellation future might have been cancelled
 *                 # by the cancellation of the entire task running the query.
 */
    }

    /* "asyncpg/protocol/protocol.pyx":883
 *                 # by the cancellation of the entire task running the query.
 *                 self.cancel_waiter.set_result(None)
 *             self.cancel_waiter = None             # <<<<<<<<<<<<<<
 *             if self.waiter is not None and self.waiter.done():
 *                 self.waiter = None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->cancel_waiter);
    __Pyx_DECREF(__pyx_v_self->cancel_waiter);
    __pyx_v_self->cancel_waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":884
 *                 self.cancel_waiter.set_result(None)
 *             self.cancel_waiter = None
 *             if self.waiter is not None and self.waiter.done():             # <<<<<<<<<<<<<<
 *                 self.waiter = None
 *             if self.waiter is None:
 */
    __pyx_t_1 = (__pyx_v_self->waiter != Py_None);
    __pyx_t_6 = (__pyx_t_1 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_2 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __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_3 = (__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_3)) __PYX_ERR(1, 884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_2) {

      /* "asyncpg/protocol/protocol.pyx":885
 *             self.cancel_waiter = None
 *             if self.waiter is not None and self.waiter.done():
 *                 self.waiter = None             # <<<<<<<<<<<<<<
 *             if self.waiter is None:
 *                 return
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->waiter);
      __Pyx_DECREF(__pyx_v_self->waiter);
      __pyx_v_self->waiter = Py_None;

      /* "asyncpg/protocol/protocol.pyx":884
 *                 self.cancel_waiter.set_result(None)
 *             self.cancel_waiter = None
 *             if self.waiter is not None and self.waiter.done():             # <<<<<<<<<<<<<<
 *                 self.waiter = None
 *             if self.waiter is None:
 */
    }

    /* "asyncpg/protocol/protocol.pyx":886
 *             if self.waiter is not None and self.waiter.done():
 *                 self.waiter = None
 *             if self.waiter is None:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_2 = (__pyx_v_self->waiter == Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (__pyx_t_6) {

      /* "asyncpg/protocol/protocol.pyx":887
 *                 self.waiter = None
 *             if self.waiter is None:
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "asyncpg/protocol/protocol.pyx":886
 *             if self.waiter is not None and self.waiter.done():
 *                 self.waiter = None
 *             if self.waiter is None:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    }

    /* "asyncpg/protocol/protocol.pyx":877
 *             self.timeout_handle = None
 * 
 *         if self.cancel_waiter is not None:             # <<<<<<<<<<<<<<
 *             # We have received the result of a cancelled command.
 *             if not self.cancel_waiter.done():
 */
  }

  /* "asyncpg/protocol/protocol.pyx":889
 *                 return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._dispatch_result()
 *         finally:
 */
  /*try:*/ {

    /* "asyncpg/protocol/protocol.pyx":890
 * 
 *         try:
 *             self._dispatch_result()             # <<<<<<<<<<<<<<
 *         finally:
 *             self.statement = None
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_dispatch_result(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "asyncpg/protocol/protocol.pyx":892
 *             self._dispatch_result()
 *         finally:
 *             self.statement = None             # <<<<<<<<<<<<<<
 *             self.last_query = None
 *             self.return_extra = False
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->statement);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->statement));
      __pyx_v_self->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None);

      /* "asyncpg/protocol/protocol.pyx":893
 *         finally:
 *             self.statement = None
 *             self.last_query = None             # <<<<<<<<<<<<<<
 *             self.return_extra = False
 * 
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->last_query);
      __Pyx_DECREF(__pyx_v_self->last_query);
      __pyx_v_self->last_query = ((PyObject*)Py_None);

      /* "asyncpg/protocol/protocol.pyx":894
 *             self.statement = None
 *             self.last_query = None
 *             self.return_extra = False             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_notice(self, parsed):
 */
      __pyx_v_self->return_extra = 0;
      goto __pyx_L12;
    }
    __pyx_L11_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 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;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {

        /* "asyncpg/protocol/protocol.pyx":892
 *             self._dispatch_result()
 *         finally:
 *             self.statement = None             # <<<<<<<<<<<<<<
 *             self.last_query = None
 *             self.return_extra = False
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->statement);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->statement));
        __pyx_v_self->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None);

        /* "asyncpg/protocol/protocol.pyx":893
 *         finally:
 *             self.statement = None
 *             self.last_query = None             # <<<<<<<<<<<<<<
 *             self.return_extra = False
 * 
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->last_query);
        __Pyx_DECREF(__pyx_v_self->last_query);
        __pyx_v_self->last_query = ((PyObject*)Py_None);

        /* "asyncpg/protocol/protocol.pyx":894
 *             self.statement = None
 *             self.last_query = None
 *             self.return_extra = False             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_notice(self, parsed):
 */
        __pyx_v_self->return_extra = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
    }
    __pyx_L12:;
  }

  /* "asyncpg/protocol/protocol.pyx":872
 *             waiter.set_exception(exc)
 * 
 *     cdef _on_result(self):             # <<<<<<<<<<<<<<
 *         if self.timeout_handle is not None:
 *             self.timeout_handle.cancel()
 */

  /* 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_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":896
 *             self.return_extra = False
 * 
 *     cdef _on_notice(self, parsed):             # <<<<<<<<<<<<<<
 *         con = self.get_connection()
 *         if con is not None:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notice(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_parsed) {
  PyObject *__pyx_v_con = NULL;
  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("_on_notice", 0);

  /* "asyncpg/protocol/protocol.pyx":897
 * 
 *     cdef _on_notice(self, parsed):
 *         con = self.get_connection()             # <<<<<<<<<<<<<<
 *         if con is not None:
 *             con._process_log_message(parsed, self.last_query)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_connection(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_con = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":898
 *     cdef _on_notice(self, parsed):
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             con._process_log_message(parsed, self.last_query)
 * 
 */
  __pyx_t_2 = (__pyx_v_con != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":899
 *         con = self.get_connection()
 *         if con is not None:
 *             con._process_log_message(parsed, self.last_query)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_notification(self, pid, channel, payload):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_con, __pyx_n_s_process_log_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __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[3] = {__pyx_t_5, __pyx_v_parsed, __pyx_v_self->last_query};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 899, __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[3] = {__pyx_t_5, __pyx_v_parsed, __pyx_v_self->last_query};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 899, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 899, __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_parsed);
      __Pyx_GIVEREF(__pyx_v_parsed);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_parsed);
      __Pyx_INCREF(__pyx_v_self->last_query);
      __Pyx_GIVEREF(__pyx_v_self->last_query);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self->last_query);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 899, __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;

    /* "asyncpg/protocol/protocol.pyx":898
 *     cdef _on_notice(self, parsed):
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             con._process_log_message(parsed, self.last_query)
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":896
 *             self.return_extra = False
 * 
 *     cdef _on_notice(self, parsed):             # <<<<<<<<<<<<<<
 *         con = self.get_connection()
 *         if con is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_notice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_con);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":901
 *             con._process_log_message(parsed, self.last_query)
 * 
 *     cdef _on_notification(self, pid, channel, payload):             # <<<<<<<<<<<<<<
 *         con = self.get_connection()
 *         if con is not None:
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notification(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_pid, PyObject *__pyx_v_channel, PyObject *__pyx_v_payload) {
  PyObject *__pyx_v_con = NULL;
  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("_on_notification", 0);

  /* "asyncpg/protocol/protocol.pyx":902
 * 
 *     cdef _on_notification(self, pid, channel, payload):
 *         con = self.get_connection()             # <<<<<<<<<<<<<<
 *         if con is not None:
 *             con._process_notification(pid, channel, payload)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_connection(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_con = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":903
 *     cdef _on_notification(self, pid, channel, payload):
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             con._process_notification(pid, channel, payload)
 * 
 */
  __pyx_t_2 = (__pyx_v_con != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":904
 *         con = self.get_connection()
 *         if con is not None:
 *             con._process_notification(pid, channel, payload)             # <<<<<<<<<<<<<<
 * 
 *     cdef _on_connection_lost(self, exc):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_con, __pyx_n_s_process_notification); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 904, __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_pid, __pyx_v_channel, __pyx_v_payload};
      __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(1, 904, __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_pid, __pyx_v_channel, __pyx_v_payload};
      __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(1, 904, __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(1, 904, __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_pid);
      __Pyx_GIVEREF(__pyx_v_pid);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_pid);
      __Pyx_INCREF(__pyx_v_channel);
      __Pyx_GIVEREF(__pyx_v_channel);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_channel);
      __Pyx_INCREF(__pyx_v_payload);
      __Pyx_GIVEREF(__pyx_v_payload);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_payload);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 904, __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;

    /* "asyncpg/protocol/protocol.pyx":903
 *     cdef _on_notification(self, pid, channel, payload):
 *         con = self.get_connection()
 *         if con is not None:             # <<<<<<<<<<<<<<
 *             con._process_notification(pid, channel, payload)
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":901
 *             con._process_log_message(parsed, self.last_query)
 * 
 *     cdef _on_notification(self, pid, channel, payload):             # <<<<<<<<<<<<<<
 *         con = self.get_connection()
 *         if con is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol._on_notification", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_con);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":906
 *             con._process_notification(pid, channel, payload)
 * 
 *     cdef _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             # The connection was lost because
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc) {
  PyObject *__pyx_v_con = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __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("_on_connection_lost", 0);

  /* "asyncpg/protocol/protocol.pyx":907
 * 
 *     cdef _on_connection_lost(self, exc):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             # The connection was lost because
 *             # Protocol.close() was called
 */
  __pyx_t_1 = (__pyx_v_self->closing != 0);
  if (__pyx_t_1) {

    /* "asyncpg/protocol/protocol.pyx":910
 *             # The connection was lost because
 *             # Protocol.close() was called
 *             if self.waiter is not None and not self.waiter.done():             # <<<<<<<<<<<<<<
 *                 if exc is None:
 *                     self.waiter.set_result(None)
 */
    __pyx_t_2 = (__pyx_v_self->waiter != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 910, __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(1, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 910, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = ((!__pyx_t_3) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "asyncpg/protocol/protocol.pyx":911
 *             # Protocol.close() was called
 *             if self.waiter is not None and not self.waiter.done():
 *                 if exc is None:             # <<<<<<<<<<<<<<
 *                     self.waiter.set_result(None)
 *                 else:
 */
      __pyx_t_1 = (__pyx_v_exc == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "asyncpg/protocol/protocol.pyx":912
 *             if self.waiter is not None and not self.waiter.done():
 *                 if exc is None:
 *                     self.waiter.set_result(None)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.waiter.set_exception(exc)
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 912, __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_Call2Args(__pyx_t_5, __pyx_t_6, Py_None) : __Pyx_PyObject_CallOneArg(__pyx_t_5, Py_None);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 912, __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;

        /* "asyncpg/protocol/protocol.pyx":911
 *             # Protocol.close() was called
 *             if self.waiter is not None and not self.waiter.done():
 *                 if exc is None:             # <<<<<<<<<<<<<<
 *                     self.waiter.set_result(None)
 *                 else:
 */
        goto __pyx_L7;
      }

      /* "asyncpg/protocol/protocol.pyx":914
 *                     self.waiter.set_result(None)
 *                 else:
 *                     self.waiter.set_exception(exc)             # <<<<<<<<<<<<<<
 *             self.waiter = None
 *         else:
 */
      /*else*/ {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __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_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_exc) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_exc);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 914, __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;
      }
      __pyx_L7:;

      /* "asyncpg/protocol/protocol.pyx":910
 *             # The connection was lost because
 *             # Protocol.close() was called
 *             if self.waiter is not None and not self.waiter.done():             # <<<<<<<<<<<<<<
 *                 if exc is None:
 *                     self.waiter.set_result(None)
 */
    }

    /* "asyncpg/protocol/protocol.pyx":915
 *                 else:
 *                     self.waiter.set_exception(exc)
 *             self.waiter = None             # <<<<<<<<<<<<<<
 *         else:
 *             # The connection was lost because it was
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->waiter);
    __Pyx_DECREF(__pyx_v_self->waiter);
    __pyx_v_self->waiter = Py_None;

    /* "asyncpg/protocol/protocol.pyx":907
 * 
 *     cdef _on_connection_lost(self, exc):
 *         if self.closing:             # <<<<<<<<<<<<<<
 *             # The connection was lost because
 *             # Protocol.close() was called
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":920
 *             # terminated or due to another error;
 *             # Throw an error in any awaiting waiter.
 *             self.closing = True             # <<<<<<<<<<<<<<
 *             # Cleanup the connection resources, including, possibly,
 *             # releasing the pool holder.
 */
  /*else*/ {
    __pyx_v_self->closing = 1;

    /* "asyncpg/protocol/protocol.pyx":923
 *             # Cleanup the connection resources, including, possibly,
 *             # releasing the pool holder.
 *             con = self.get_connection()             # <<<<<<<<<<<<<<
 *             if con is not None:
 *                 con._cleanup()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_connection(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_con = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":924
 *             # releasing the pool holder.
 *             con = self.get_connection()
 *             if con is not None:             # <<<<<<<<<<<<<<
 *                 con._cleanup()
 *             self._handle_waiter_on_connection_lost(exc)
 */
    __pyx_t_2 = (__pyx_v_con != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "asyncpg/protocol/protocol.pyx":925
 *             con = self.get_connection()
 *             if con is not None:
 *                 con._cleanup()             # <<<<<<<<<<<<<<
 *             self._handle_waiter_on_connection_lost(exc)
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_con, __pyx_n_s_cleanup); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 925, __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(1, 925, __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;

      /* "asyncpg/protocol/protocol.pyx":924
 *             # releasing the pool holder.
 *             con = self.get_connection()
 *             if con is not None:             # <<<<<<<<<<<<<<
 *                 con._cleanup()
 *             self._handle_waiter_on_connection_lost(exc)
 */
    }

    /* "asyncpg/protocol/protocol.pyx":926
 *             if con is not None:
 *                 con._cleanup()
 *             self._handle_waiter_on_connection_lost(exc)             # <<<<<<<<<<<<<<
 * 
 *     cdef _write(self, buf):
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_handle_waiter_on_connection_lost(__pyx_v_self, __pyx_v_exc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/protocol.pyx":906
 *             con._process_notification(pid, channel, payload)
 * 
 *     cdef _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         if self.closing:
 *             # The connection was lost because
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._on_connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_con);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":928
 *             self._handle_waiter_on_connection_lost(exc)
 * 
 *     cdef _write(self, buf):             # <<<<<<<<<<<<<<
 *         self.transport.write(memoryview(buf))
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__write(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_buf) {
  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("_write", 0);

  /* "asyncpg/protocol/protocol.pyx":929
 * 
 *     cdef _write(self, buf):
 *         self.transport.write(memoryview(buf))             # <<<<<<<<<<<<<<
 * 
 *     cdef _writelines(self, list buffers):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.transport, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_buf); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 929, __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_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_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __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(1, 929, __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;

  /* "asyncpg/protocol/protocol.pyx":928
 *             self._handle_waiter_on_connection_lost(exc)
 * 
 *     cdef _write(self, buf):             # <<<<<<<<<<<<<<
 *         self.transport.write(memoryview(buf))
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":931
 *         self.transport.write(memoryview(buf))
 * 
 *     cdef _writelines(self, list buffers):             # <<<<<<<<<<<<<<
 *         self.transport.writelines(buffers)
 * 
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__writelines(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_buffers) {
  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("_writelines", 0);

  /* "asyncpg/protocol/protocol.pyx":932
 * 
 *     cdef _writelines(self, list buffers):
 *         self.transport.writelines(buffers)             # <<<<<<<<<<<<<<
 * 
 *     # asyncio callbacks:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.transport, __pyx_n_s_writelines); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 932, __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_buffers) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buffers);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 932, __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;

  /* "asyncpg/protocol/protocol.pyx":931
 *         self.transport.write(memoryview(buf))
 * 
 *     cdef _writelines(self, list buffers):             # <<<<<<<<<<<<<<
 *         self.transport.writelines(buffers)
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol._writelines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":936
 *     # asyncio callbacks:
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         self.buffer.feed_data(data)
 *         self._read_server_messages()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_62data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_62data_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_7asyncpg_8protocol_8protocol_12BaseProtocol_61data_received(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_61data_received(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_data) {
  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("data_received", 0);

  /* "asyncpg/protocol/protocol.pyx":937
 * 
 *     def data_received(self, data):
 *         self.buffer.feed_data(data)             # <<<<<<<<<<<<<<
 *         self._read_server_messages()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_v_self->__pyx_base.buffer->__pyx_vtab)->feed_data(__pyx_v_self->__pyx_base.buffer, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":938
 *     def data_received(self, data):
 *         self.buffer.feed_data(data)
 *         self._read_server_messages()             # <<<<<<<<<<<<<<
 * 
 *     def connection_made(self, transport):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._read_server_messages(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":936
 *     # asyncio callbacks:
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         self.buffer.feed_data(data)
 *         self._read_server_messages()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":940
 *         self._read_server_messages()
 * 
 *     def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *         self.transport = transport
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_64connection_made(PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_64connection_made(PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_63connection_made(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_transport));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_63connection_made(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_v_ex = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  char const *__pyx_t_15;
  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;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "asyncpg/protocol/protocol.pyx":941
 * 
 *     def connection_made(self, transport):
 *         self.transport = transport             # <<<<<<<<<<<<<<
 * 
 *         sock = transport.get_extra_info('socket')
 */
  __Pyx_INCREF(__pyx_v_transport);
  __Pyx_GIVEREF(__pyx_v_transport);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.transport);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.transport);
  __pyx_v_self->__pyx_base.transport = __pyx_v_transport;

  /* "asyncpg/protocol/protocol.pyx":943
 *         self.transport = transport
 * 
 *         sock = transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         if (sock is not None and
 *               (not hasattr(socket, 'AF_UNIX')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 943, __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_u_socket) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_socket);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 943, __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;

  /* "asyncpg/protocol/protocol.pyx":944
 * 
 *         sock = transport.get_extra_info('socket')
 *         if (sock is not None and             # <<<<<<<<<<<<<<
 *               (not hasattr(socket, 'AF_UNIX')
 *                or sock.family != socket.AF_UNIX)):
 */
  __pyx_t_5 = (__pyx_v_sock != Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asyncpg/protocol/protocol.pyx":945
 *         sock = transport.get_extra_info('socket')
 *         if (sock is not None and
 *               (not hasattr(socket, 'AF_UNIX')             # <<<<<<<<<<<<<<
 *                or sock.family != socket.AF_UNIX)):
 *             sock.setsockopt(socket.IPPROTO_TCP,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_socket); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_HasAttr(__pyx_t_1, __pyx_n_u_AF_UNIX); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 945, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asyncpg/protocol/protocol.pyx":946
 *         if (sock is not None and
 *               (not hasattr(socket, 'AF_UNIX')
 *                or sock.family != socket.AF_UNIX)):             # <<<<<<<<<<<<<<
 *             sock.setsockopt(socket.IPPROTO_TCP,
 *                             socket.TCP_NODELAY, 1)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_family); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_socket); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_AF_UNIX); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 946, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;

  /* "asyncpg/protocol/protocol.pyx":944
 * 
 *         sock = transport.get_extra_info('socket')
 *         if (sock is not None and             # <<<<<<<<<<<<<<
 *               (not hasattr(socket, 'AF_UNIX')
 *                or sock.family != socket.AF_UNIX)):
 */
  if (__pyx_t_4) {

    /* "asyncpg/protocol/protocol.pyx":947
 *               (not hasattr(socket, 'AF_UNIX')
 *                or sock.family != socket.AF_UNIX)):
 *             sock.setsockopt(socket.IPPROTO_TCP,             # <<<<<<<<<<<<<<
 *                             socket.TCP_NODELAY, 1)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_socket); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/protocol.pyx":948
 *                or sock.family != socket.AF_UNIX)):
 *             sock.setsockopt(socket.IPPROTO_TCP,
 *                             socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_socket); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_9 = 0;
    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_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_7, __pyx_t_8, __pyx_int_1};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 947, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_7, __pyx_t_8, __pyx_int_1};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 947, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_int_1);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/protocol/protocol.pyx":944
 * 
 *         sock = transport.get_extra_info('socket')
 *         if (sock is not None and             # <<<<<<<<<<<<<<
 *               (not hasattr(socket, 'AF_UNIX')
 *                or sock.family != socket.AF_UNIX)):
 */
  }

  /* "asyncpg/protocol/protocol.pyx":950
 *                             socket.TCP_NODELAY, 1)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._connect()
 *         except Exception as ex:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    /*try:*/ {

      /* "asyncpg/protocol/protocol.pyx":951
 * 
 *         try:
 *             self._connect()             # <<<<<<<<<<<<<<
 *         except Exception as ex:
 *             transport.abort()
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._connect(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 951, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asyncpg/protocol/protocol.pyx":950
 *                             socket.TCP_NODELAY, 1)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._connect()
 *         except Exception as ex:
 */
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L12_try_end;
    __pyx_L7_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 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_8); __pyx_t_8 = 0;

    /* "asyncpg/protocol/protocol.pyx":952
 *         try:
 *             self._connect()
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             transport.abort()
 *             self.con_status = CONNECTION_BAD
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_9) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) __PYX_ERR(1, 952, __pyx_L9_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_ex = __pyx_t_3;
      /*try:*/ {

        /* "asyncpg/protocol/protocol.pyx":953
 *             self._connect()
 *         except Exception as ex:
 *             transport.abort()             # <<<<<<<<<<<<<<
 *             self.con_status = CONNECTION_BAD
 *             self._set_state(PROTOCOL_FAILED)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_abort); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 953, __pyx_L18_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_8 = (__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_8)) __PYX_ERR(1, 953, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "asyncpg/protocol/protocol.pyx":954
 *         except Exception as ex:
 *             transport.abort()
 *             self.con_status = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *             self._set_state(PROTOCOL_FAILED)
 *             self._on_error(ex)
 */
        __pyx_v_self->__pyx_base.con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD;

        /* "asyncpg/protocol/protocol.pyx":955
 *             transport.abort()
 *             self.con_status = CONNECTION_BAD
 *             self._set_state(PROTOCOL_FAILED)             # <<<<<<<<<<<<<<
 *             self._on_error(ex)
 * 
 */
        __pyx_t_8 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 955, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "asyncpg/protocol/protocol.pyx":956
 *             self.con_status = CONNECTION_BAD
 *             self._set_state(PROTOCOL_FAILED)
 *             self._on_error(ex)             # <<<<<<<<<<<<<<
 * 
 *     def connection_lost(self, exc):
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 956, __pyx_L18_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_8 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_ex) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_ex);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }

      /* "asyncpg/protocol/protocol.pyx":952
 *         try:
 *             self._connect()
 *         except Exception as ex:             # <<<<<<<<<<<<<<
 *             transport.abort()
 *             self.con_status = CONNECTION_BAD
 */
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_ex);
          __pyx_v_ex = NULL;
          goto __pyx_L19;
        }
        __pyx_L18_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __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;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          __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_XGOTREF(__pyx_t_21);
          __pyx_t_9 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_ex);
            __pyx_v_ex = NULL;
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
          }
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
          goto __pyx_L9_except_error;
        }
        __pyx_L19:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L8_exception_handled;
    }
    goto __pyx_L9_except_error;
    __pyx_L9_except_error:;

    /* "asyncpg/protocol/protocol.pyx":950
 *                             socket.TCP_NODELAY, 1)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._connect()
 *         except Exception as ex:
 */
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    goto __pyx_L1_error;
    __pyx_L8_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    __pyx_L12_try_end:;
  }

  /* "asyncpg/protocol/protocol.pyx":940
 *         self._read_server_messages()
 * 
 *     def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *         self.transport = transport
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XDECREF(__pyx_v_ex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":958
 *             self._on_error(ex)
 * 
 *     def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         self.con_status = CONNECTION_BAD
 *         self._set_state(PROTOCOL_FAILED)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_66connection_lost(PyObject *__pyx_v_self, PyObject *__pyx_v_exc); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_66connection_lost(PyObject *__pyx_v_self, PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_65connection_lost(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_exc));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_65connection_lost(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc) {
  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("connection_lost", 0);

  /* "asyncpg/protocol/protocol.pyx":959
 * 
 *     def connection_lost(self, exc):
 *         self.con_status = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *         self._set_state(PROTOCOL_FAILED)
 *         self._on_connection_lost(exc)
 */
  __pyx_v_self->__pyx_base.con_status = __pyx_e_7asyncpg_8protocol_8protocol_CONNECTION_BAD;

  /* "asyncpg/protocol/protocol.pyx":960
 *     def connection_lost(self, exc):
 *         self.con_status = CONNECTION_BAD
 *         self._set_state(PROTOCOL_FAILED)             # <<<<<<<<<<<<<<
 *         self._on_connection_lost(exc)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_e_7asyncpg_8protocol_8protocol_PROTOCOL_FAILED); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":961
 *         self.con_status = CONNECTION_BAD
 *         self._set_state(PROTOCOL_FAILED)
 *         self._on_connection_lost(exc)             # <<<<<<<<<<<<<<
 * 
 *     def pause_writing(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._on_connection_lost(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v_self), __pyx_v_exc); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":958
 *             self._on_error(ex)
 * 
 *     def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         self.con_status = CONNECTION_BAD
 *         self._set_state(PROTOCOL_FAILED)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":963
 *         self._on_connection_lost(exc)
 * 
 *     def pause_writing(self):             # <<<<<<<<<<<<<<
 *         self.writing_allowed.clear()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_68pause_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_68pause_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pause_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_67pause_writing(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_67pause_writing(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pause_writing", 0);

  /* "asyncpg/protocol/protocol.pyx":964
 * 
 *     def pause_writing(self):
 *         self.writing_allowed.clear()             # <<<<<<<<<<<<<<
 * 
 *     def resume_writing(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 964, __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(1, 964, __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;

  /* "asyncpg/protocol/protocol.pyx":963
 *         self._on_connection_lost(exc)
 * 
 *     def pause_writing(self):             # <<<<<<<<<<<<<<
 *         self.writing_allowed.clear()
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.pause_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":966
 *         self.writing_allowed.clear()
 * 
 *     def resume_writing(self):             # <<<<<<<<<<<<<<
 *         self.writing_allowed.set()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_70resume_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_70resume_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_69resume_writing(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_69resume_writing(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume_writing", 0);

  /* "asyncpg/protocol/protocol.pyx":967
 * 
 *     def resume_writing(self):
 *         self.writing_allowed.set()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_writing_allowed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 967, __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(1, 967, __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;

  /* "asyncpg/protocol/protocol.pyx":966
 *         self.writing_allowed.clear()
 * 
 *     def resume_writing(self):             # <<<<<<<<<<<<<<
 *         self.writing_allowed.set()
 * 
 */

  /* 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("asyncpg.protocol.protocol.BaseProtocol.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":970
 * 
 *     @property
 *     def is_ssl(self):             # <<<<<<<<<<<<<<
 *         return self._is_ssl
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("__get__", 0);

  /* "asyncpg/protocol/protocol.pyx":971
 *     @property
 *     def is_ssl(self):
 *         return self._is_ssl             # <<<<<<<<<<<<<<
 * 
 *     @is_ssl.setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_is_ssl); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":970
 * 
 *     @property
 *     def is_ssl(self):             # <<<<<<<<<<<<<<
 *         return self._is_ssl
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.is_ssl.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":974
 * 
 *     @is_ssl.setter
 *     def is_ssl(self, value):             # <<<<<<<<<<<<<<
 *         self._is_ssl = value
 * 
 */

/* Python wrapper */
static int __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_2__set__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_2__set__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "asyncpg/protocol/protocol.pyx":975
 *     @is_ssl.setter
 *     def is_ssl(self, value):
 *         self._is_ssl = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 975, __pyx_L1_error)
  __pyx_v_self->_is_ssl = __pyx_t_1;

  /* "asyncpg/protocol/protocol.pyx":974
 * 
 *     @is_ssl.setter
 *     def is_ssl(self, value):             # <<<<<<<<<<<<<<
 *         self._is_ssl = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.is_ssl.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pxd":53
 *         bint closing
 * 
 *         readonly uint64_t queries_count             # <<<<<<<<<<<<<<
 * 
 *         bint _is_ssl
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count___get__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count___get__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__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("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->queries_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.queries_count.__get__", __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):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_72__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_72__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_7asyncpg_8protocol_8protocol_12BaseProtocol_71__reduce_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_71__reduce_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  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;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._is_ssl, self._skip_discard, self.address, self.backend_pid, self.backend_secret, self.buffer, self.cancel_sent_waiter, self.cancel_waiter, self.closing, self.completed_callback, self.con_params, self.con_status, self.conref, self.create_future, self.encoding, self.is_reading, self.last_query, self.loop, self.queries_count, self.record_class, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.return_extra, self.scram, self.settings, self.state, self.statement, self.timeout_callback, self.timeout_handle, self.transport, self.waiter, self.writing_paused, self.xact_status)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base._discard_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->_is_ssl); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base._skip_discard); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_self->__pyx_base.backend_pid); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_self->__pyx_base.backend_secret); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->closing); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(__pyx_v_self->__pyx_base.con_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_self->is_reading); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->queries_count); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_v_self->__pyx_base.result_execute_completed); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(__pyx_v_self->__pyx_base.result_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_v_self->return_extra); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_v_self->__pyx_base.state); if (unlikely(!__pyx_t_13)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = __Pyx_PyBool_FromLong(__pyx_v_self->writing_paused); if (unlikely(!__pyx_t_14)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(__pyx_v_self->__pyx_base.xact_status); if (unlikely(!__pyx_t_15)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyTuple_New(41); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->__pyx_base._execute_iter);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._execute_iter);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_self->__pyx_base._execute_iter);
  __Pyx_INCREF(__pyx_v_self->__pyx_base._execute_portal_name);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._execute_portal_name);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_self->__pyx_base._execute_portal_name);
  __Pyx_INCREF(__pyx_v_self->__pyx_base._execute_stmt_name);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base._execute_stmt_name);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_v_self->__pyx_base._execute_stmt_name);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_16, 5, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->address);
  __Pyx_GIVEREF(__pyx_v_self->address);
  PyTuple_SET_ITEM(__pyx_t_16, 6, __pyx_v_self->address);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_16, 7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_16, 8, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.buffer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.buffer));
  PyTuple_SET_ITEM(__pyx_t_16, 9, ((PyObject *)__pyx_v_self->__pyx_base.buffer));
  __Pyx_INCREF(__pyx_v_self->cancel_sent_waiter);
  __Pyx_GIVEREF(__pyx_v_self->cancel_sent_waiter);
  PyTuple_SET_ITEM(__pyx_t_16, 10, __pyx_v_self->cancel_sent_waiter);
  __Pyx_INCREF(__pyx_v_self->cancel_waiter);
  __Pyx_GIVEREF(__pyx_v_self->cancel_waiter);
  PyTuple_SET_ITEM(__pyx_t_16, 11, __pyx_v_self->cancel_waiter);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 12, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->completed_callback);
  __Pyx_GIVEREF(__pyx_v_self->completed_callback);
  PyTuple_SET_ITEM(__pyx_t_16, 13, __pyx_v_self->completed_callback);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.con_params);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.con_params);
  PyTuple_SET_ITEM(__pyx_t_16, 14, __pyx_v_self->__pyx_base.con_params);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_16, 15, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_self->conref);
  __Pyx_GIVEREF(__pyx_v_self->conref);
  PyTuple_SET_ITEM(__pyx_t_16, 16, __pyx_v_self->conref);
  __Pyx_INCREF(__pyx_v_self->create_future);
  __Pyx_GIVEREF(__pyx_v_self->create_future);
  PyTuple_SET_ITEM(__pyx_t_16, 17, __pyx_v_self->create_future);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.encoding);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.encoding);
  PyTuple_SET_ITEM(__pyx_t_16, 18, __pyx_v_self->__pyx_base.encoding);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_16, 19, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->last_query);
  __Pyx_GIVEREF(__pyx_v_self->last_query);
  PyTuple_SET_ITEM(__pyx_t_16, 20, __pyx_v_self->last_query);
  __Pyx_INCREF(__pyx_v_self->loop);
  __Pyx_GIVEREF(__pyx_v_self->loop);
  PyTuple_SET_ITEM(__pyx_t_16, 21, __pyx_v_self->loop);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_16, 22, __pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->record_class));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->record_class));
  PyTuple_SET_ITEM(__pyx_t_16, 23, ((PyObject *)__pyx_v_self->record_class));
  __Pyx_INCREF(__pyx_v_self->__pyx_base.result);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result);
  PyTuple_SET_ITEM(__pyx_t_16, 24, __pyx_v_self->__pyx_base.result);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_16, 25, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.result_param_desc);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result_param_desc);
  PyTuple_SET_ITEM(__pyx_t_16, 26, __pyx_v_self->__pyx_base.result_param_desc);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.result_row_desc);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result_row_desc);
  PyTuple_SET_ITEM(__pyx_t_16, 27, __pyx_v_self->__pyx_base.result_row_desc);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.result_status_msg);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.result_status_msg);
  PyTuple_SET_ITEM(__pyx_t_16, 28, __pyx_v_self->__pyx_base.result_status_msg);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_16, 29, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_16, 30, __pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.scram));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.scram));
  PyTuple_SET_ITEM(__pyx_t_16, 31, ((PyObject *)__pyx_v_self->__pyx_base.scram));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->settings));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->settings));
  PyTuple_SET_ITEM(__pyx_t_16, 32, ((PyObject *)__pyx_v_self->settings));
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_16, 33, __pyx_t_13);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->statement));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->statement));
  PyTuple_SET_ITEM(__pyx_t_16, 34, ((PyObject *)__pyx_v_self->statement));
  __Pyx_INCREF(__pyx_v_self->timeout_callback);
  __Pyx_GIVEREF(__pyx_v_self->timeout_callback);
  PyTuple_SET_ITEM(__pyx_t_16, 35, __pyx_v_self->timeout_callback);
  __Pyx_INCREF(__pyx_v_self->timeout_handle);
  __Pyx_GIVEREF(__pyx_v_self->timeout_handle);
  PyTuple_SET_ITEM(__pyx_t_16, 36, __pyx_v_self->timeout_handle);
  __Pyx_INCREF(__pyx_v_self->__pyx_base.transport);
  __Pyx_GIVEREF(__pyx_v_self->__pyx_base.transport);
  PyTuple_SET_ITEM(__pyx_t_16, 37, __pyx_v_self->__pyx_base.transport);
  __Pyx_INCREF(__pyx_v_self->waiter);
  __Pyx_GIVEREF(__pyx_v_self->waiter);
  PyTuple_SET_ITEM(__pyx_t_16, 38, __pyx_v_self->waiter);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_16, 39, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_16, 40, __pyx_t_15);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __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_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._is_ssl, self._skip_discard, self.address, self.backend_pid, self.backend_secret, self.buffer, self.cancel_sent_waiter, self.cancel_waiter, self.closing, self.completed_callback, self.con_params, self.con_status, self.conref, self.create_future, self.encoding, self.is_reading, self.last_query, self.loop, self.queries_count, self.record_class, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.return_extra, self.scram, self.settings, self.state, self.statement, self.timeout_callback, self.timeout_handle, self.transport, self.waiter, self.writing_paused, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_16 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_v__dict = __pyx_t_16;
  __pyx_t_16 = 0;

  /* "(tree fragment)":7
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._is_ssl, self._skip_discard, self.address, self.backend_pid, self.backend_secret, self.buffer, self.cancel_sent_waiter, self.cancel_waiter, self.closing, self.completed_callback, self.con_params, self.con_status, self.conref, self.create_future, self.encoding, self.is_reading, self.last_query, self.loop, self.queries_count, self.record_class, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.return_extra, self.scram, self.settings, self.state, self.statement, self.timeout_callback, self.timeout_handle, self.transport, self.waiter, self.writing_paused, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_17 = (__pyx_v__dict != Py_None);
  __pyx_t_18 = (__pyx_t_17 != 0);
  if (__pyx_t_18) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v__dict);
    __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(3, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_15));
    __pyx_t_15 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.address is not None or self.buffer is not None or self.cancel_sent_waiter is not None or self.cancel_waiter is not None or self.completed_callback is not None or self.con_params is not None or self.conref is not None or self.create_future is not None or self.encoding is not None or self.last_query is not None or self.loop is not None or self.record_class is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.settings is not None or self.statement is not None or self.timeout_callback is not None or self.timeout_handle is not None or self.transport is not None or self.waiter is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._discard_data, self._execute_iter, self._execute_portal_name, self._execute_stmt_name, self._is_ssl, self._skip_discard, self.address, self.backend_pid, self.backend_secret, self.buffer, self.cancel_sent_waiter, self.cancel_waiter, self.closing, self.completed_callback, self.con_params, self.con_status, self.conref, self.create_future, self.encoding, self.is_reading, self.last_query, self.loop, self.queries_count, self.record_class, self.result, self.result_execute_completed, self.result_param_desc, self.result_row_desc, self.result_status_msg, self.result_type, self.return_extra, self.scram, self.settings, self.state, self.statement, self.timeout_callback, self.timeout_handle, self.transport, self.waiter, self.writing_paused, self.xact_status)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.address is not None or self.buffer is not None or self.cancel_sent_waiter is not None or self.cancel_waiter is not None or self.completed_callback is not None or self.con_params is not None or self.conref is not None or self.create_future is not None or self.encoding is not None or self.last_query is not None or self.loop is not None or self.record_class is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.settings is not None or self.statement is not None or self.timeout_callback is not None or self.timeout_handle is not None or self.transport is not None or self.waiter is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, None), state
 */
  /*else*/ {
    __pyx_t_17 = (__pyx_v_self->__pyx_base._execute_iter != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->__pyx_base._execute_portal_name != ((PyObject*)Py_None));
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->__pyx_base._execute_stmt_name != ((PyObject*)Py_None));
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->address != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (((PyObject *)__pyx_v_self->__pyx_base.buffer) != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->cancel_sent_waiter != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->cancel_waiter != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->completed_callback != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->__pyx_base.con_params != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->conref != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->create_future != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->__pyx_base.encoding != ((PyObject*)Py_None));
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->last_query != ((PyObject*)Py_None));
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->loop != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->record_class != ((PyTypeObject*)Py_None));
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->__pyx_base.result != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->__pyx_base.result_param_desc != ((PyObject*)Py_None));
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->__pyx_base.result_row_desc != ((PyObject*)Py_None));
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->__pyx_base.result_status_msg != ((PyObject*)Py_None));
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (((PyObject *)__pyx_v_self->__pyx_base.scram) != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (((PyObject *)__pyx_v_self->settings) != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (((PyObject *)__pyx_v_self->statement) != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->timeout_callback != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->timeout_handle != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    if (!__pyx_t_17) {
    } else {
      __pyx_t_18 = __pyx_t_17;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_17 = (__pyx_v_self->__pyx_base.transport != Py_None);
    __pyx_t_19 = (__pyx_t_17 != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_18 = __pyx_t_19;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_19 = (__pyx_v_self->waiter != Py_None);
    __pyx_t_17 = (__pyx_t_19 != 0);
    __pyx_t_18 = __pyx_t_17;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_18;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.address is not None or self.buffer is not None or self.cancel_sent_waiter is not None or self.cancel_waiter is not None or self.completed_callback is not None or self.con_params is not None or self.conref is not None or self.create_future is not None or self.encoding is not None or self.last_query is not None or self.loop is not None or self.record_class is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.settings is not None or self.statement is not None or self.timeout_callback is not None or self.timeout_handle is not None or self.transport is not None or self.waiter is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, None), state
 *     else:
 */
  __pyx_t_18 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_18) {

    /* "(tree fragment)":13
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.address is not None or self.buffer is not None or self.cancel_sent_waiter is not None or self.cancel_waiter is not None or self.completed_callback is not None or self.con_params is not None or self.conref is not None or self.create_future is not None or self.encoding is not None or self.last_query is not None or self.loop is not None or self.record_class is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.settings is not None or self.statement is not None or self.timeout_callback is not None or self.timeout_handle is not None or self.transport is not None or self.waiter is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_pyx_unpickle_BaseProtocol); if (unlikely(!__pyx_t_15)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_61349641);
    __Pyx_GIVEREF(__pyx_int_61349641);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_61349641);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_16, 2, Py_None);
    __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(3, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_state);
    __pyx_t_15 = 0;
    __pyx_t_16 = 0;
    __pyx_r = __pyx_t_14;
    __pyx_t_14 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._execute_iter is not None or self._execute_portal_name is not None or self._execute_stmt_name is not None or self.address is not None or self.buffer is not None or self.cancel_sent_waiter is not None or self.cancel_waiter is not None or self.completed_callback is not None or self.con_params is not None or self.conref is not None or self.create_future is not None or self.encoding is not None or self.last_query is not None or self.loop is not None or self.record_class is not None or self.result is not None or self.result_param_desc is not None or self.result_row_desc is not None or self.result_status_msg is not None or self.scram is not None or self.settings is not None or self.statement is not None or self.timeout_callback is not None or self.timeout_handle is not None or self.transport is not None or self.waiter is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, None), state
 *     else:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseProtocol__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pyx_unpickle_BaseProtocol); if (unlikely(!__pyx_t_14)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_61349641);
    __Pyx_GIVEREF(__pyx_int_61349641);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_61349641);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_state);
    __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(3, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
    __pyx_t_14 = 0;
    __pyx_t_16 = 0;
    __pyx_r = __pyx_t_15;
    __pyx_t_15 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __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_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseProtocol__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_74__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_74__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_7asyncpg_8protocol_8protocol_12BaseProtocol_73__setstate_cython__(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_12BaseProtocol_73__setstate_cython__(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v_self, 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)":17
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseProtocol__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_BaseProtocol__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseProtocol, (type(self), 0x3a81f09, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseProtocol__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.BaseProtocol.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":979
 * 
 * class Timer:
 *     def __init__(self, budget):             # <<<<<<<<<<<<<<
 *         self._budget = budget
 *         self._started = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_budget = 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_budget,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_budget)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 979, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 979, __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_budget = 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(1, 979, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Timer___init__(__pyx_self, __pyx_v_self, __pyx_v_budget);

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

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

  /* "asyncpg/protocol/protocol.pyx":980
 * class Timer:
 *     def __init__(self, budget):
 *         self._budget = budget             # <<<<<<<<<<<<<<
 *         self._started = 0
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_budget_2, __pyx_v_budget) < 0) __PYX_ERR(1, 980, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":981
 *     def __init__(self, budget):
 *         self._budget = budget
 *         self._started = 0             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_started, __pyx_int_0) < 0) __PYX_ERR(1, 981, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":979
 * 
 * class Timer:
 *     def __init__(self, budget):             # <<<<<<<<<<<<<<
 *         self._budget = budget
 *         self._started = 0
 */

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

/* "asyncpg/protocol/protocol.pyx":983
 *         self._started = 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._started = time.monotonic()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_3__enter__ = {"__enter__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_3__enter__, METH_O, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Timer_2__enter__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "asyncpg/protocol/protocol.pyx":984
 * 
 *     def __enter__(self):
 *         if self._budget is not None:             # <<<<<<<<<<<<<<
 *             self._started = time.monotonic()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 984, __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 (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":985
 *     def __enter__(self):
 *         if self._budget is not None:
 *             self._started = time.monotonic()             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, et, e, tb):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_monotonic); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 985, __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 && unlikely(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_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_started, __pyx_t_1) < 0) __PYX_ERR(1, 985, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asyncpg/protocol/protocol.pyx":984
 * 
 *     def __enter__(self):
 *         if self._budget is not None:             # <<<<<<<<<<<<<<
 *             self._started = time.monotonic()
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":983
 *         self._started = 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._started = time.monotonic()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":987
 *             self._started = time.monotonic()
 * 
 *     def __exit__(self, et, e, tb):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._budget -= time.monotonic() - self._started
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_5__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_5__exit__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_et = 0;
  CYTHON_UNUSED PyObject *__pyx_v_e = 0;
  CYTHON_UNUSED PyObject *__pyx_v_tb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_et,&__pyx_n_s_e,&__pyx_n_s_tb,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_et)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 1); __PYX_ERR(1, 987, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 2); __PYX_ERR(1, 987, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 3); __PYX_ERR(1, 987, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(1, 987, __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_et = values[1];
    __pyx_v_e = values[2];
    __pyx_v_tb = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 987, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Timer_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_et, __pyx_v_e, __pyx_v_tb);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_et, CYTHON_UNUSED PyObject *__pyx_v_e, CYTHON_UNUSED PyObject *__pyx_v_tb) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "asyncpg/protocol/protocol.pyx":988
 * 
 *     def __exit__(self, et, e, tb):
 *         if self._budget is not None:             # <<<<<<<<<<<<<<
 *             self._budget -= time.monotonic() - self._started
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 988, __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 (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":989
 *     def __exit__(self, et, e, tb):
 *         if self._budget is not None:
 *             self._budget -= time.monotonic() - self._started             # <<<<<<<<<<<<<<
 * 
 *     def get_remaining_budget(self):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_monotonic); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_started); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_budget_2, __pyx_t_6) < 0) __PYX_ERR(1, 989, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asyncpg/protocol/protocol.pyx":988
 * 
 *     def __exit__(self, et, e, tb):
 *         if self._budget is not None:             # <<<<<<<<<<<<<<
 *             self._budget -= time.monotonic() - self._started
 * 
 */
  }

  /* "asyncpg/protocol/protocol.pyx":987
 *             self._started = time.monotonic()
 * 
 *     def __exit__(self, et, e, tb):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._budget -= time.monotonic() - self._started
 */

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

/* "asyncpg/protocol/protocol.pyx":991
 *             self._budget -= time.monotonic() - self._started
 * 
 *     def get_remaining_budget(self):             # <<<<<<<<<<<<<<
 *         return self._budget
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_7get_remaining_budget(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_7get_remaining_budget = {"get_remaining_budget", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_7get_remaining_budget, METH_O, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_7get_remaining_budget(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_remaining_budget (wrapper)", 0);
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Timer_6get_remaining_budget(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_6get_remaining_budget(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("get_remaining_budget", 0);

  /* "asyncpg/protocol/protocol.pyx":992
 * 
 *     def get_remaining_budget(self):
 *         return self._budget             # <<<<<<<<<<<<<<
 * 
 *     def has_budget_greater_than(self, amount):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":991
 *             self._budget -= time.monotonic() - self._started
 * 
 *     def get_remaining_budget(self):             # <<<<<<<<<<<<<<
 *         return self._budget
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.get_remaining_budget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":994
 *         return self._budget
 * 
 *     def has_budget_greater_than(self, amount):             # <<<<<<<<<<<<<<
 *         if self._budget is None:
 *             # Unlimited budget.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_9has_budget_greater_than(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_9has_budget_greater_than = {"has_budget_greater_than", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_9has_budget_greater_than, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5Timer_9has_budget_greater_than(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_amount = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_budget_greater_than (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_amount,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_amount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_budget_greater_than", 1, 2, 2, 1); __PYX_ERR(1, 994, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_budget_greater_than") < 0)) __PYX_ERR(1, 994, __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_amount = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_budget_greater_than", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 994, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.has_budget_greater_than", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_5Timer_8has_budget_greater_than(__pyx_self, __pyx_v_self, __pyx_v_amount);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_5Timer_8has_budget_greater_than(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_amount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_budget_greater_than", 0);

  /* "asyncpg/protocol/protocol.pyx":995
 * 
 *     def has_budget_greater_than(self, amount):
 *         if self._budget is None:             # <<<<<<<<<<<<<<
 *             # Unlimited budget.
 *             return True
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __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 (__pyx_t_3) {

    /* "asyncpg/protocol/protocol.pyx":997
 *         if self._budget is None:
 *             # Unlimited budget.
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return self._budget > amount
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "asyncpg/protocol/protocol.pyx":995
 * 
 *     def has_budget_greater_than(self, amount):
 *         if self._budget is None:             # <<<<<<<<<<<<<<
 *             # Unlimited budget.
 *             return True
 */
  }

  /* "asyncpg/protocol/protocol.pyx":999
 *             return True
 *         else:
 *             return self._budget > amount             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_budget_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_amount, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 999, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "asyncpg/protocol/protocol.pyx":994
 *         return self._budget
 * 
 *     def has_budget_greater_than(self, amount):             # <<<<<<<<<<<<<<
 *         if self._budget is None:
 *             # Unlimited budget.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.Timer.has_budget_greater_than", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/protocol/protocol.pyx":1006
 * 
 * 
 * def _create_record(object mapping, tuple elems):             # <<<<<<<<<<<<<<
 *     # Exposed only for testing purposes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_1_create_record(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_1_create_record = {"_create_record", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_1_create_record, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_1_create_record(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mapping = 0;
  PyObject *__pyx_v_elems = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_create_record (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mapping,&__pyx_n_s_elems,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_mapping)) != 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_elems)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_record", 1, 2, 2, 1); __PYX_ERR(1, 1006, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_record") < 0)) __PYX_ERR(1, 1006, __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_mapping = values[0];
    __pyx_v_elems = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_create_record", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1006, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol._create_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elems), (&PyTuple_Type), 1, "elems", 1))) __PYX_ERR(1, 1006, __pyx_L1_error)
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol__create_record(__pyx_self, __pyx_v_mapping, __pyx_v_elems);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol__create_record(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_elems) {
  PyObject *__pyx_v_rec = 0;
  int32_t __pyx_v_i;
  PyObject *__pyx_v_desc = NULL;
  PyObject *__pyx_v_elem = 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;
  Py_ssize_t __pyx_t_6;
  int32_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_record", 0);

  /* "asyncpg/protocol/protocol.pyx":1013
 *         int32_t i
 * 
 *     if mapping is None:             # <<<<<<<<<<<<<<
 *         desc = record.ApgRecordDesc_New({}, ())
 *     else:
 */
  __pyx_t_1 = (__pyx_v_mapping == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asyncpg/protocol/protocol.pyx":1014
 * 
 *     if mapping is None:
 *         desc = record.ApgRecordDesc_New({}, ())             # <<<<<<<<<<<<<<
 *     else:
 *         desc = record.ApgRecordDesc_New(
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ApgRecordDesc_New(__pyx_t_3, __pyx_empty_tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_desc = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":1013
 *         int32_t i
 * 
 *     if mapping is None:             # <<<<<<<<<<<<<<
 *         desc = record.ApgRecordDesc_New({}, ())
 *     else:
 */
    goto __pyx_L3;
  }

  /* "asyncpg/protocol/protocol.pyx":1016
 *         desc = record.ApgRecordDesc_New({}, ())
 *     else:
 *         desc = record.ApgRecordDesc_New(             # <<<<<<<<<<<<<<
 *             mapping, tuple(mapping) if mapping else ())
 * 
 */
  /*else*/ {

    /* "asyncpg/protocol/protocol.pyx":1017
 *     else:
 *         desc = record.ApgRecordDesc_New(
 *             mapping, tuple(mapping) if mapping else ())             # <<<<<<<<<<<<<<
 * 
 *     rec = record.ApgRecord_New(Record, desc, len(elems))
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_mapping); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 1017, __pyx_L1_error)
    if (__pyx_t_2) {
      __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_mapping); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_t_4 = __pyx_empty_tuple;
    }

    /* "asyncpg/protocol/protocol.pyx":1016
 *         desc = record.ApgRecordDesc_New({}, ())
 *     else:
 *         desc = record.ApgRecordDesc_New(             # <<<<<<<<<<<<<<
 *             mapping, tuple(mapping) if mapping else ())
 * 
 */
    __pyx_t_3 = ApgRecordDesc_New(__pyx_v_mapping, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_desc = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "asyncpg/protocol/protocol.pyx":1019
 *             mapping, tuple(mapping) if mapping else ())
 * 
 *     rec = record.ApgRecord_New(Record, desc, len(elems))             # <<<<<<<<<<<<<<
 *     for i in range(len(elems)):
 *         elem = elems[i]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Record); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyType_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "type", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 1019, __pyx_L1_error)
  if (unlikely(__pyx_v_elems == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 1019, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_elems); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1019, __pyx_L1_error)
  __pyx_t_4 = ApgRecord_New(((PyTypeObject*)__pyx_t_3), __pyx_v_desc, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rec = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asyncpg/protocol/protocol.pyx":1020
 * 
 *     rec = record.ApgRecord_New(Record, desc, len(elems))
 *     for i in range(len(elems)):             # <<<<<<<<<<<<<<
 *         elem = elems[i]
 *         cpython.Py_INCREF(elem)
 */
  if (unlikely(__pyx_v_elems == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 1020, __pyx_L1_error)
  }
  __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_elems); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1020, __pyx_L1_error)
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "asyncpg/protocol/protocol.pyx":1021
 *     rec = record.ApgRecord_New(Record, desc, len(elems))
 *     for i in range(len(elems)):
 *         elem = elems[i]             # <<<<<<<<<<<<<<
 *         cpython.Py_INCREF(elem)
 *         record.ApgRecord_SET_ITEM(rec, i, elem)
 */
    if (unlikely(__pyx_v_elems == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 1021, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_elems, __pyx_v_i, int32_t, 1, __Pyx_PyInt_From_int32_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "asyncpg/protocol/protocol.pyx":1022
 *     for i in range(len(elems)):
 *         elem = elems[i]
 *         cpython.Py_INCREF(elem)             # <<<<<<<<<<<<<<
 *         record.ApgRecord_SET_ITEM(rec, i, elem)
 *     return rec
 */
    Py_INCREF(__pyx_v_elem);

    /* "asyncpg/protocol/protocol.pyx":1023
 *         elem = elems[i]
 *         cpython.Py_INCREF(elem)
 *         record.ApgRecord_SET_ITEM(rec, i, elem)             # <<<<<<<<<<<<<<
 *     return rec
 * 
 */
    ApgRecord_SET_ITEM(__pyx_v_rec, __pyx_v_i, __pyx_v_elem);
  }

  /* "asyncpg/protocol/protocol.pyx":1024
 *         cpython.Py_INCREF(elem)
 *         record.ApgRecord_SET_ITEM(rec, i, elem)
 *     return rec             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rec);
  __pyx_r = __pyx_v_rec;
  goto __pyx_L0;

  /* "asyncpg/protocol/protocol.pyx":1006
 * 
 * 
 * def _create_record(object mapping, tuple elems):             # <<<<<<<<<<<<<<
 *     # Exposed only for testing purposes.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asyncpg.protocol.protocol._create_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rec);
  __Pyx_XDECREF(__pyx_v_desc);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_DataCodecConfig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_3__pyx_unpickle_DataCodecConfig(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_3__pyx_unpickle_DataCodecConfig = {"__pyx_unpickle_DataCodecConfig", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_3__pyx_unpickle_DataCodecConfig, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_3__pyx_unpickle_DataCodecConfig(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_DataCodecConfig (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DataCodecConfig", 1, 3, 3, 1); __PYX_ERR(3, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DataCodecConfig", 1, 3, 3, 2); __PYX_ERR(3, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_DataCodecConfig") < 0)) __PYX_ERR(3, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DataCodecConfig", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_DataCodecConfig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_2__pyx_unpickle_DataCodecConfig(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_2__pyx_unpickle_DataCodecConfig(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_DataCodecConfig", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7336a95:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x7336a95) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7336a95:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x7336a95:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x73, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x7336a95:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_DataCodecConfig), __pyx_n_s_new_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_DataCodecConfig__set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x7336a95 = (_custom_type_codecs, _derived_type_codecs))" % __pyx_checksum)
 *     __pyx_result = DataCodecConfig.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_DataCodecConfig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_DataCodecConfig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_DataCodecConfig__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_DataCodecConfig__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_custom_type_codecs);
  __Pyx_DECREF(__pyx_v___pyx_result->_custom_type_codecs);
  __pyx_v___pyx_result->_custom_type_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_derived_type_codecs);
  __Pyx_DECREF(__pyx_v___pyx_result->_derived_type_codecs);
  __pyx_v___pyx_result->_derived_type_codecs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 2) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(3, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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_1 = (__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_1)) __PYX_ERR(3, 14, __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;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_DataCodecConfig__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CoreProtocol(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5__pyx_unpickle_CoreProtocol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_5__pyx_unpickle_CoreProtocol = {"__pyx_unpickle_CoreProtocol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_5__pyx_unpickle_CoreProtocol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_5__pyx_unpickle_CoreProtocol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoreProtocol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoreProtocol", 1, 3, 3, 1); __PYX_ERR(3, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoreProtocol", 1, 3, 3, 2); __PYX_ERR(3, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CoreProtocol") < 0)) __PYX_ERR(3, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CoreProtocol", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_CoreProtocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_4__pyx_unpickle_CoreProtocol(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_4__pyx_unpickle_CoreProtocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoreProtocol", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfbc42c3:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xfbc42c3) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfbc42c3:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xfbc42c3:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xfb, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xfbc42c3:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_CoreProtocol), __pyx_n_s_new_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_CoreProtocol__set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xfbc42c3 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _skip_discard, backend_pid, backend_secret, buffer, con_params, con_status, encoding, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, scram, state, transport, xact_status))" % __pyx_checksum)
 *     __pyx_result = CoreProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CoreProtocol(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_CoreProtocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_CoreProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int32_t __pyx_t_3;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus __pyx_t_4;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType __pyx_t_5;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_t_6;
  enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CoreProtocol__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[21])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_discard_data = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_execute_iter);
  __Pyx_DECREF(__pyx_v___pyx_result->_execute_iter);
  __pyx_v___pyx_result->_execute_iter = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_execute_portal_name);
  __Pyx_DECREF(__pyx_v___pyx_result->_execute_portal_name);
  __pyx_v___pyx_result->_execute_portal_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_execute_stmt_name);
  __Pyx_DECREF(__pyx_v___pyx_result->_execute_stmt_name);
  __pyx_v___pyx_result->_execute_stmt_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_skip_discard = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->backend_pid = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->backend_secret = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->buffer);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->buffer));
  __pyx_v___pyx_result->buffer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->con_params);
  __Pyx_DECREF(__pyx_v___pyx_result->con_params);
  __pyx_v___pyx_result->con_params = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->con_status = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->encoding);
  __Pyx_DECREF(__pyx_v___pyx_result->encoding);
  __pyx_v___pyx_result->encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->result);
  __Pyx_DECREF(__pyx_v___pyx_result->result);
  __pyx_v___pyx_result->result = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->result_execute_completed = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->result_param_desc);
  __Pyx_DECREF(__pyx_v___pyx_result->result_param_desc);
  __pyx_v___pyx_result->result_param_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->result_row_desc);
  __Pyx_DECREF(__pyx_v___pyx_result->result_row_desc);
  __pyx_v___pyx_result->result_row_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->result_status_msg);
  __Pyx_DECREF(__pyx_v___pyx_result->result_status_msg);
  __pyx_v___pyx_result->result_status_msg = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->result_type = __pyx_t_5;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->scram);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->scram));
  __pyx_v___pyx_result->scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->state = __pyx_t_6;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->transport);
  __Pyx_DECREF(__pyx_v___pyx_result->transport);
  __pyx_v___pyx_result->transport = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->xact_status = __pyx_t_7;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[21])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 13, __pyx_L1_error)
  }
  __pyx_t_8 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_9 = ((__pyx_t_8 > 21) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_2 = __pyx_t_9;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_10 = (__pyx_t_9 != 0);
  __pyx_t_2 = __pyx_t_10;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[21])             # <<<<<<<<<<<<<<
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_update); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(3, 14, __pyx_L1_error)
    }
    __pyx_t_11 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_1 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __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_1)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[21])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_CoreProtocol__set_state(<CoreProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CoreProtocol__set_state(CoreProtocol __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._skip_discard = __pyx_state[4]; __pyx_result.backend_pid = __pyx_state[5]; __pyx_result.backend_secret = __pyx_state[6]; __pyx_result.buffer = __pyx_state[7]; __pyx_result.con_params = __pyx_state[8]; __pyx_result.con_status = __pyx_state[9]; __pyx_result.encoding = __pyx_state[10]; __pyx_result.result = __pyx_state[11]; __pyx_result.result_execute_completed = __pyx_state[12]; __pyx_result.result_param_desc = __pyx_state[13]; __pyx_result.result_row_desc = __pyx_state[14]; __pyx_result.result_status_msg = __pyx_state[15]; __pyx_result.result_type = __pyx_state[16]; __pyx_result.scram = __pyx_state[17]; __pyx_result.state = __pyx_state[18]; __pyx_result.transport = __pyx_state[19]; __pyx_result.xact_status = __pyx_state[20]
 *     if len(__pyx_state) > 21 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_CoreProtocol__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseProtocol(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_7__pyx_unpickle_BaseProtocol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7asyncpg_8protocol_8protocol_7__pyx_unpickle_BaseProtocol = {"__pyx_unpickle_BaseProtocol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_7__pyx_unpickle_BaseProtocol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7asyncpg_8protocol_8protocol_7__pyx_unpickle_BaseProtocol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseProtocol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,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_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseProtocol", 1, 3, 3, 1); __PYX_ERR(3, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseProtocol", 1, 3, 3, 2); __PYX_ERR(3, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BaseProtocol") < 0)) __PYX_ERR(3, 1, __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___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseProtocol", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_BaseProtocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7asyncpg_8protocol_8protocol_6__pyx_unpickle_BaseProtocol(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_7asyncpg_8protocol_8protocol_6__pyx_unpickle_BaseProtocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseProtocol", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3a81f09:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x3a81f09) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3a81f09:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0x3a81f09:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x3a, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x3a81f09:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol), __pyx_n_s_new_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(3, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_BaseProtocol__set_state(((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3a81f09 = (_discard_data, _execute_iter, _execute_portal_name, _execute_stmt_name, _is_ssl, _skip_discard, address, backend_pid, backend_secret, buffer, cancel_sent_waiter, cancel_waiter, closing, completed_callback, con_params, con_status, conref, create_future, encoding, is_reading, last_query, loop, queries_count, record_class, result, result_execute_completed, result_param_desc, result_row_desc, result_status_msg, result_type, return_extra, scram, settings, state, statement, timeout_callback, timeout_handle, transport, waiter, writing_paused, xact_status))" % __pyx_checksum)
 *     __pyx_result = BaseProtocol.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseProtocol(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_BaseProtocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7asyncpg_8protocol_8protocol___pyx_unpickle_BaseProtocol__set_state(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int32_t __pyx_t_3;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus __pyx_t_4;
  uint64_t __pyx_t_5;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType __pyx_t_6;
  enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __pyx_t_7;
  enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  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("__pyx_unpickle_BaseProtocol__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base._discard_data = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._execute_iter);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._execute_iter);
  __pyx_v___pyx_result->__pyx_base._execute_iter = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._execute_portal_name);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._execute_portal_name);
  __pyx_v___pyx_result->__pyx_base._execute_portal_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._execute_stmt_name);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._execute_stmt_name);
  __pyx_v___pyx_result->__pyx_base._execute_stmt_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_is_ssl = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base._skip_discard = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->address);
  __Pyx_DECREF(__pyx_v___pyx_result->address);
  __pyx_v___pyx_result->address = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.backend_pid = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_3 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.backend_secret = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.buffer);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.buffer));
  __pyx_v___pyx_result->__pyx_base.buffer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->cancel_sent_waiter);
  __Pyx_DECREF(__pyx_v___pyx_result->cancel_sent_waiter);
  __pyx_v___pyx_result->cancel_sent_waiter = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->cancel_waiter);
  __Pyx_DECREF(__pyx_v___pyx_result->cancel_waiter);
  __pyx_v___pyx_result->cancel_waiter = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->closing = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->completed_callback);
  __Pyx_DECREF(__pyx_v___pyx_result->completed_callback);
  __pyx_v___pyx_result->completed_callback = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.con_params);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.con_params);
  __pyx_v___pyx_result->__pyx_base.con_params = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.con_status = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->conref);
  __Pyx_DECREF(__pyx_v___pyx_result->conref);
  __pyx_v___pyx_result->conref = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->create_future);
  __Pyx_DECREF(__pyx_v___pyx_result->create_future);
  __pyx_v___pyx_result->create_future = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.encoding);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.encoding);
  __pyx_v___pyx_result->__pyx_base.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->is_reading = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->last_query);
  __Pyx_DECREF(__pyx_v___pyx_result->last_query);
  __pyx_v___pyx_result->last_query = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->loop);
  __Pyx_DECREF(__pyx_v___pyx_result->loop);
  __pyx_v___pyx_result->loop = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->queries_count = __pyx_t_5;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyType_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "type", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->record_class);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->record_class));
  __pyx_v___pyx_result->record_class = ((PyTypeObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.result);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.result);
  __pyx_v___pyx_result->__pyx_base.result = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.result_execute_completed = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.result_param_desc);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.result_param_desc);
  __pyx_v___pyx_result->__pyx_base.result_param_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.result_row_desc);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.result_row_desc);
  __pyx_v___pyx_result->__pyx_base.result_row_desc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.result_status_msg);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.result_status_msg);
  __pyx_v___pyx_result->__pyx_base.result_status_msg = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.result_type = __pyx_t_6;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->return_extra = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.scram);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.scram));
  __pyx_v___pyx_result->__pyx_base.scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_8protocol_8protocol_ConnectionSettings))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->settings);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->settings));
  __pyx_v___pyx_result->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.state = __pyx_t_7;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState))))) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->statement);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->statement));
  __pyx_v___pyx_result->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->timeout_callback);
  __Pyx_DECREF(__pyx_v___pyx_result->timeout_callback);
  __pyx_v___pyx_result->timeout_callback = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->timeout_handle);
  __Pyx_DECREF(__pyx_v___pyx_result->timeout_handle);
  __pyx_v___pyx_result->timeout_handle = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.transport);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.transport);
  __pyx_v___pyx_result->__pyx_base.transport = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->waiter);
  __Pyx_DECREF(__pyx_v___pyx_result->waiter);
  __pyx_v___pyx_result->waiter = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 39, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->writing_paused = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(3, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 40, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = ((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)__Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->__pyx_base.xact_status = __pyx_t_8;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 13, __pyx_L1_error)
  }
  __pyx_t_9 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_10 = ((__pyx_t_9 > 41) != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_2 = __pyx_t_10;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(3, 13, __pyx_L1_error)
  __pyx_t_11 = (__pyx_t_10 != 0);
  __pyx_t_2 = __pyx_t_11;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[41])             # <<<<<<<<<<<<<<
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_update); if (unlikely(!__pyx_t_13)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(3, 14, __pyx_L1_error)
    }
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 41, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __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_1)) __PYX_ERR(3, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[41])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseProtocol__set_state(<BaseProtocol> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseProtocol__set_state(BaseProtocol __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._discard_data = __pyx_state[0]; __pyx_result._execute_iter = __pyx_state[1]; __pyx_result._execute_portal_name = __pyx_state[2]; __pyx_result._execute_stmt_name = __pyx_state[3]; __pyx_result._is_ssl = __pyx_state[4]; __pyx_result._skip_discard = __pyx_state[5]; __pyx_result.address = __pyx_state[6]; __pyx_result.backend_pid = __pyx_state[7]; __pyx_result.backend_secret = __pyx_state[8]; __pyx_result.buffer = __pyx_state[9]; __pyx_result.cancel_sent_waiter = __pyx_state[10]; __pyx_result.cancel_waiter = __pyx_state[11]; __pyx_result.closing = __pyx_state[12]; __pyx_result.completed_callback = __pyx_state[13]; __pyx_result.con_params = __pyx_state[14]; __pyx_result.con_status = __pyx_state[15]; __pyx_result.conref = __pyx_state[16]; __pyx_result.create_future = __pyx_state[17]; __pyx_result.encoding = __pyx_state[18]; __pyx_result.is_reading = __pyx_state[19]; __pyx_result.last_query = __pyx_state[20]; __pyx_result.loop = __pyx_state[21]; __pyx_result.queries_count = __pyx_state[22]; __pyx_result.record_class = __pyx_state[23]; __pyx_result.result = __pyx_state[24]; __pyx_result.result_execute_completed = __pyx_state[25]; __pyx_result.result_param_desc = __pyx_state[26]; __pyx_result.result_row_desc = __pyx_state[27]; __pyx_result.result_status_msg = __pyx_state[28]; __pyx_result.result_type = __pyx_state[29]; __pyx_result.return_extra = __pyx_state[30]; __pyx_result.scram = __pyx_state[31]; __pyx_result.settings = __pyx_state[32]; __pyx_result.state = __pyx_state[33]; __pyx_result.statement = __pyx_state[34]; __pyx_result.timeout_callback = __pyx_state[35]; __pyx_result.timeout_handle = __pyx_state[36]; __pyx_result.transport = __pyx_state[37]; __pyx_result.waiter = __pyx_state[38]; __pyx_result.writing_paused = __pyx_state[39]; __pyx_result.xact_status = __pyx_state[40]
 *     if len(__pyx_state) > 41 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("asyncpg.protocol.protocol.__pyx_unpickle_BaseProtocol__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/pgproto/frb.pxd":14
 *         ssize_t len
 * 
 *     inline ssize_t frb_get_len(FRBuffer *frb):             # <<<<<<<<<<<<<<
 *         return frb.len
 * 
 */

static CYTHON_INLINE Py_ssize_t __pyx_f_7asyncpg_7pgproto_7pgproto_frb_get_len(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frb_get_len", 0);

  /* "asyncpg/pgproto/frb.pxd":15
 * 
 *     inline ssize_t frb_get_len(FRBuffer *frb):
 *         return frb.len             # <<<<<<<<<<<<<<
 * 
 *     inline void frb_set_len(FRBuffer *frb, ssize_t new_len):
 */
  __pyx_r = __pyx_v_frb->len;
  goto __pyx_L0;

  /* "asyncpg/pgproto/frb.pxd":14
 *         ssize_t len
 * 
 *     inline ssize_t frb_get_len(FRBuffer *frb):             # <<<<<<<<<<<<<<
 *         return frb.len
 * 
 */

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

/* "asyncpg/pgproto/frb.pxd":17
 *         return frb.len
 * 
 *     inline void frb_set_len(FRBuffer *frb, ssize_t new_len):             # <<<<<<<<<<<<<<
 *         frb.len = new_len
 * 
 */

static CYTHON_INLINE void __pyx_f_7asyncpg_7pgproto_7pgproto_frb_set_len(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb, Py_ssize_t __pyx_v_new_len) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frb_set_len", 0);

  /* "asyncpg/pgproto/frb.pxd":18
 * 
 *     inline void frb_set_len(FRBuffer *frb, ssize_t new_len):
 *         frb.len = new_len             # <<<<<<<<<<<<<<
 * 
 *     inline void frb_init(FRBuffer *frb, const char *buf, ssize_t len):
 */
  __pyx_v_frb->len = __pyx_v_new_len;

  /* "asyncpg/pgproto/frb.pxd":17
 *         return frb.len
 * 
 *     inline void frb_set_len(FRBuffer *frb, ssize_t new_len):             # <<<<<<<<<<<<<<
 *         frb.len = new_len
 * 
 */

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

/* "asyncpg/pgproto/frb.pxd":20
 *         frb.len = new_len
 * 
 *     inline void frb_init(FRBuffer *frb, const char *buf, ssize_t len):             # <<<<<<<<<<<<<<
 *         frb.buf = buf
 *         frb.len = len
 */

static CYTHON_INLINE void __pyx_f_7asyncpg_7pgproto_7pgproto_frb_init(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb, char const *__pyx_v_buf, Py_ssize_t __pyx_v_len) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frb_init", 0);

  /* "asyncpg/pgproto/frb.pxd":21
 * 
 *     inline void frb_init(FRBuffer *frb, const char *buf, ssize_t len):
 *         frb.buf = buf             # <<<<<<<<<<<<<<
 *         frb.len = len
 * 
 */
  __pyx_v_frb->buf = __pyx_v_buf;

  /* "asyncpg/pgproto/frb.pxd":22
 *     inline void frb_init(FRBuffer *frb, const char *buf, ssize_t len):
 *         frb.buf = buf
 *         frb.len = len             # <<<<<<<<<<<<<<
 * 
 *     inline const char* frb_read(FRBuffer *frb, ssize_t n) except NULL:
 */
  __pyx_v_frb->len = __pyx_v_len;

  /* "asyncpg/pgproto/frb.pxd":20
 *         frb.len = new_len
 * 
 *     inline void frb_init(FRBuffer *frb, const char *buf, ssize_t len):             # <<<<<<<<<<<<<<
 *         frb.buf = buf
 *         frb.len = len
 */

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

/* "asyncpg/pgproto/frb.pxd":24
 *         frb.len = len
 * 
 *     inline const char* frb_read(FRBuffer *frb, ssize_t n) except NULL:             # <<<<<<<<<<<<<<
 *         cdef const char *result
 * 
 */

static CYTHON_INLINE char const *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb, Py_ssize_t __pyx_v_n) {
  char const *__pyx_v_result;
  char const *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frb_read", 0);

  /* "asyncpg/pgproto/frb.pxd":27
 *         cdef const char *result
 * 
 *         if n > frb.len:             # <<<<<<<<<<<<<<
 *             frb_check(frb, n)
 * 
 */
  __pyx_t_1 = ((__pyx_v_n > __pyx_v_frb->len) != 0);
  if (__pyx_t_1) {

    /* "asyncpg/pgproto/frb.pxd":28
 * 
 *         if n > frb.len:
 *             frb_check(frb, n)             # <<<<<<<<<<<<<<
 * 
 *         result = frb.buf
 */
    __pyx_t_2 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_check(__pyx_v_frb, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asyncpg/pgproto/frb.pxd":27
 *         cdef const char *result
 * 
 *         if n > frb.len:             # <<<<<<<<<<<<<<
 *             frb_check(frb, n)
 * 
 */
  }

  /* "asyncpg/pgproto/frb.pxd":30
 *             frb_check(frb, n)
 * 
 *         result = frb.buf             # <<<<<<<<<<<<<<
 *         frb.buf += n
 *         frb.len -= n
 */
  __pyx_t_3 = __pyx_v_frb->buf;
  __pyx_v_result = __pyx_t_3;

  /* "asyncpg/pgproto/frb.pxd":31
 * 
 *         result = frb.buf
 *         frb.buf += n             # <<<<<<<<<<<<<<
 *         frb.len -= n
 * 
 */
  __pyx_v_frb->buf = (__pyx_v_frb->buf + __pyx_v_n);

  /* "asyncpg/pgproto/frb.pxd":32
 *         result = frb.buf
 *         frb.buf += n
 *         frb.len -= n             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
  __pyx_v_frb->len = (__pyx_v_frb->len - __pyx_v_n);

  /* "asyncpg/pgproto/frb.pxd":34
 *         frb.len -= n
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     inline const char* frb_read_all(FRBuffer *frb):
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/pgproto/frb.pxd":24
 *         frb.len = len
 * 
 *     inline const char* frb_read(FRBuffer *frb, ssize_t n) except NULL:             # <<<<<<<<<<<<<<
 *         cdef const char *result
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.pgproto.pgproto.frb_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/pgproto/frb.pxd":36
 *         return result
 * 
 *     inline const char* frb_read_all(FRBuffer *frb):             # <<<<<<<<<<<<<<
 *         cdef const char *result
 *         result = frb.buf
 */

static CYTHON_INLINE char const *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_read_all(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb) {
  char const *__pyx_v_result;
  char const *__pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  __Pyx_RefNannySetupContext("frb_read_all", 0);

  /* "asyncpg/pgproto/frb.pxd":38
 *     inline const char* frb_read_all(FRBuffer *frb):
 *         cdef const char *result
 *         result = frb.buf             # <<<<<<<<<<<<<<
 *         frb.buf += frb.len
 *         frb.len = 0
 */
  __pyx_t_1 = __pyx_v_frb->buf;
  __pyx_v_result = __pyx_t_1;

  /* "asyncpg/pgproto/frb.pxd":39
 *         cdef const char *result
 *         result = frb.buf
 *         frb.buf += frb.len             # <<<<<<<<<<<<<<
 *         frb.len = 0
 *         return result
 */
  __pyx_v_frb->buf = (__pyx_v_frb->buf + __pyx_v_frb->len);

  /* "asyncpg/pgproto/frb.pxd":40
 *         result = frb.buf
 *         frb.buf += frb.len
 *         frb.len = 0             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_frb->len = 0;

  /* "asyncpg/pgproto/frb.pxd":41
 *         frb.buf += frb.len
 *         frb.len = 0
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     inline FRBuffer *frb_slice_from(FRBuffer *frb,
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "asyncpg/pgproto/frb.pxd":36
 *         return result
 * 
 *     inline const char* frb_read_all(FRBuffer *frb):             # <<<<<<<<<<<<<<
 *         cdef const char *result
 *         result = frb.buf
 */

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

/* "asyncpg/pgproto/frb.pxd":43
 *         return result
 * 
 *     inline FRBuffer *frb_slice_from(FRBuffer *frb,             # <<<<<<<<<<<<<<
 *                                     FRBuffer* source, ssize_t len):
 *         frb.buf = frb_read(source, len)
 */

static CYTHON_INLINE struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_f_7asyncpg_7pgproto_7pgproto_frb_slice_from(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_frb, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_v_source, Py_ssize_t __pyx_v_len) {
  struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *__pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frb_slice_from", 0);

  /* "asyncpg/pgproto/frb.pxd":45
 *     inline FRBuffer *frb_slice_from(FRBuffer *frb,
 *                                     FRBuffer* source, ssize_t len):
 *         frb.buf = frb_read(source, len)             # <<<<<<<<<<<<<<
 *         frb.len = len
 *         return frb
 */
  __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_source, __pyx_v_len); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(16, 45, __pyx_L1_error)
  __pyx_v_frb->buf = __pyx_t_1;

  /* "asyncpg/pgproto/frb.pxd":46
 *                                     FRBuffer* source, ssize_t len):
 *         frb.buf = frb_read(source, len)
 *         frb.len = len             # <<<<<<<<<<<<<<
 *         return frb
 * 
 */
  __pyx_v_frb->len = __pyx_v_len;

  /* "asyncpg/pgproto/frb.pxd":47
 *         frb.buf = frb_read(source, len)
 *         frb.len = len
 *         return frb             # <<<<<<<<<<<<<<
 * 
 *     object frb_check(FRBuffer *frb, ssize_t n)
 */
  __pyx_r = __pyx_v_frb;
  goto __pyx_L0;

  /* "asyncpg/pgproto/frb.pxd":43
 *         return result
 * 
 *     inline FRBuffer *frb_slice_from(FRBuffer *frb,             # <<<<<<<<<<<<<<
 *                                     FRBuffer* source, ssize_t len):
 *         frb.buf = frb_read(source, len)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("asyncpg.pgproto.pgproto.frb_slice_from", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/pgproto/buffer.pxd":28
 *         bint _message_mode
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__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("len", 0);

  /* "asyncpg/pgproto/buffer.pxd":29
 * 
 *     cdef inline len(self):
 *         return self._length             # <<<<<<<<<<<<<<
 * 
 *     cdef inline write_len_prefixed_utf8(self, str s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/pgproto/buffer.pxd":28
 *         bint _message_mode
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

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

/* "asyncpg/pgproto/buffer.pxd":31
 *         return self._length
 * 
 *     cdef inline write_len_prefixed_utf8(self, str s):             # <<<<<<<<<<<<<<
 *         return self.write_len_prefixed_bytes(s.encode('utf-8'))
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_11WriteBuffer_write_len_prefixed_utf8(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_len_prefixed_utf8", 0);

  /* "asyncpg/pgproto/buffer.pxd":32
 * 
 *     cdef inline write_len_prefixed_utf8(self, str s):
 *         return self.write_len_prefixed_bytes(s.encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_readonly(self)
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
    __PYX_ERR(17, 32, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_v_self->__pyx_vtab)->write_len_prefixed_bytes(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(17, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asyncpg/pgproto/buffer.pxd":31
 *         return self._length
 * 
 *     cdef inline write_len_prefixed_utf8(self, str s):             # <<<<<<<<<<<<<<
 *         return self.write_len_prefixed_bytes(s.encode('utf-8'))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asyncpg.pgproto.pgproto.WriteBuffer.write_len_prefixed_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asyncpg/pgproto/buffer.pxd":100
 *         bint _current_message_ready
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_len(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__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("len", 0);

  /* "asyncpg/pgproto/buffer.pxd":101
 * 
 *     cdef inline len(self):
 *         return self._length             # <<<<<<<<<<<<<<
 * 
 *     cdef inline char get_message_type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asyncpg/pgproto/buffer.pxd":100
 *         bint _current_message_ready
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

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

/* "asyncpg/pgproto/buffer.pxd":103
 *         return self._length
 * 
 *     cdef inline char get_message_type(self):             # <<<<<<<<<<<<<<
 *         return self._current_message_type
 * 
 */

static CYTHON_INLINE char __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_type(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_self) {
  char __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_message_type", 0);

  /* "asyncpg/pgproto/buffer.pxd":104
 * 
 *     cdef inline char get_message_type(self):
 *         return self._current_message_type             # <<<<<<<<<<<<<<
 * 
 *     cdef inline int32_t get_message_length(self):
 */
  __pyx_r = __pyx_v_self->_current_message_type;
  goto __pyx_L0;

  /* "asyncpg/pgproto/buffer.pxd":103
 *         return self._length
 * 
 *     cdef inline char get_message_type(self):             # <<<<<<<<<<<<<<
 *         return self._current_message_type
 * 
 */

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

/* "asyncpg/pgproto/buffer.pxd":106
 *         return self._current_message_type
 * 
 *     cdef inline int32_t get_message_length(self):             # <<<<<<<<<<<<<<
 *         return self._current_message_len
 * 
 */

static CYTHON_INLINE int32_t __pyx_f_7asyncpg_7pgproto_7pgproto_10ReadBuffer_get_message_length(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *__pyx_v_self) {
  int32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_message_length", 0);

  /* "asyncpg/pgproto/buffer.pxd":107
 * 
 *     cdef inline int32_t get_message_length(self):
 *         return self._current_message_len             # <<<<<<<<<<<<<<
 * 
 *     cdef feed_data(self, data)
 */
  __pyx_r = __pyx_v_self->_current_message_len;
  goto __pyx_L0;

  /* "asyncpg/pgproto/buffer.pxd":106
 *         return self._current_message_type
 * 
 *     cdef inline int32_t get_message_length(self):             # <<<<<<<<<<<<<<
 *         return self._current_message_len
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_Codec __pyx_vtable_7asyncpg_8protocol_8protocol_Codec;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_Codec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)o);
  p->__pyx_vtab = __pyx_vtabptr_7asyncpg_8protocol_8protocol_Codec;
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->schema = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->kind = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->py_encoder = Py_None; Py_INCREF(Py_None);
  p->py_decoder = Py_None; Py_INCREF(Py_None);
  p->element_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); Py_INCREF(Py_None);
  p->element_type_oids = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->element_names = Py_None; Py_INCREF(Py_None);
  p->record_desc = Py_None; Py_INCREF(Py_None);
  p->element_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_Codec(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->schema);
  Py_CLEAR(p->kind);
  Py_CLEAR(p->py_encoder);
  Py_CLEAR(p->py_decoder);
  Py_CLEAR(p->element_codec);
  Py_CLEAR(p->element_type_oids);
  Py_CLEAR(p->element_names);
  Py_CLEAR(p->record_desc);
  Py_CLEAR(p->element_codecs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_Codec(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)o;
  if (p->py_encoder) {
    e = (*v)(p->py_encoder, a); if (e) return e;
  }
  if (p->py_decoder) {
    e = (*v)(p->py_decoder, a); if (e) return e;
  }
  if (p->element_codec) {
    e = (*v)(((PyObject *)p->element_codec), a); if (e) return e;
  }
  if (p->element_type_oids) {
    e = (*v)(p->element_type_oids, a); if (e) return e;
  }
  if (p->element_names) {
    e = (*v)(p->element_names, a); if (e) return e;
  }
  if (p->record_desc) {
    e = (*v)(p->record_desc, a); if (e) return e;
  }
  if (p->element_codecs) {
    e = (*v)(p->element_codecs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_Codec(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)o;
  tmp = ((PyObject*)p->py_encoder);
  p->py_encoder = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->py_decoder);
  p->py_decoder = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->element_codec);
  p->element_codec = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->element_type_oids);
  p->element_type_oids = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->element_names);
  p->element_names = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->record_desc);
  p->record_desc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->element_codecs);
  p->element_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_Codec[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_5Codec_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_Codec = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.Codec", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_Codec, /*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
  __pyx_pw_7asyncpg_8protocol_8protocol_5Codec_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7asyncpg_8protocol_8protocol_Codec, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_Codec, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_Codec, /*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_7asyncpg_8protocol_8protocol_Codec, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_DataCodecConfig __pyx_vtable_7asyncpg_8protocol_8protocol_DataCodecConfig;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_DataCodecConfig(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *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_7asyncpg_8protocol_8protocol_DataCodecConfig *)o);
  p->__pyx_vtab = __pyx_vtabptr_7asyncpg_8protocol_8protocol_DataCodecConfig;
  p->_derived_type_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_custom_type_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_DataCodecConfig(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)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);
  Py_CLEAR(p->_derived_type_codecs);
  Py_CLEAR(p->_custom_type_codecs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_DataCodecConfig(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)o;
  if (p->_derived_type_codecs) {
    e = (*v)(p->_derived_type_codecs, a); if (e) return e;
  }
  if (p->_custom_type_codecs) {
    e = (*v)(p->_custom_type_codecs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_DataCodecConfig(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)o;
  tmp = ((PyObject*)p->_derived_type_codecs);
  p->_derived_type_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_custom_type_codecs);
  p->_custom_type_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_DataCodecConfig[] = {
  {"add_types", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_3add_types, METH_O, 0},
  {"add_python_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_5add_python_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"remove_python_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_7remove_python_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"_set_builtin_type_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_9_set_builtin_type_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"set_builtin_type_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_11set_builtin_type_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"clear_type_cache", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_13clear_type_cache, METH_NOARGS, 0},
  {"declare_fallback_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_15declare_fallback_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_17__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_19__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.DataCodecConfig", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_DataCodecConfig, /*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_7asyncpg_8protocol_8protocol_DataCodecConfig, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_DataCodecConfig, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_DataCodecConfig, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7asyncpg_8protocol_8protocol_15DataCodecConfig_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7asyncpg_8protocol_8protocol_DataCodecConfig, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_ConnectionSettings __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_ConnectionSettings(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *p;
  PyObject *o = __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext*)__pyx_vtabptr_7asyncpg_8protocol_8protocol_ConnectionSettings;
  p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_codec = Py_None; Py_INCREF(Py_None);
  p->_settings = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_data_codecs = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_ConnectionSettings(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_encoding);
  Py_CLEAR(p->_codec);
  Py_CLEAR(p->_settings);
  Py_CLEAR(p->_data_codecs);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  if (likely(__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext)) __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_ConnectionSettings);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_ConnectionSettings(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)o;
  e = ((likely(__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext)) ? ((__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_traverse) ? __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_7asyncpg_8protocol_8protocol_ConnectionSettings)); if (e) return e;
  if (p->_codec) {
    e = (*v)(p->_codec, a); if (e) return e;
  }
  if (p->_settings) {
    e = (*v)(p->_settings, a); if (e) return e;
  }
  if (p->_data_codecs) {
    e = (*v)(((PyObject *)p->_data_codecs), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_ConnectionSettings(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)o;
  if (likely(__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext)) { if (__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_clear) __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_7asyncpg_8protocol_8protocol_ConnectionSettings);
  tmp = ((PyObject*)p->_codec);
  p->_codec = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_settings);
  p->_settings = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_data_codecs);
  p->_data_codecs = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_getattro_7asyncpg_8protocol_8protocol_ConnectionSettings(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttrNoDict(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_17__getattr__(o, n);
  }
  return v;
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_ConnectionSettings[] = {
  {"get_text_codec", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_3get_text_codec, METH_NOARGS, 0},
  {"register_data_types", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_5register_data_types, METH_O, 0},
  {"add_python_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_7add_python_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"remove_python_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_9remove_python_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"clear_type_cache", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_11clear_type_cache, METH_NOARGS, 0},
  {"set_builtin_type_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_13set_builtin_type_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"get_data_codec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_15get_data_codec, METH_VARARGS|METH_KEYWORDS, 0},
  {"__getattr__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_17__getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_21__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_23__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.ConnectionSettings", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_ConnectionSettings, /*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
  __pyx_pw_7asyncpg_8protocol_8protocol_18ConnectionSettings_19__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_7asyncpg_8protocol_8protocol_ConnectionSettings, /*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_7asyncpg_8protocol_8protocol_ConnectionSettings, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_ConnectionSettings, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_ConnectionSettings, /*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_7asyncpg_8protocol_8protocol_ConnectionSettings, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_SCRAMAuthentication __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_SCRAMAuthentication(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)o);
  p->__pyx_vtab = __pyx_vtabptr_7asyncpg_8protocol_8protocol_SCRAMAuthentication;
  p->authentication_method = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->authorization_message = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->client_channel_binding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->client_first_message_bare = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->client_nonce = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->client_proof = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->password_salt = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->server_first_message = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->server_key = Py_None; Py_INCREF(Py_None);
  p->server_nonce = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_SCRAMAuthentication(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->authentication_method);
  Py_CLEAR(p->authorization_message);
  Py_CLEAR(p->client_channel_binding);
  Py_CLEAR(p->client_first_message_bare);
  Py_CLEAR(p->client_nonce);
  Py_CLEAR(p->client_proof);
  Py_CLEAR(p->password_salt);
  Py_CLEAR(p->server_first_message);
  Py_CLEAR(p->server_key);
  Py_CLEAR(p->server_nonce);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_SCRAMAuthentication(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)o;
  if (p->server_key) {
    e = (*v)(p->server_key, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_SCRAMAuthentication(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)o;
  tmp = ((PyObject*)p->server_key);
  p->server_key = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_authentication_method(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authentication_method_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_authorization_message(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_21authorization_message_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_channel_binding(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_22client_channel_binding_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_first_message_bare(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_25client_first_message_bare_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_nonce(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_nonce_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_proof(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12client_proof_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_password_salt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_13password_salt_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_password_iterations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_19password_iterations_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_first_message(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_20server_first_message_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_key(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_10server_key_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_nonce(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_12server_nonce_1__get__(o);
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_SCRAMAuthentication[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7asyncpg_8protocol_8protocol_SCRAMAuthentication[] = {
  {(char *)"authentication_method", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_authentication_method, 0, (char *)0, 0},
  {(char *)"authorization_message", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_authorization_message, 0, (char *)0, 0},
  {(char *)"client_channel_binding", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_channel_binding, 0, (char *)0, 0},
  {(char *)"client_first_message_bare", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_first_message_bare, 0, (char *)0, 0},
  {(char *)"client_nonce", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_nonce, 0, (char *)0, 0},
  {(char *)"client_proof", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_client_proof, 0, (char *)0, 0},
  {(char *)"password_salt", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_password_salt, 0, (char *)0, 0},
  {(char *)"password_iterations", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_password_iterations, 0, (char *)0, 0},
  {(char *)"server_first_message", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_first_message, 0, (char *)0, 0},
  {(char *)"server_key", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_key, 0, (char *)0, 0},
  {(char *)"server_nonce", __pyx_getprop_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_server_nonce, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.SCRAMAuthentication", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*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*/
  "Contains the protocol for generating and a SCRAM hashed password.\n\n    Since PostgreSQL 10, the option to hash passwords using the SCRAM-SHA-256\n    method was added. This module follows the defined protocol, which can be\n    referenced from here:\n\n    https://www.postgresql.org/docs/current/sasl-authentication.html#SASL-SCRAM-SHA-256\n\n    libpq references the following RFCs that it uses for implementation:\n\n        * RFC 5802\n        * RFC 5803\n        * RFC 7677\n\n    The protocol works as such:\n\n    - A client connets to the server. The server requests the client to begin\n    SASL authentication using SCRAM and presents a client with the methods it\n    supports. At present, those are SCRAM-SHA-256, and, on servers that are\n    built with OpenSSL and\n    are PG11+, SCRAM-SHA-256-PLUS (which supports channel binding, more on that\n    below)\n\n    - The client sends a \"first message\" to the server, where it chooses which\n    method to authenticate with, and sends, along with the method, an indication\n    of channel binding (we disable for now), a nonce, and the username.\n    (Technically, PostgreSQL ignores the username as it already has it from the\n    initical connection, but we add it for completeness)\n\n    - The server responds with a \"first message\" in which it extends the nonce,\n    as well as a password salt and the number of iterations to hash the password\n    with. The client validates that the new nonce contains the first part of the\n    client's original nonce\n\n    - The client generates a salted password, but does not sent this up to the\n    server. Instead, the client follows the SCRAM algorithm (RFC5802) to\n    generate a proof. This proof is sent aspart of a client \"final message\" to\n    the server for it to validate.\n\n    - The server validates the proof. If it is valid, the server sends a\n    verification code for the client to verify that the server came to the same\n    proof the client did. PostgreSQL i""mmediately sends an AuthenticationOK\n    response right after a valid negotiation. If the password the client\n    provided was invalid, then authentication fails.\n\n    (The beauty of this is that the salted password is never transmitted over\n    the wire!)\n\n    PostgreSQL 11 added support for the channel binding (i.e.\n    SCRAM-SHA-256-PLUS) but to do some ongoing discussion, there is a conscious\n    decision by several driver authors to not support it as of yet. As such, the\n    channel binding parameter is hard-coded to \"n\" for now, but can be updated\n    to support other channel binding methos in the future\n    ", /*tp_doc*/
  __pyx_tp_traverse_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*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_7asyncpg_8protocol_8protocol_SCRAMAuthentication, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_CoreProtocol(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)o);
  p->__pyx_vtab = __pyx_vtabptr_7asyncpg_8protocol_8protocol_CoreProtocol;
  p->buffer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)Py_None); Py_INCREF(Py_None);
  p->_execute_iter = Py_None; Py_INCREF(Py_None);
  p->_execute_portal_name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_execute_stmt_name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->transport = Py_None; Py_INCREF(Py_None);
  p->con_params = Py_None; Py_INCREF(Py_None);
  p->scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)Py_None); Py_INCREF(Py_None);
  p->result = Py_None; Py_INCREF(Py_None);
  p->result_param_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->result_row_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->result_status_msg = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_CoreProtocol(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)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);
  Py_CLEAR(p->buffer);
  Py_CLEAR(p->_execute_iter);
  Py_CLEAR(p->_execute_portal_name);
  Py_CLEAR(p->_execute_stmt_name);
  Py_CLEAR(p->encoding);
  Py_CLEAR(p->transport);
  Py_CLEAR(p->con_params);
  Py_CLEAR(p->scram);
  Py_CLEAR(p->result);
  Py_CLEAR(p->result_param_desc);
  Py_CLEAR(p->result_row_desc);
  Py_CLEAR(p->result_status_msg);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_CoreProtocol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)o;
  if (p->buffer) {
    e = (*v)(((PyObject *)p->buffer), a); if (e) return e;
  }
  if (p->_execute_iter) {
    e = (*v)(p->_execute_iter, a); if (e) return e;
  }
  if (p->transport) {
    e = (*v)(p->transport, a); if (e) return e;
  }
  if (p->con_params) {
    e = (*v)(p->con_params, a); if (e) return e;
  }
  if (p->scram) {
    e = (*v)(((PyObject *)p->scram), a); if (e) return e;
  }
  if (p->result) {
    e = (*v)(p->result, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_CoreProtocol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *)o;
  tmp = ((PyObject*)p->buffer);
  p->buffer = ((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_execute_iter);
  p->_execute_iter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->transport);
  p->transport = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->con_params);
  p->con_params = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->scram);
  p->scram = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->result);
  p->result = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_12CoreProtocol_backend_pid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_11backend_pid_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_12CoreProtocol_backend_secret(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_14backend_secret_1__get__(o);
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_CoreProtocol[] = {
  {"is_in_transaction", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_3is_in_transaction, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7asyncpg_8protocol_8protocol_CoreProtocol[] = {
  {(char *)"backend_pid", __pyx_getprop_7asyncpg_8protocol_8protocol_12CoreProtocol_backend_pid, 0, (char *)0, 0},
  {(char *)"backend_secret", __pyx_getprop_7asyncpg_8protocol_8protocol_12CoreProtocol_backend_secret, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.CoreProtocol", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_CoreProtocol, /*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_7asyncpg_8protocol_8protocol_CoreProtocol, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_CoreProtocol, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_CoreProtocol, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7asyncpg_8protocol_8protocol_CoreProtocol, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7asyncpg_8protocol_8protocol_12CoreProtocol_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7asyncpg_8protocol_8protocol_CoreProtocol, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_PreparedStatementState __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_PreparedStatementState(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)o);
  p->__pyx_vtab = __pyx_vtabptr_7asyncpg_8protocol_8protocol_PreparedStatementState;
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->query = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->record_class = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  p->row_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->parameters_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)Py_None); Py_INCREF(Py_None);
  p->args_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->cols_desc = Py_None; Py_INCREF(Py_None);
  p->rows_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_PreparedStatementState(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->query);
  Py_CLEAR(p->record_class);
  Py_CLEAR(p->row_desc);
  Py_CLEAR(p->parameters_desc);
  Py_CLEAR(p->settings);
  Py_CLEAR(p->args_codecs);
  Py_CLEAR(p->cols_desc);
  Py_CLEAR(p->rows_codecs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_PreparedStatementState(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)o;
  if (p->record_class) {
    e = (*v)(((PyObject *)p->record_class), a); if (e) return e;
  }
  if (p->row_desc) {
    e = (*v)(p->row_desc, a); if (e) return e;
  }
  if (p->parameters_desc) {
    e = (*v)(p->parameters_desc, a); if (e) return e;
  }
  if (p->settings) {
    e = (*v)(((PyObject *)p->settings), a); if (e) return e;
  }
  if (p->args_codecs) {
    e = (*v)(p->args_codecs, a); if (e) return e;
  }
  if (p->cols_desc) {
    e = (*v)(p->cols_desc, a); if (e) return e;
  }
  if (p->rows_codecs) {
    e = (*v)(p->rows_codecs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_PreparedStatementState(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)o;
  tmp = ((PyObject*)p->record_class);
  p->record_class = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->row_desc);
  p->row_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parameters_desc);
  p->parameters_desc = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->settings);
  p->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->args_codecs);
  p->args_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cols_desc);
  p->cols_desc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rows_codecs);
  p->rows_codecs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4name_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_query(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5query_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_closed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_6closed_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_refs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_4refs_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_record_class(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_12record_class_1__get__(o);
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_ignore_custom_codec(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_19ignore_custom_codec_1__get__(o);
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_PreparedStatementState[] = {
  {"_get_parameters", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_3_get_parameters, METH_NOARGS, 0},
  {"_get_attributes", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_5_get_attributes, METH_NOARGS, 0},
  {"_init_types", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_7_init_types, METH_NOARGS, 0},
  {"_init_codecs", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_9_init_codecs, METH_NOARGS, 0},
  {"attach", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_11attach, METH_NOARGS, 0},
  {"detach", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_13detach, METH_NOARGS, 0},
  {"mark_closed", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_15mark_closed, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_17__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_22PreparedStatementState_19__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7asyncpg_8protocol_8protocol_PreparedStatementState[] = {
  {(char *)"name", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_name, 0, (char *)0, 0},
  {(char *)"query", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_query, 0, (char *)0, 0},
  {(char *)"closed", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_closed, 0, (char *)0, 0},
  {(char *)"refs", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_refs, 0, (char *)0, 0},
  {(char *)"record_class", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_record_class, 0, (char *)0, 0},
  {(char *)"ignore_custom_codec", __pyx_getprop_7asyncpg_8protocol_8protocol_22PreparedStatementState_ignore_custom_codec, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.PreparedStatementState", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_PreparedStatementState, /*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_7asyncpg_8protocol_8protocol_PreparedStatementState, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_PreparedStatementState, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_PreparedStatementState, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7asyncpg_8protocol_8protocol_PreparedStatementState, /*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_7asyncpg_8protocol_8protocol_PreparedStatementState, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_BaseProtocol __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol_BaseProtocol(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *p;
  PyObject *o = __pyx_tp_new_7asyncpg_8protocol_8protocol_CoreProtocol(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7asyncpg_8protocol_8protocol_CoreProtocol*)__pyx_vtabptr_7asyncpg_8protocol_8protocol_BaseProtocol;
  p->loop = Py_None; Py_INCREF(Py_None);
  p->address = Py_None; Py_INCREF(Py_None);
  p->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)Py_None); Py_INCREF(Py_None);
  p->cancel_sent_waiter = Py_None; Py_INCREF(Py_None);
  p->cancel_waiter = Py_None; Py_INCREF(Py_None);
  p->waiter = Py_None; Py_INCREF(Py_None);
  p->create_future = Py_None; Py_INCREF(Py_None);
  p->timeout_handle = Py_None; Py_INCREF(Py_None);
  p->timeout_callback = Py_None; Py_INCREF(Py_None);
  p->completed_callback = Py_None; Py_INCREF(Py_None);
  p->conref = Py_None; Py_INCREF(Py_None);
  p->record_class = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  p->last_query = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_BaseProtocol(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)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);
  Py_CLEAR(p->loop);
  Py_CLEAR(p->address);
  Py_CLEAR(p->settings);
  Py_CLEAR(p->cancel_sent_waiter);
  Py_CLEAR(p->cancel_waiter);
  Py_CLEAR(p->waiter);
  Py_CLEAR(p->create_future);
  Py_CLEAR(p->timeout_handle);
  Py_CLEAR(p->timeout_callback);
  Py_CLEAR(p->completed_callback);
  Py_CLEAR(p->conref);
  Py_CLEAR(p->record_class);
  Py_CLEAR(p->last_query);
  Py_CLEAR(p->statement);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_CoreProtocol(o);
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol_BaseProtocol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)o;
  e = __pyx_tp_traverse_7asyncpg_8protocol_8protocol_CoreProtocol(o, v, a); if (e) return e;
  if (p->loop) {
    e = (*v)(p->loop, a); if (e) return e;
  }
  if (p->address) {
    e = (*v)(p->address, a); if (e) return e;
  }
  if (p->settings) {
    e = (*v)(((PyObject *)p->settings), a); if (e) return e;
  }
  if (p->cancel_sent_waiter) {
    e = (*v)(p->cancel_sent_waiter, a); if (e) return e;
  }
  if (p->cancel_waiter) {
    e = (*v)(p->cancel_waiter, a); if (e) return e;
  }
  if (p->waiter) {
    e = (*v)(p->waiter, a); if (e) return e;
  }
  if (p->create_future) {
    e = (*v)(p->create_future, a); if (e) return e;
  }
  if (p->timeout_handle) {
    e = (*v)(p->timeout_handle, a); if (e) return e;
  }
  if (p->timeout_callback) {
    e = (*v)(p->timeout_callback, a); if (e) return e;
  }
  if (p->completed_callback) {
    e = (*v)(p->completed_callback, a); if (e) return e;
  }
  if (p->conref) {
    e = (*v)(p->conref, a); if (e) return e;
  }
  if (p->record_class) {
    e = (*v)(((PyObject *)p->record_class), a); if (e) return e;
  }
  if (p->statement) {
    e = (*v)(((PyObject *)p->statement), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol_BaseProtocol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *)o;
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_CoreProtocol(o);
  tmp = ((PyObject*)p->loop);
  p->loop = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->address);
  p->address = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->settings);
  p->settings = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cancel_sent_waiter);
  p->cancel_sent_waiter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cancel_waiter);
  p->cancel_waiter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->waiter);
  p->waiter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->create_future);
  p->create_future = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->timeout_handle);
  p->timeout_handle = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->timeout_callback);
  p->timeout_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->completed_callback);
  p->completed_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->conref);
  p->conref = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->record_class);
  p->record_class = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->statement);
  p->statement = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_12BaseProtocol_is_ssl(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_1__get__(o);
}

static int __pyx_setprop_7asyncpg_8protocol_8protocol_12BaseProtocol_is_ssl(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_6is_ssl_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7asyncpg_8protocol_8protocol_12BaseProtocol_queries_count(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_13queries_count_1__get__(o);
}

static PyMethodDef __pyx_methods_7asyncpg_8protocol_8protocol_BaseProtocol[] = {
  {"set_connection", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_3set_connection, METH_O, 0},
  {"get_server_pid", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_5get_server_pid, METH_NOARGS, 0},
  {"get_settings", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_7get_settings, METH_NOARGS, 0},
  {"get_record_class", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_9get_record_class, METH_NOARGS, 0},
  {"prepare", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_11prepare, METH_VARARGS|METH_KEYWORDS, 0},
  {"bind_execute", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_14bind_execute, METH_VARARGS|METH_KEYWORDS, 0},
  {"bind_execute_many", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_17bind_execute_many, METH_VARARGS|METH_KEYWORDS, 0},
  {"bind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_20bind, METH_VARARGS|METH_KEYWORDS, 0},
  {"execute", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_23execute, METH_VARARGS|METH_KEYWORDS, 0},
  {"query", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_26query, METH_VARARGS|METH_KEYWORDS, 0},
  {"copy_out", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_29copy_out, METH_VARARGS|METH_KEYWORDS, 0},
  {"copy_in", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_32copy_in, METH_VARARGS|METH_KEYWORDS, 0},
  {"close_statement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_35close_statement, METH_VARARGS|METH_KEYWORDS, 0},
  {"is_closed", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_38is_closed, METH_NOARGS, 0},
  {"is_connected", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_40is_connected, METH_NOARGS, 0},
  {"abort", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_42abort, METH_NOARGS, 0},
  {"close", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_44close, METH_O, 0},
  {"_request_cancel", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_47_request_cancel, METH_NOARGS, 0},
  {"_on_timeout", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_49_on_timeout, METH_O, 0},
  {"_on_waiter_completed", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_51_on_waiter_completed, METH_O, 0},
  {"_create_future_fallback", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_53_create_future_fallback, METH_NOARGS, 0},
  {"_get_timeout", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_55_get_timeout, METH_O, 0},
  {"_is_cancelling", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_57_is_cancelling, METH_NOARGS, 0},
  {"_wait_for_cancellation", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_59_wait_for_cancellation, METH_NOARGS, 0},
  {"data_received", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_62data_received, METH_O, 0},
  {"connection_made", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_64connection_made, METH_O, 0},
  {"connection_lost", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_66connection_lost, METH_O, 0},
  {"pause_writing", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_68pause_writing, METH_NOARGS, 0},
  {"resume_writing", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_70resume_writing, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_72__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_74__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7asyncpg_8protocol_8protocol_BaseProtocol[] = {
  {(char *)"is_ssl", __pyx_getprop_7asyncpg_8protocol_8protocol_12BaseProtocol_is_ssl, __pyx_setprop_7asyncpg_8protocol_8protocol_12BaseProtocol_is_ssl, (char *)0, 0},
  {(char *)"queries_count", __pyx_getprop_7asyncpg_8protocol_8protocol_12BaseProtocol_queries_count, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.BaseProtocol", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol_BaseProtocol, /*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_7asyncpg_8protocol_8protocol_BaseProtocol, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol_BaseProtocol, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7asyncpg_8protocol_8protocol_BaseProtocol, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7asyncpg_8protocol_8protocol_BaseProtocol, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7asyncpg_8protocol_8protocol_12BaseProtocol_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7asyncpg_8protocol_8protocol_BaseProtocol, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *)o;
  Py_CLEAR(p->__pyx_v_a);
  Py_CLEAR(p->__pyx_v_b);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct___bytes_xor", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor, /*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, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_a_i);
  Py_CLEAR(p->__pyx_v_b_i);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_a_i) {
    e = (*v)(p->__pyx_v_a_i, a); if (e) return e;
  }
  if (p->__pyx_v_b_i) {
    e = (*v)(p->__pyx_v_b_i, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_c);
  Py_CLEAR(p->__pyx_v_normalized_password);
  Py_CLEAR(p->__pyx_v_normalized_password_tuple);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)o;
  if (p->__pyx_v_c) {
    e = (*v)(p->__pyx_v_c, a); if (e) return e;
  }
  if (p->__pyx_v_normalized_password_tuple) {
    e = (*v)(p->__pyx_v_normalized_password_tuple, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password *)o;
  tmp = ((PyObject*)p->__pyx_v_c);
  p->__pyx_v_c = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_normalized_password_tuple);
  p->__pyx_v_normalized_password_tuple = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_2__normalize_password", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password, /*tp_traverse*/
  __pyx_tp_clear_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_c);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_c) {
    e = (*v)(p->__pyx_v_c, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_in_prohibited_table);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_in_prohibited_table) {
    e = (*v)(p->__pyx_v_in_prohibited_table, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_c);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_c) {
    e = (*v)(p->__pyx_v_c, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_c);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_c) {
    e = (*v)(p->__pyx_v_c, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_6_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_ignore_custom_codec);
  Py_CLEAR(p->__pyx_v_query);
  Py_CLEAR(p->__pyx_v_record_class);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_stmt_name);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare *)o;
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_ignore_custom_codec) {
    e = (*v)(p->__pyx_v_ignore_custom_codec, a); if (e) return e;
  }
  if (p->__pyx_v_query) {
    e = (*v)(p->__pyx_v_query, a); if (e) return e;
  }
  if (p->__pyx_v_record_class) {
    e = (*v)(p->__pyx_v_record_class, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_stmt_name) {
    e = (*v)(p->__pyx_v_stmt_name, a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_7_prepare", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_args_buf);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_portal_name);
  Py_CLEAR(p->__pyx_v_return_extra);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute *)o;
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_args_buf) {
    e = (*v)(p->__pyx_v_args_buf, a); if (e) return e;
  }
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_return_extra) {
    e = (*v)(p->__pyx_v_return_extra, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_8_bind_execute", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_arg_bufs);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_data_gen);
  Py_CLEAR(p->__pyx_v_e);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_genexpr);
  Py_CLEAR(p->__pyx_v_portal_name);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_timer);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  Py_CLEAR(p->__pyx_t_6);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many *)o;
  if (p->__pyx_v_arg_bufs) {
    e = (*v)(p->__pyx_v_arg_bufs, a); if (e) return e;
  }
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_data_gen) {
    e = (*v)(p->__pyx_v_data_gen, a); if (e) return e;
  }
  if (p->__pyx_v_e) {
    e = (*v)(p->__pyx_v_e, a); if (e) return e;
  }
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_genexpr) {
    e = (*v)(p->__pyx_v_genexpr, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_timer) {
    e = (*v)(p->__pyx_v_timer, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  if (p->__pyx_t_6) {
    e = (*v)(p->__pyx_t_6, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_9_bind_execute_many", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_b);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_b) {
    e = (*v)(p->__pyx_v_b, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_10_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_args);
  Py_CLEAR(p->__pyx_v_args_buf);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_portal_name);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind *)o;
  if (p->__pyx_v_args) {
    e = (*v)(p->__pyx_v_args, a); if (e) return e;
  }
  if (p->__pyx_v_args_buf) {
    e = (*v)(p->__pyx_v_args_buf, a); if (e) return e;
  }
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_11_bind", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_portal_name);
  Py_CLEAR(p->__pyx_v_return_extra);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute *)o;
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_return_extra) {
    e = (*v)(p->__pyx_v_return_extra, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_12_execute", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_query);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query *)o;
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_query) {
    e = (*v)(p->__pyx_v_query, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_13_query", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_buffer);
  Py_CLEAR(p->__pyx_v_copy_stmt);
  Py_CLEAR(p->__pyx_v_done);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_sink);
  Py_CLEAR(p->__pyx_v_status_msg);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_timer);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  Py_CLEAR(p->__pyx_t_6);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out *)o;
  if (p->__pyx_v_buffer) {
    e = (*v)(p->__pyx_v_buffer, a); if (e) return e;
  }
  if (p->__pyx_v_copy_stmt) {
    e = (*v)(p->__pyx_v_copy_stmt, a); if (e) return e;
  }
  if (p->__pyx_v_done) {
    e = (*v)(p->__pyx_v_done, a); if (e) return e;
  }
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_sink) {
    e = (*v)(p->__pyx_v_sink, a); if (e) return e;
  }
  if (p->__pyx_v_status_msg) {
    e = (*v)(p->__pyx_v_status_msg, a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_timer) {
    e = (*v)(p->__pyx_v_timer, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  if (p->__pyx_t_6) {
    e = (*v)(p->__pyx_t_6, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_14_copy_out", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_aiter);
  Py_CLEAR(p->__pyx_v_chunk);
  Py_CLEAR(p->__pyx_v_codec);
  Py_CLEAR(p->__pyx_v_codecs);
  Py_CLEAR(p->__pyx_v_copy_stmt);
  Py_CLEAR(p->__pyx_v_data);
  Py_CLEAR(p->__pyx_v_e);
  Py_CLEAR(p->__pyx_v_item);
  Py_CLEAR(p->__pyx_v_iterator);
  Py_CLEAR(p->__pyx_v_reader);
  Py_CLEAR(p->__pyx_v_record_stmt);
  Py_CLEAR(p->__pyx_v_records);
  Py_CLEAR(p->__pyx_v_row);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_settings);
  Py_CLEAR(p->__pyx_v_status_msg);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_timer);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_v_wbuf);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  Py_CLEAR(p->__pyx_t_6);
  Py_CLEAR(p->__pyx_t_7);
  Py_CLEAR(p->__pyx_t_10);
  Py_CLEAR(p->__pyx_t_11);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in *)o;
  if (p->__pyx_v_aiter) {
    e = (*v)(p->__pyx_v_aiter, a); if (e) return e;
  }
  if (p->__pyx_v_chunk) {
    e = (*v)(p->__pyx_v_chunk, a); if (e) return e;
  }
  if (p->__pyx_v_codec) {
    e = (*v)(((PyObject *)p->__pyx_v_codec), a); if (e) return e;
  }
  if (p->__pyx_v_codecs) {
    e = (*v)(p->__pyx_v_codecs, a); if (e) return e;
  }
  if (p->__pyx_v_copy_stmt) {
    e = (*v)(p->__pyx_v_copy_stmt, a); if (e) return e;
  }
  if (p->__pyx_v_data) {
    e = (*v)(p->__pyx_v_data, a); if (e) return e;
  }
  if (p->__pyx_v_e) {
    e = (*v)(p->__pyx_v_e, a); if (e) return e;
  }
  if (p->__pyx_v_item) {
    e = (*v)(p->__pyx_v_item, a); if (e) return e;
  }
  if (p->__pyx_v_iterator) {
    e = (*v)(p->__pyx_v_iterator, a); if (e) return e;
  }
  if (p->__pyx_v_reader) {
    e = (*v)(p->__pyx_v_reader, a); if (e) return e;
  }
  if (p->__pyx_v_record_stmt) {
    e = (*v)(((PyObject *)p->__pyx_v_record_stmt), a); if (e) return e;
  }
  if (p->__pyx_v_records) {
    e = (*v)(p->__pyx_v_records, a); if (e) return e;
  }
  if (p->__pyx_v_row) {
    e = (*v)(p->__pyx_v_row, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_settings) {
    e = (*v)(((PyObject *)p->__pyx_v_settings), a); if (e) return e;
  }
  if (p->__pyx_v_status_msg) {
    e = (*v)(p->__pyx_v_status_msg, a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_timer) {
    e = (*v)(p->__pyx_v_timer, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_v_wbuf) {
    e = (*v)(((PyObject *)p->__pyx_v_wbuf), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  if (p->__pyx_t_6) {
    e = (*v)(p->__pyx_t_6, a); if (e) return e;
  }
  if (p->__pyx_t_7) {
    e = (*v)(p->__pyx_t_7, a); if (e) return e;
  }
  if (p->__pyx_t_10) {
    e = (*v)(p->__pyx_t_10, a); if (e) return e;
  }
  if (p->__pyx_t_11) {
    e = (*v)(p->__pyx_t_11, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_15_copy_in", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_ex);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_state);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_v_waiter);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement *)o;
  if (p->__pyx_v_ex) {
    e = (*v)(p->__pyx_v_ex, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_state) {
    e = (*v)(((PyObject *)p->__pyx_v_state), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_v_waiter) {
    e = (*v)(p->__pyx_v_waiter, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_16_close_statement", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_timeout);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_timeout) {
    e = (*v)(p->__pyx_v_timeout, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_17_close", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #endif
};

static struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation[8];
static int __pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation = 0;

static PyObject *__pyx_tp_new_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation)))) {
    o = (PyObject*)__pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation[--__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation];
    memset(o, 0, sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation));
    (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_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation(PyObject *o) {
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation)))) {
    __pyx_freelist_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation[__pyx_freecount_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation++] = ((struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *p = (struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation = {
  PyVarObject_HEAD_INIT(0, 0)
  "asyncpg.protocol.protocol.__pyx_scope_struct_18__wait_for_cancellation", /*tp_name*/
  sizeof(struct __pyx_obj_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation, /*tp_traverse*/
  0, /*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_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation, /*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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
  0, /*tp_pypy_flags*/
  #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_protocol(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_protocol},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "protocol",
    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_AF_UNIX, __pyx_k_AF_UNIX, sizeof(__pyx_k_AF_UNIX), 0, 0, 1, 1},
  {&__pyx_n_u_AF_UNIX, __pyx_k_AF_UNIX, sizeof(__pyx_k_AF_UNIX), 0, 1, 0, 1},
  {&__pyx_n_s_ARRAY_TYPES, __pyx_k_ARRAY_TYPES, sizeof(__pyx_k_ARRAY_TYPES), 0, 0, 1, 1},
  {&__pyx_n_s_AUTHENTICATION_METHODS, __pyx_k_AUTHENTICATION_METHODS, sizeof(__pyx_k_AUTHENTICATION_METHODS), 0, 0, 1, 1},
  {&__pyx_n_s_AUTH_METHOD_NAME, __pyx_k_AUTH_METHOD_NAME, sizeof(__pyx_k_AUTH_METHOD_NAME), 0, 0, 1, 1},
  {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  {&__pyx_n_s_AsyncIterable, __pyx_k_AsyncIterable, sizeof(__pyx_k_AsyncIterable), 0, 0, 1, 1},
  {&__pyx_n_s_Attribute, __pyx_k_Attribute, sizeof(__pyx_k_Attribute), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BUILTIN_TYPE_NAME_MAP, __pyx_k_BUILTIN_TYPE_NAME_MAP, sizeof(__pyx_k_BUILTIN_TYPE_NAME_MAP), 0, 0, 1, 1},
  {&__pyx_n_s_BUILTIN_TYPE_OID_MAP, __pyx_k_BUILTIN_TYPE_OID_MAP, sizeof(__pyx_k_BUILTIN_TYPE_OID_MAP), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol, __pyx_k_BaseProtocol, sizeof(__pyx_k_BaseProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol__wait_for_cancellat, __pyx_k_BaseProtocol__wait_for_cancellat, sizeof(__pyx_k_BaseProtocol__wait_for_cancellat), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_bind, __pyx_k_BaseProtocol_bind, sizeof(__pyx_k_BaseProtocol_bind), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_bind_execute, __pyx_k_BaseProtocol_bind_execute, sizeof(__pyx_k_BaseProtocol_bind_execute), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_bind_execute_many, __pyx_k_BaseProtocol_bind_execute_many, sizeof(__pyx_k_BaseProtocol_bind_execute_many), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_close, __pyx_k_BaseProtocol_close, sizeof(__pyx_k_BaseProtocol_close), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_close_statement, __pyx_k_BaseProtocol_close_statement, sizeof(__pyx_k_BaseProtocol_close_statement), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_copy_in, __pyx_k_BaseProtocol_copy_in, sizeof(__pyx_k_BaseProtocol_copy_in), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_copy_out, __pyx_k_BaseProtocol_copy_out, sizeof(__pyx_k_BaseProtocol_copy_out), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_execute, __pyx_k_BaseProtocol_execute, sizeof(__pyx_k_BaseProtocol_execute), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_prepare, __pyx_k_BaseProtocol_prepare, sizeof(__pyx_k_BaseProtocol_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol_query, __pyx_k_BaseProtocol_query, sizeof(__pyx_k_BaseProtocol_query), 0, 0, 1, 1},
  {&__pyx_n_s_BufferError, __pyx_k_BufferError, sizeof(__pyx_k_BufferError), 0, 0, 1, 1},
  {&__pyx_n_s_CancelledError, __pyx_k_CancelledError, sizeof(__pyx_k_CancelledError), 0, 0, 1, 1},
  {&__pyx_kp_u_Check_the_query_against_the_pass, __pyx_k_Check_the_query_against_the_pass, sizeof(__pyx_k_Check_the_query_against_the_pass), 0, 1, 0, 0},
  {&__pyx_kp_b_Client_Key, __pyx_k_Client_Key, sizeof(__pyx_k_Client_Key), 0, 0, 0, 0},
  {&__pyx_n_s_Codec, __pyx_k_Codec, sizeof(__pyx_k_Codec), 0, 0, 1, 1},
  {&__pyx_kp_u_Codec_oid_elem_oid_core, __pyx_k_Codec_oid_elem_oid_core, sizeof(__pyx_k_Codec_oid_elem_oid_core), 0, 1, 0, 0},
  {&__pyx_n_s_ConnectionDoesNotExistError, __pyx_k_ConnectionDoesNotExistError, sizeof(__pyx_k_ConnectionDoesNotExistError), 0, 0, 1, 1},
  {&__pyx_n_s_ConnectionResetError, __pyx_k_ConnectionResetError, sizeof(__pyx_k_ConnectionResetError), 0, 0, 1, 1},
  {&__pyx_n_s_ConnectionSettings, __pyx_k_ConnectionSettings, sizeof(__pyx_k_ConnectionSettings), 0, 0, 1, 1},
  {&__pyx_kp_u_ConnectionSettings_r, __pyx_k_ConnectionSettings_r, sizeof(__pyx_k_ConnectionSettings_r), 0, 1, 0, 0},
  {&__pyx_kp_u_Consider_declaring_an_explicit_c, __pyx_k_Consider_declaring_an_explicit_c, sizeof(__pyx_k_Consider_declaring_an_explicit_c), 0, 1, 0, 0},
  {&__pyx_n_s_CoreProtocol, __pyx_k_CoreProtocol, sizeof(__pyx_k_CoreProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_CLIENT_NONCE_BYTES, __pyx_k_DEFAULT_CLIENT_NONCE_BYTES, sizeof(__pyx_k_DEFAULT_CLIENT_NONCE_BYTES), 0, 0, 1, 1},
  {&__pyx_n_s_DIGEST, __pyx_k_DIGEST, sizeof(__pyx_k_DIGEST), 0, 0, 1, 1},
  {&__pyx_n_s_DataCodecConfig, __pyx_k_DataCodecConfig, sizeof(__pyx_k_DataCodecConfig), 0, 0, 1, 1},
  {&__pyx_n_s_DataError, __pyx_k_DataError, sizeof(__pyx_k_DataError), 0, 0, 1, 1},
  {&__pyx_n_s_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 0, 1, 1},
  {&__pyx_n_s_Future, __pyx_k_Future, sizeof(__pyx_k_Future), 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_kp_s_Incompatible_checksums_s_vs_0x3a, __pyx_k_Incompatible_checksums_s_vs_0x3a, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x3a), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x73, __pyx_k_Incompatible_checksums_s_vs_0x73, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x73), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xfb, __pyx_k_Incompatible_checksums_s_vs_0xfb, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xfb), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_n_s_InterfaceError, __pyx_k_InterfaceError, sizeof(__pyx_k_InterfaceError), 0, 0, 1, 1},
  {&__pyx_n_s_InternalClientError, __pyx_k_InternalClientError, sizeof(__pyx_k_InternalClientError), 0, 0, 1, 1},
  {&__pyx_n_s_Iterable, __pyx_k_Iterable, sizeof(__pyx_k_Iterable), 0, 0, 1, 1},
  {&__pyx_n_s_IterableABC, __pyx_k_IterableABC, sizeof(__pyx_k_IterableABC), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_Mapping, __pyx_k_Mapping, sizeof(__pyx_k_Mapping), 0, 0, 1, 1},
  {&__pyx_n_s_MappingABC, __pyx_k_MappingABC, sizeof(__pyx_k_MappingABC), 0, 0, 1, 1},
  {&__pyx_n_u_NA, __pyx_k_NA, sizeof(__pyx_k_NA), 0, 1, 0, 1},
  {&__pyx_n_u_NFKC, __pyx_k_NFKC, sizeof(__pyx_k_NFKC), 0, 1, 0, 1},
  {&__pyx_n_s_NO_TIMEOUT, __pyx_k_NO_TIMEOUT, sizeof(__pyx_k_NO_TIMEOUT), 0, 0, 1, 1},
  {&__pyx_n_b_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 0, 0, 0, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_u_Note_that_parameters_are_suppor, __pyx_k_Note_that_parameters_are_suppor, sizeof(__pyx_k_Note_that_parameters_are_suppor), 0, 1, 0, 0},
  {&__pyx_kp_u_OID, __pyx_k_OID, sizeof(__pyx_k_OID), 0, 1, 0, 0},
  {&__pyx_kp_u_OID_value_too_large_r, __pyx_k_OID_value_too_large_r, sizeof(__pyx_k_OID_value_too_large_r), 0, 1, 0, 0},
  {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
  {&__pyx_n_s_OutdatedSchemaCacheError, __pyx_k_OutdatedSchemaCacheError, sizeof(__pyx_k_OutdatedSchemaCacheError), 0, 0, 1, 1},
  {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
  {&__pyx_kp_b_PGCOPY, __pyx_k_PGCOPY, sizeof(__pyx_k_PGCOPY), 0, 0, 0, 0},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_kp_u_PostgreSQL_does_not_implement_an, __pyx_k_PostgreSQL_does_not_implement_an, sizeof(__pyx_k_PostgreSQL_does_not_implement_an), 0, 1, 0, 0},
  {&__pyx_n_s_PostgresError, __pyx_k_PostgresError, sizeof(__pyx_k_PostgresError), 0, 0, 1, 1},
  {&__pyx_n_s_PreparedStatementState, __pyx_k_PreparedStatementState, sizeof(__pyx_k_PreparedStatementState), 0, 0, 1, 1},
  {&__pyx_n_s_Protocol, __pyx_k_Protocol, sizeof(__pyx_k_Protocol), 0, 0, 1, 1},
  {&__pyx_n_s_ProtocolError, __pyx_k_ProtocolError, sizeof(__pyx_k_ProtocolError), 0, 0, 1, 1},
  {&__pyx_n_s_REQUIREMENTS_CLIENT_FINAL_MESSAG, __pyx_k_REQUIREMENTS_CLIENT_FINAL_MESSAG, sizeof(__pyx_k_REQUIREMENTS_CLIENT_FINAL_MESSAG), 0, 0, 1, 1},
  {&__pyx_n_s_REQUIREMENTS_CLIENT_PROOF, __pyx_k_REQUIREMENTS_CLIENT_PROOF, sizeof(__pyx_k_REQUIREMENTS_CLIENT_PROOF), 0, 0, 1, 1},
  {&__pyx_n_u_ROLLBACK, __pyx_k_ROLLBACK, sizeof(__pyx_k_ROLLBACK), 0, 1, 0, 1},
  {&__pyx_n_s_Range, __pyx_k_Range, sizeof(__pyx_k_Range), 0, 0, 1, 1},
  {&__pyx_n_s_Record, __pyx_k_Record, sizeof(__pyx_k_Record), 0, 0, 1, 1},
  {&__pyx_n_s_SASLPREP_PROHIBITED, __pyx_k_SASLPREP_PROHIBITED, sizeof(__pyx_k_SASLPREP_PROHIBITED), 0, 0, 1, 1},
  {&__pyx_n_s_SCRAMAuthentication, __pyx_k_SCRAMAuthentication, sizeof(__pyx_k_SCRAMAuthentication), 0, 0, 1, 1},
  {&__pyx_n_s_SCRAMAuthentication__bytes_xor_l, __pyx_k_SCRAMAuthentication__bytes_xor_l, sizeof(__pyx_k_SCRAMAuthentication__bytes_xor_l), 0, 0, 1, 1},
  {&__pyx_n_s_SCRAMAuthentication__normalize_p, __pyx_k_SCRAMAuthentication__normalize_p, sizeof(__pyx_k_SCRAMAuthentication__normalize_p), 0, 0, 1, 1},
  {&__pyx_kp_b_SCRAM_SHA_256, __pyx_k_SCRAM_SHA_256, sizeof(__pyx_k_SCRAM_SHA_256), 0, 0, 0, 0},
  {&__pyx_kp_b_Server_Key, __pyx_k_Server_Key, sizeof(__pyx_k_Server_Key), 0, 0, 0, 0},
  {&__pyx_n_s_Sized, __pyx_k_Sized, sizeof(__pyx_k_Sized), 0, 0, 1, 1},
  {&__pyx_n_s_SizedABC, __pyx_k_SizedABC, sizeof(__pyx_k_SizedABC), 0, 0, 1, 1},
  {&__pyx_n_s_StopAsyncIteration, __pyx_k_StopAsyncIteration, sizeof(__pyx_k_StopAsyncIteration), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 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_TimeoutError, __pyx_k_TimeoutError, sizeof(__pyx_k_TimeoutError), 0, 0, 1, 1},
  {&__pyx_n_u_TimeoutError, __pyx_k_TimeoutError, sizeof(__pyx_k_TimeoutError), 0, 1, 0, 1},
  {&__pyx_n_s_Timer, __pyx_k_Timer, sizeof(__pyx_k_Timer), 0, 0, 1, 1},
  {&__pyx_n_s_Timer___enter, __pyx_k_Timer___enter, sizeof(__pyx_k_Timer___enter), 0, 0, 1, 1},
  {&__pyx_n_s_Timer___exit, __pyx_k_Timer___exit, sizeof(__pyx_k_Timer___exit), 0, 0, 1, 1},
  {&__pyx_n_s_Timer___init, __pyx_k_Timer___init, sizeof(__pyx_k_Timer___init), 0, 0, 1, 1},
  {&__pyx_n_s_Timer_get_remaining_budget, __pyx_k_Timer_get_remaining_budget, sizeof(__pyx_k_Timer_get_remaining_budget), 0, 0, 1, 1},
  {&__pyx_n_s_Timer_has_budget_greater_than, __pyx_k_Timer_has_budget_greater_than, sizeof(__pyx_k_Timer_has_budget_greater_than), 0, 0, 1, 1},
  {&__pyx_kp_u_TimoutError_was_not_raised, __pyx_k_TimoutError_was_not_raised, sizeof(__pyx_k_TimoutError_was_not_raised), 0, 1, 0, 0},
  {&__pyx_n_s_Type, __pyx_k_Type, sizeof(__pyx_k_Type), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UnicodeEncodeError, __pyx_k_UnicodeEncodeError, sizeof(__pyx_k_UnicodeEncodeError), 0, 0, 1, 1},
  {&__pyx_n_s_UnsupportedClientFeatureError, __pyx_k_UnsupportedClientFeatureError, sizeof(__pyx_k_UnsupportedClientFeatureError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
  {&__pyx_kp_b__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 0, 0},
  {&__pyx_n_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 1},
  {&__pyx_kp_b__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 0, 0},
  {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 0},
  {&__pyx_kp_b__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 0, 0, 0},
  {&__pyx_kp_u__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 1, 0, 0},
  {&__pyx_kp_b__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 0, 0, 0},
  {&__pyx_kp_u__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 1, 0, 0},
  {&__pyx_kp_u__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 1, 0, 0},
  {&__pyx_kp_u__41, __pyx_k__41, sizeof(__pyx_k__41), 0, 1, 0, 0},
  {&__pyx_kp_u__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 1, 0, 0},
  {&__pyx_kp_u__43, __pyx_k__43, sizeof(__pyx_k__43), 0, 1, 0, 0},
  {&__pyx_kp_u__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 1, 0, 0},
  {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
  {&__pyx_kp_u_a_sized_iterable_container_expec, __pyx_k_a_sized_iterable_container_expec, sizeof(__pyx_k_a_sized_iterable_container_expec), 0, 1, 0, 0},
  {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1},
  {&__pyx_n_u_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 1, 0, 1},
  {&__pyx_n_s_abort, __pyx_k_abort, sizeof(__pyx_k_abort), 0, 0, 1, 1},
  {&__pyx_n_u_abstime, __pyx_k_abstime, sizeof(__pyx_k_abstime), 0, 1, 0, 1},
  {&__pyx_n_u_aclitem, __pyx_k_aclitem, sizeof(__pyx_k_aclitem), 0, 1, 0, 1},
  {&__pyx_n_s_add_done_callback, __pyx_k_add_done_callback, sizeof(__pyx_k_add_done_callback), 0, 0, 1, 1},
  {&__pyx_n_s_add_python_codec, __pyx_k_add_python_codec, sizeof(__pyx_k_add_python_codec), 0, 0, 1, 1},
  {&__pyx_n_s_add_types, __pyx_k_add_types, sizeof(__pyx_k_add_types), 0, 0, 1, 1},
  {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1},
  {&__pyx_n_s_aiter, __pyx_k_aiter, sizeof(__pyx_k_aiter), 0, 0, 1, 1},
  {&__pyx_n_s_alias_to, __pyx_k_alias_to, sizeof(__pyx_k_alias_to), 0, 0, 1, 1},
  {&__pyx_kp_u_already_connected, __pyx_k_already_connected, sizeof(__pyx_k_already_connected), 0, 1, 0, 0},
  {&__pyx_n_u_alt, __pyx_k_alt, sizeof(__pyx_k_alt), 0, 1, 0, 1},
  {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1},
  {&__pyx_n_s_anext, __pyx_k_anext, sizeof(__pyx_k_anext), 0, 0, 1, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_u_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 1, 0, 1},
  {&__pyx_n_u_anyarray, __pyx_k_anyarray, sizeof(__pyx_k_anyarray), 0, 1, 0, 1},
  {&__pyx_n_u_anycompatible, __pyx_k_anycompatible, sizeof(__pyx_k_anycompatible), 0, 1, 0, 1},
  {&__pyx_n_u_anycompatiblearray, __pyx_k_anycompatiblearray, sizeof(__pyx_k_anycompatiblearray), 0, 1, 0, 1},
  {&__pyx_n_u_anycompatiblenonarray, __pyx_k_anycompatiblenonarray, sizeof(__pyx_k_anycompatiblenonarray), 0, 1, 0, 1},
  {&__pyx_n_u_anycompatiblerange, __pyx_k_anycompatiblerange, sizeof(__pyx_k_anycompatiblerange), 0, 1, 0, 1},
  {&__pyx_n_u_anyelement, __pyx_k_anyelement, sizeof(__pyx_k_anyelement), 0, 1, 0, 1},
  {&__pyx_n_u_anyenum, __pyx_k_anyenum, sizeof(__pyx_k_anyenum), 0, 1, 0, 1},
  {&__pyx_n_u_anynonarray, __pyx_k_anynonarray, sizeof(__pyx_k_anynonarray), 0, 1, 0, 1},
  {&__pyx_n_u_anyrange, __pyx_k_anyrange, sizeof(__pyx_k_anyrange), 0, 1, 0, 1},
  {&__pyx_n_s_apg_exc, __pyx_k_apg_exc, sizeof(__pyx_k_apg_exc), 0, 0, 1, 1},
  {&__pyx_n_s_apg_exc_base, __pyx_k_apg_exc_base, sizeof(__pyx_k_apg_exc_base), 0, 0, 1, 1},
  {&__pyx_n_s_apg_types, __pyx_k_apg_types, sizeof(__pyx_k_apg_types), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_u_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 1, 0, 1},
  {&__pyx_kp_u_array_length_overflow, __pyx_k_array_length_overflow, sizeof(__pyx_k_array_length_overflow), 0, 1, 0, 0},
  {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
  {&__pyx_n_s_asyncio, __pyx_k_asyncio, sizeof(__pyx_k_asyncio), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio_tasks, __pyx_k_asyncio_tasks, sizeof(__pyx_k_asyncio_tasks), 0, 0, 1, 1},
  {&__pyx_n_s_asyncpg, __pyx_k_asyncpg, sizeof(__pyx_k_asyncpg), 0, 0, 1, 1},
  {&__pyx_kp_u_asyncpg_Protocol_has_no_referenc, __pyx_k_asyncpg_Protocol_has_no_referenc, sizeof(__pyx_k_asyncpg_Protocol_has_no_referenc), 0, 1, 0, 0},
  {&__pyx_n_s_asyncpg_exceptions, __pyx_k_asyncpg_exceptions, sizeof(__pyx_k_asyncpg_exceptions), 0, 0, 1, 1},
  {&__pyx_n_s_asyncpg_protocol_protocol, __pyx_k_asyncpg_protocol_protocol, sizeof(__pyx_k_asyncpg_protocol_protocol), 0, 0, 1, 1},
  {&__pyx_kp_s_asyncpg_protocol_protocol_pyx, __pyx_k_asyncpg_protocol_protocol_pyx, sizeof(__pyx_k_asyncpg_protocol_protocol_pyx), 0, 0, 1, 0},
  {&__pyx_n_u_attrnames, __pyx_k_attrnames, sizeof(__pyx_k_attrnames), 0, 1, 0, 1},
  {&__pyx_n_u_attrtypoids, __pyx_k_attrtypoids, sizeof(__pyx_k_attrtypoids), 0, 1, 0, 1},
  {&__pyx_n_s_auth_msg, __pyx_k_auth_msg, sizeof(__pyx_k_auth_msg), 0, 0, 1, 1},
  {&__pyx_n_s_authentication_method, __pyx_k_authentication_method, sizeof(__pyx_k_authentication_method), 0, 0, 1, 1},
  {&__pyx_n_s_await, __pyx_k_await, sizeof(__pyx_k_await), 0, 0, 1, 1},
  {&__pyx_n_s_b64decode, __pyx_k_b64decode, sizeof(__pyx_k_b64decode), 0, 0, 1, 1},
  {&__pyx_n_s_b64encode, __pyx_k_b64encode, sizeof(__pyx_k_b64encode), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_base64, __pyx_k_base64, sizeof(__pyx_k_base64), 0, 0, 1, 1},
  {&__pyx_n_u_basetype, __pyx_k_basetype, sizeof(__pyx_k_basetype), 0, 1, 0, 1},
  {&__pyx_n_u_basetype_name, __pyx_k_basetype_name, sizeof(__pyx_k_basetype_name), 0, 1, 0, 1},
  {&__pyx_n_u_big, __pyx_k_big, sizeof(__pyx_k_big), 0, 1, 0, 1},
  {&__pyx_n_u_bigint, __pyx_k_bigint, sizeof(__pyx_k_bigint), 0, 1, 0, 1},
  {&__pyx_n_u_binary, __pyx_k_binary, sizeof(__pyx_k_binary), 0, 1, 0, 1},
  {&__pyx_n_s_bind, __pyx_k_bind, sizeof(__pyx_k_bind), 0, 0, 1, 1},
  {&__pyx_n_s_bind_execute, __pyx_k_bind_execute, sizeof(__pyx_k_bind_execute), 0, 0, 1, 1},
  {&__pyx_n_s_bind_execute_many, __pyx_k_bind_execute_many, sizeof(__pyx_k_bind_execute_many), 0, 0, 1, 1},
  {&__pyx_n_s_bind_execute_many_locals_genexpr, __pyx_k_bind_execute_many_locals_genexpr, sizeof(__pyx_k_bind_execute_many_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_u_bit, __pyx_k_bit, sizeof(__pyx_k_bit), 0, 1, 0, 1},
  {&__pyx_kp_u_bit_varying, __pyx_k_bit_varying, sizeof(__pyx_k_bit_varying), 0, 1, 0, 0},
  {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 0, 1},
  {&__pyx_n_u_box, __pyx_k_box, sizeof(__pyx_k_box), 0, 1, 0, 1},
  {&__pyx_n_u_bpchar, __pyx_k_bpchar, sizeof(__pyx_k_bpchar), 0, 1, 0, 1},
  {&__pyx_n_s_budget, __pyx_k_budget, sizeof(__pyx_k_budget), 0, 0, 1, 1},
  {&__pyx_n_s_budget_2, __pyx_k_budget_2, sizeof(__pyx_k_budget_2), 0, 0, 1, 1},
  {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
  {&__pyx_n_u_bytea, __pyx_k_bytea, sizeof(__pyx_k_bytea), 0, 1, 0, 1},
  {&__pyx_n_s_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 0, 0, 1, 1},
  {&__pyx_n_b_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 0, 1},
  {&__pyx_kp_b_c_2, __pyx_k_c_2, sizeof(__pyx_k_c_2), 0, 0, 0, 0},
  {&__pyx_kp_b_c_3, __pyx_k_c_3, sizeof(__pyx_k_c_3), 0, 0, 0, 0},
  {&__pyx_n_s_cache_key, __pyx_k_cache_key, sizeof(__pyx_k_cache_key), 0, 0, 1, 1},
  {&__pyx_n_s_call_exception_handler, __pyx_k_call_exception_handler, sizeof(__pyx_k_call_exception_handler), 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_cancel_current_command, __pyx_k_cancel_current_command, sizeof(__pyx_k_cancel_current_command), 0, 0, 1, 1},
  {&__pyx_n_s_cancelled, __pyx_k_cancelled, sizeof(__pyx_k_cancelled), 0, 0, 1, 1},
  {&__pyx_kp_u_cannot_alias, __pyx_k_cannot_alias, sizeof(__pyx_k_cannot_alias), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_close_prepared_statement, __pyx_k_cannot_close_prepared_statement, sizeof(__pyx_k_cannot_close_prepared_statement), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_decode_type_text_encoding, __pyx_k_cannot_decode_type_text_encoding, sizeof(__pyx_k_cannot_decode_type_text_encoding), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_decode_type_text_encoding_2, __pyx_k_cannot_decode_type_text_encoding_2, sizeof(__pyx_k_cannot_decode_type_text_encoding_2), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_perform_operation_another, __pyx_k_cannot_perform_operation_another, sizeof(__pyx_k_cannot_perform_operation_another), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_perform_operation_another_2, __pyx_k_cannot_perform_operation_another_2, sizeof(__pyx_k_cannot_perform_operation_another_2), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_perform_operation_connect, __pyx_k_cannot_perform_operation_connect, sizeof(__pyx_k_cannot_perform_operation_connect), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_process_message, __pyx_k_cannot_process_message, sizeof(__pyx_k_cannot_process_message), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_register_core_codec_for_O, __pyx_k_cannot_register_core_codec_for_O, sizeof(__pyx_k_cannot_register_core_codec_for_O), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_switch_to_idle_state_prot, __pyx_k_cannot_switch_to_idle_state_prot, sizeof(__pyx_k_cannot_switch_to_idle_state_prot), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_switch_to_state_another_o, __pyx_k_cannot_switch_to_state_another_o, sizeof(__pyx_k_cannot_switch_to_state_another_o), 0, 1, 0, 0},
  {&__pyx_kp_u_cannot_switch_to_state_protocol, __pyx_k_cannot_switch_to_state_protocol, sizeof(__pyx_k_cannot_switch_to_state_protocol), 0, 1, 0, 0},
  {&__pyx_n_s_cause, __pyx_k_cause, sizeof(__pyx_k_cause), 0, 0, 1, 1},
  {&__pyx_n_u_char, __pyx_k_char, sizeof(__pyx_k_char), 0, 1, 0, 1},
  {&__pyx_n_u_character, __pyx_k_character, sizeof(__pyx_k_character), 0, 1, 0, 1},
  {&__pyx_kp_u_character_varying, __pyx_k_character_varying, sizeof(__pyx_k_character_varying), 0, 1, 0, 0},
  {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
  {&__pyx_n_u_cid, __pyx_k_cid, sizeof(__pyx_k_cid), 0, 1, 0, 1},
  {&__pyx_n_u_cidr, __pyx_k_cidr, sizeof(__pyx_k_cidr), 0, 1, 0, 1},
  {&__pyx_n_u_circle, __pyx_k_circle, sizeof(__pyx_k_circle), 0, 1, 0, 1},
  {&__pyx_n_s_cleanup, __pyx_k_cleanup, sizeof(__pyx_k_cleanup), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_clear_type_cache, __pyx_k_clear_type_cache, sizeof(__pyx_k_clear_type_cache), 0, 0, 1, 1},
  {&__pyx_n_u_client_channel_binding, __pyx_k_client_channel_binding, sizeof(__pyx_k_client_channel_binding), 0, 1, 0, 1},
  {&__pyx_n_b_client_encoding, __pyx_k_client_encoding, sizeof(__pyx_k_client_encoding), 0, 0, 0, 1},
  {&__pyx_n_u_client_encoding, __pyx_k_client_encoding, sizeof(__pyx_k_client_encoding), 0, 1, 0, 1},
  {&__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_n_s_close_statement, __pyx_k_close_statement, sizeof(__pyx_k_close_statement), 0, 0, 1, 1},
  {&__pyx_kp_u_codec_for, __pyx_k_codec_for, sizeof(__pyx_k_codec_for), 0, 1, 0, 0},
  {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
  {&__pyx_n_s_command_timeout, __pyx_k_command_timeout, sizeof(__pyx_k_command_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_compat, __pyx_k_compat, sizeof(__pyx_k_compat), 0, 0, 1, 1},
  {&__pyx_n_u_composite, __pyx_k_composite, sizeof(__pyx_k_composite), 0, 1, 0, 1},
  {&__pyx_n_s_con_params, __pyx_k_con_params, sizeof(__pyx_k_con_params), 0, 0, 1, 1},
  {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
  {&__pyx_n_s_conn_key, __pyx_k_conn_key, sizeof(__pyx_k_conn_key), 0, 0, 1, 1},
  {&__pyx_n_s_connected_fut, __pyx_k_connected_fut, sizeof(__pyx_k_connected_fut), 0, 0, 1, 1},
  {&__pyx_kp_u_connection_was_closed_in_the_mid, __pyx_k_connection_was_closed_in_the_mid, sizeof(__pyx_k_connection_was_closed_in_the_mid), 0, 1, 0, 0},
  {&__pyx_n_s_copy_in, __pyx_k_copy_in, sizeof(__pyx_k_copy_in), 0, 0, 1, 1},
  {&__pyx_n_s_copy_in_locals_lambda, __pyx_k_copy_in_locals_lambda, sizeof(__pyx_k_copy_in_locals_lambda), 0, 0, 1, 1},
  {&__pyx_n_s_copy_out, __pyx_k_copy_out, sizeof(__pyx_k_copy_out), 0, 0, 1, 1},
  {&__pyx_n_s_copy_out_locals_lambda, __pyx_k_copy_out_locals_lambda, sizeof(__pyx_k_copy_out_locals_lambda), 0, 0, 1, 1},
  {&__pyx_n_s_copy_stmt, __pyx_k_copy_stmt, sizeof(__pyx_k_copy_stmt), 0, 0, 1, 1},
  {&__pyx_kp_u_could_not_get_iterations, __pyx_k_could_not_get_iterations, sizeof(__pyx_k_could_not_get_iterations), 0, 1, 0, 0},
  {&__pyx_kp_u_could_not_get_nonce, __pyx_k_could_not_get_nonce, sizeof(__pyx_k_could_not_get_nonce), 0, 1, 0, 0},
  {&__pyx_kp_u_could_not_get_salt, __pyx_k_could_not_get_salt, sizeof(__pyx_k_could_not_get_salt), 0, 1, 0, 0},
  {&__pyx_kp_u_could_not_get_server_signature, __pyx_k_could_not_get_server_signature, sizeof(__pyx_k_could_not_get_server_signature), 0, 1, 0, 0},
  {&__pyx_kp_u_could_not_verify_server_signatur, __pyx_k_could_not_verify_server_signatur, sizeof(__pyx_k_could_not_verify_server_signatur), 0, 1, 0, 0},
  {&__pyx_n_u_cp1250, __pyx_k_cp1250, sizeof(__pyx_k_cp1250), 0, 1, 0, 1},
  {&__pyx_n_u_cp1251, __pyx_k_cp1251, sizeof(__pyx_k_cp1251), 0, 1, 0, 1},
  {&__pyx_n_u_cp1252, __pyx_k_cp1252, sizeof(__pyx_k_cp1252), 0, 1, 0, 1},
  {&__pyx_n_u_cp1253, __pyx_k_cp1253, sizeof(__pyx_k_cp1253), 0, 1, 0, 1},
  {&__pyx_n_u_cp1254, __pyx_k_cp1254, sizeof(__pyx_k_cp1254), 0, 1, 0, 1},
  {&__pyx_n_u_cp1255, __pyx_k_cp1255, sizeof(__pyx_k_cp1255), 0, 1, 0, 1},
  {&__pyx_n_u_cp1256, __pyx_k_cp1256, sizeof(__pyx_k_cp1256), 0, 1, 0, 1},
  {&__pyx_n_u_cp1257, __pyx_k_cp1257, sizeof(__pyx_k_cp1257), 0, 1, 0, 1},
  {&__pyx_n_u_cp1258, __pyx_k_cp1258, sizeof(__pyx_k_cp1258), 0, 1, 0, 1},
  {&__pyx_n_u_cp1521, __pyx_k_cp1521, sizeof(__pyx_k_cp1521), 0, 1, 0, 1},
  {&__pyx_n_u_cp866, __pyx_k_cp866, sizeof(__pyx_k_cp866), 0, 1, 0, 1},
  {&__pyx_n_u_cp874, __pyx_k_cp874, sizeof(__pyx_k_cp874), 0, 1, 0, 1},
  {&__pyx_n_u_cp932, __pyx_k_cp932, sizeof(__pyx_k_cp932), 0, 1, 0, 1},
  {&__pyx_n_u_cp936, __pyx_k_cp936, sizeof(__pyx_k_cp936), 0, 1, 0, 1},
  {&__pyx_n_u_cp949, __pyx_k_cp949, sizeof(__pyx_k_cp949), 0, 1, 0, 1},
  {&__pyx_n_u_cp950, __pyx_k_cp950, sizeof(__pyx_k_cp950), 0, 1, 0, 1},
  {&__pyx_n_s_create_future, __pyx_k_create_future, sizeof(__pyx_k_create_future), 0, 0, 1, 1},
  {&__pyx_n_s_create_future_fallback, __pyx_k_create_future_fallback, sizeof(__pyx_k_create_future_fallback), 0, 0, 1, 1},
  {&__pyx_n_s_create_record, __pyx_k_create_record, sizeof(__pyx_k_create_record), 0, 0, 1, 1},
  {&__pyx_n_u_cstring, __pyx_k_cstring, sizeof(__pyx_k_cstring), 0, 1, 0, 1},
  {&__pyx_n_b_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 0, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_type, __pyx_k_data_type, sizeof(__pyx_k_data_type), 0, 0, 1, 1},
  {&__pyx_n_s_database, __pyx_k_database, sizeof(__pyx_k_database), 0, 0, 1, 1},
  {&__pyx_n_u_database, __pyx_k_database, sizeof(__pyx_k_database), 0, 1, 0, 1},
  {&__pyx_n_u_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 1, 0, 1},
  {&__pyx_n_u_decimal, __pyx_k_decimal, sizeof(__pyx_k_decimal), 0, 1, 0, 1},
  {&__pyx_n_s_declare_fallback_codec, __pyx_k_declare_fallback_codec, sizeof(__pyx_k_declare_fallback_codec), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_kp_u_decode_row_statement_is_None, __pyx_k_decode_row_statement_is_None, sizeof(__pyx_k_decode_row_statement_is_None), 0, 1, 0, 0},
  {&__pyx_n_s_decoder, __pyx_k_decoder, sizeof(__pyx_k_decoder), 0, 0, 1, 1},
  {&__pyx_n_s_desc, __pyx_k_desc, sizeof(__pyx_k_desc), 0, 0, 1, 1},
  {&__pyx_n_s_detail, __pyx_k_detail, sizeof(__pyx_k_detail), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_digest, __pyx_k_digest, sizeof(__pyx_k_digest), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_done, __pyx_k_done, sizeof(__pyx_k_done), 0, 0, 1, 1},
  {&__pyx_kp_u_double_precision, __pyx_k_double_precision, sizeof(__pyx_k_double_precision), 0, 1, 0, 0},
  {&__pyx_n_b_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 0, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 0, 0, 1, 1},
  {&__pyx_n_u_elemdelim, __pyx_k_elemdelim, sizeof(__pyx_k_elemdelim), 0, 1, 0, 1},
  {&__pyx_n_s_elems, __pyx_k_elems, sizeof(__pyx_k_elems), 0, 0, 1, 1},
  {&__pyx_n_u_elemtype, __pyx_k_elemtype, sizeof(__pyx_k_elemtype), 0, 1, 0, 1},
  {&__pyx_n_u_elemtype_name, __pyx_k_elemtype_name, sizeof(__pyx_k_elemtype_name), 0, 1, 0, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encoder, __pyx_k_encoder, sizeof(__pyx_k_encoder), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_et, __pyx_k_et, sizeof(__pyx_k_et), 0, 0, 1, 1},
  {&__pyx_n_u_euc_cn, __pyx_k_euc_cn, sizeof(__pyx_k_euc_cn), 0, 1, 0, 1},
  {&__pyx_n_u_euc_jis_2004, __pyx_k_euc_jis_2004, sizeof(__pyx_k_euc_jis_2004), 0, 1, 0, 1},
  {&__pyx_n_u_euc_jp, __pyx_k_euc_jp, sizeof(__pyx_k_euc_jp), 0, 1, 0, 1},
  {&__pyx_n_u_euc_kr, __pyx_k_euc_kr, sizeof(__pyx_k_euc_kr), 0, 1, 0, 1},
  {&__pyx_n_u_euccn, __pyx_k_euccn, sizeof(__pyx_k_euccn), 0, 1, 0, 1},
  {&__pyx_n_u_eucjp, __pyx_k_eucjp, sizeof(__pyx_k_eucjp), 0, 1, 0, 1},
  {&__pyx_n_u_euckr, __pyx_k_euckr, sizeof(__pyx_k_euckr), 0, 1, 0, 1},
  {&__pyx_n_u_event_trigger, __pyx_k_event_trigger, sizeof(__pyx_k_event_trigger), 0, 1, 0, 1},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1},
  {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_kp_u_expected_0_1_or_2_elements_in_ra, __pyx_k_expected_0_1_or_2_elements_in_ra, sizeof(__pyx_k_expected_0_1_or_2_elements_in_ra), 0, 1, 0, 0},
  {&__pyx_n_s_family, __pyx_k_family, sizeof(__pyx_k_family), 0, 0, 1, 1},
  {&__pyx_n_u_fdw_handler, __pyx_k_fdw_handler, sizeof(__pyx_k_fdw_handler), 0, 1, 0, 1},
  {&__pyx_n_u_float4, __pyx_k_float4, sizeof(__pyx_k_float4), 0, 1, 0, 1},
  {&__pyx_n_u_float8, __pyx_k_float8, sizeof(__pyx_k_float8), 0, 1, 0, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_generate_token_bytes, __pyx_k_generate_token_bytes, sizeof(__pyx_k_generate_token_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_data_codec, __pyx_k_get_data_codec, sizeof(__pyx_k_get_data_codec), 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_remaining_budget, __pyx_k_get_remaining_budget, sizeof(__pyx_k_get_remaining_budget), 0, 0, 1, 1},
  {&__pyx_n_s_get_timeout, __pyx_k_get_timeout, sizeof(__pyx_k_get_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_getattribute, __pyx_k_getattribute, sizeof(__pyx_k_getattribute), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_kp_u_got_result_for_unknown_protocol, __pyx_k_got_result_for_unknown_protocol, sizeof(__pyx_k_got_result_for_unknown_protocol), 0, 1, 0, 0},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_u_gtsvector, __pyx_k_gtsvector, sizeof(__pyx_k_gtsvector), 0, 1, 0, 1},
  {&__pyx_n_s_has_budget_greater_than, __pyx_k_has_budget_greater_than, sizeof(__pyx_k_has_budget_greater_than), 0, 0, 1, 1},
  {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1},
  {&__pyx_n_s_hashlib_md5, __pyx_k_hashlib_md5, sizeof(__pyx_k_hashlib_md5), 0, 0, 1, 1},
  {&__pyx_n_s_hexdigest, __pyx_k_hexdigest, sizeof(__pyx_k_hexdigest), 0, 0, 1, 1},
  {&__pyx_n_s_hint, __pyx_k_hint, sizeof(__pyx_k_hint), 0, 0, 1, 1},
  {&__pyx_n_s_hmac, __pyx_k_hmac, sizeof(__pyx_k_hmac), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_kp_b_i_d, __pyx_k_i_d, sizeof(__pyx_k_i_d), 0, 0, 0, 0},
  {&__pyx_n_s_ignore_custom_codec, __pyx_k_ignore_custom_codec, sizeof(__pyx_k_ignore_custom_codec), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_a1, __pyx_k_in_table_a1, sizeof(__pyx_k_in_table_a1), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_b1, __pyx_k_in_table_b1, sizeof(__pyx_k_in_table_b1), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c12, __pyx_k_in_table_c12, sizeof(__pyx_k_in_table_c12), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c21_c22, __pyx_k_in_table_c21_c22, sizeof(__pyx_k_in_table_c21_c22), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c3, __pyx_k_in_table_c3, sizeof(__pyx_k_in_table_c3), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c4, __pyx_k_in_table_c4, sizeof(__pyx_k_in_table_c4), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c5, __pyx_k_in_table_c5, sizeof(__pyx_k_in_table_c5), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c6, __pyx_k_in_table_c6, sizeof(__pyx_k_in_table_c6), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c7, __pyx_k_in_table_c7, sizeof(__pyx_k_in_table_c7), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c8, __pyx_k_in_table_c8, sizeof(__pyx_k_in_table_c8), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_c9, __pyx_k_in_table_c9, sizeof(__pyx_k_in_table_c9), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_d1, __pyx_k_in_table_d1, sizeof(__pyx_k_in_table_d1), 0, 0, 1, 1},
  {&__pyx_n_s_in_table_d2, __pyx_k_in_table_d2, sizeof(__pyx_k_in_table_d2), 0, 0, 1, 1},
  {&__pyx_kp_u_inconsistent_sub_array_dimension, __pyx_k_inconsistent_sub_array_dimension, sizeof(__pyx_k_inconsistent_sub_array_dimension), 0, 1, 0, 0},
  {&__pyx_n_u_index_am_handler, __pyx_k_index_am_handler, sizeof(__pyx_k_index_am_handler), 0, 1, 0, 1},
  {&__pyx_n_u_inet, __pyx_k_inet, sizeof(__pyx_k_inet), 0, 1, 0, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_kp_u_input_of_anonymous_composite_typ, __pyx_k_input_of_anonymous_composite_typ, sizeof(__pyx_k_input_of_anonymous_composite_typ), 0, 1, 0, 0},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1},
  {&__pyx_n_u_int2, __pyx_k_int2, sizeof(__pyx_k_int2), 0, 1, 0, 1},
  {&__pyx_n_u_int4, __pyx_k_int4, sizeof(__pyx_k_int4), 0, 1, 0, 1},
  {&__pyx_n_u_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 1, 0, 1},
  {&__pyx_n_u_integer, __pyx_k_integer, sizeof(__pyx_k_integer), 0, 1, 0, 1},
  {&__pyx_n_u_internal, __pyx_k_internal, sizeof(__pyx_k_internal), 0, 1, 0, 1},
  {&__pyx_n_u_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 1, 0, 1},
  {&__pyx_kp_u_invalid_array_element, __pyx_k_invalid_array_element, sizeof(__pyx_k_invalid_array_element), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_array_element_at_index, __pyx_k_invalid_array_element_at_index, sizeof(__pyx_k_invalid_array_element_at_index), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_data_format, __pyx_k_invalid_data_format, sizeof(__pyx_k_invalid_data_format), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_format_argument_expected, __pyx_k_invalid_format_argument_expected, sizeof(__pyx_k_invalid_format_argument_expected), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_input_for_query_argument, __pyx_k_invalid_input_for_query_argument, sizeof(__pyx_k_invalid_input_for_query_argument), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_nonce, __pyx_k_invalid_nonce, sizeof(__pyx_k_invalid_nonce), 0, 1, 0, 0},
  {&__pyx_kp_u_invalid_timeout_value_expected_n, __pyx_k_invalid_timeout_value_expected_n, sizeof(__pyx_k_invalid_timeout_value_expected_n), 0, 1, 0, 0},
  {&__pyx_n_s_is_in_transaction, __pyx_k_is_in_transaction, sizeof(__pyx_k_is_in_transaction), 0, 0, 1, 1},
  {&__pyx_n_s_isempty, __pyx_k_isempty, sizeof(__pyx_k_isempty), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_u_json, __pyx_k_json, sizeof(__pyx_k_json), 0, 1, 0, 1},
  {&__pyx_n_u_jsonb, __pyx_k_jsonb, sizeof(__pyx_k_jsonb), 0, 1, 0, 1},
  {&__pyx_n_u_jsonpath, __pyx_k_jsonpath, sizeof(__pyx_k_jsonpath), 0, 1, 0, 1},
  {&__pyx_n_u_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 1, 0, 1},
  {&__pyx_n_u_koi8_r, __pyx_k_koi8_r, sizeof(__pyx_k_koi8_r), 0, 1, 0, 1},
  {&__pyx_n_u_koi8_u, __pyx_k_koi8_u, sizeof(__pyx_k_koi8_u), 0, 1, 0, 1},
  {&__pyx_n_u_koi8r, __pyx_k_koi8r, sizeof(__pyx_k_koi8r), 0, 1, 0, 1},
  {&__pyx_n_u_koi8u, __pyx_k_koi8u, sizeof(__pyx_k_koi8u), 0, 1, 0, 1},
  {&__pyx_n_u_language_handler, __pyx_k_language_handler, sizeof(__pyx_k_language_handler), 0, 1, 0, 1},
  {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1},
  {&__pyx_n_u_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 1, 0, 1},
  {&__pyx_kp_u_list_tuple_or_Range_object_expec, __pyx_k_list_tuple_or_Range_object_expec, sizeof(__pyx_k_list_tuple_or_Range_object_expec), 0, 1, 0, 0},
  {&__pyx_n_s_lookup, __pyx_k_lookup, sizeof(__pyx_k_lookup), 0, 0, 1, 1},
  {&__pyx_n_s_loop, __pyx_k_loop, sizeof(__pyx_k_loop), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_lower_inc, __pyx_k_lower_inc, sizeof(__pyx_k_lower_inc), 0, 0, 1, 1},
  {&__pyx_n_u_lseg, __pyx_k_lseg, sizeof(__pyx_k_lseg), 0, 1, 0, 1},
  {&__pyx_n_u_macaddr, __pyx_k_macaddr, sizeof(__pyx_k_macaddr), 0, 1, 0, 1},
  {&__pyx_n_u_macaddr8, __pyx_k_macaddr8, sizeof(__pyx_k_macaddr8), 0, 1, 0, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_kp_u_malformed_array_literal_r, __pyx_k_malformed_array_literal_r, sizeof(__pyx_k_malformed_array_literal_r), 0, 1, 0, 0},
  {&__pyx_n_s_mapping, __pyx_k_mapping, sizeof(__pyx_k_mapping), 0, 0, 1, 1},
  {&__pyx_n_b_md5, __pyx_k_md5, sizeof(__pyx_k_md5), 0, 0, 0, 1},
  {&__pyx_n_s_md5, __pyx_k_md5, sizeof(__pyx_k_md5), 0, 0, 1, 1},
  {&__pyx_n_s_memoryview, __pyx_k_memoryview, sizeof(__pyx_k_memoryview), 0, 0, 1, 1},
  {&__pyx_n_u_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 1, 0, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_kp_u_missing_after_array_dimensions, __pyx_k_missing_after_array_dimensions, sizeof(__pyx_k_missing_after_array_dimensions), 0, 1, 0, 0},
  {&__pyx_kp_u_missing_after_array_dimensions_2, __pyx_k_missing_after_array_dimensions_2, sizeof(__pyx_k_missing_after_array_dimensions_2), 0, 1, 0, 0},
  {&__pyx_kp_u_missing_array_dimension_value, __pyx_k_missing_array_dimension_value, sizeof(__pyx_k_missing_array_dimension_value), 0, 1, 0, 0},
  {&__pyx_kp_u_missing_codec_information_for_OI, __pyx_k_missing_codec_information_for_OI, sizeof(__pyx_k_missing_codec_information_for_OI), 0, 1, 0, 0},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_u_money, __pyx_k_money, sizeof(__pyx_k_money), 0, 1, 0, 1},
  {&__pyx_n_s_monotonic, __pyx_k_monotonic, sizeof(__pyx_k_monotonic), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_kp_b_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 0, 0},
  {&__pyx_kp_b_n_2, __pyx_k_n_2, sizeof(__pyx_k_n_2), 0, 0, 0, 0},
  {&__pyx_n_s_n_3, __pyx_k_n_3, sizeof(__pyx_k_n_3), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_u_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 1, 0, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1},
  {&__pyx_kp_u_no_binary_format_encoder_for_typ, __pyx_k_no_binary_format_encoder_for_typ, sizeof(__pyx_k_no_binary_format_encoder_for_typ), 0, 1, 0, 0},
  {&__pyx_kp_u_no_codec_for_composite_attribute, __pyx_k_no_codec_for_composite_attribute, sizeof(__pyx_k_no_codec_for_composite_attribute), 0, 1, 0, 0},
  {&__pyx_kp_u_no_decoder_for_OID, __pyx_k_no_decoder_for_OID, sizeof(__pyx_k_no_decoder_for_OID), 0, 1, 0, 0},
  {&__pyx_kp_u_no_decoder_for_composite_type_el, __pyx_k_no_decoder_for_composite_type_el, sizeof(__pyx_k_no_decoder_for_composite_type_el), 0, 1, 0, 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_kp_u_no_encoder_for_OID, __pyx_k_no_encoder_for_OID, sizeof(__pyx_k_no_encoder_for_OID), 0, 1, 0, 0},
  {&__pyx_kp_u_non_homogeneous_array, __pyx_k_non_homogeneous_array, sizeof(__pyx_k_non_homogeneous_array), 0, 1, 0, 0},
  {&__pyx_n_s_normalize, __pyx_k_normalize, sizeof(__pyx_k_normalize), 0, 0, 1, 1},
  {&__pyx_kp_u_not_connected, __pyx_k_not_connected, sizeof(__pyx_k_not_connected), 0, 1, 0, 0},
  {&__pyx_n_u_ns, __pyx_k_ns, sizeof(__pyx_k_ns), 0, 1, 0, 1},
  {&__pyx_kp_u_number_of_array_dimensions_excee, __pyx_k_number_of_array_dimensions_excee, sizeof(__pyx_k_number_of_array_dimensions_excee), 0, 1, 0, 0},
  {&__pyx_n_u_numeric, __pyx_k_numeric, sizeof(__pyx_k_numeric), 0, 1, 0, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_oid, __pyx_k_oid, sizeof(__pyx_k_oid), 0, 0, 1, 1},
  {&__pyx_n_u_oid, __pyx_k_oid, sizeof(__pyx_k_oid), 0, 1, 0, 1},
  {&__pyx_kp_u_oid_2, __pyx_k_oid_2, sizeof(__pyx_k_oid_2), 0, 1, 0, 0},
  {&__pyx_n_s_on_error, __pyx_k_on_error, sizeof(__pyx_k_on_error), 0, 0, 1, 1},
  {&__pyx_kp_u_on_result__prepare_statement_is, __pyx_k_on_result__prepare_statement_is, sizeof(__pyx_k_on_result__prepare_statement_is), 0, 1, 0, 0},
  {&__pyx_kp_u_on_result_waiter_is_None, __pyx_k_on_result_waiter_is_None, sizeof(__pyx_k_on_result_waiter_is_None), 0, 1, 0, 0},
  {&__pyx_kp_u_on_result_waiter_is_done, __pyx_k_on_result_waiter_is_done, sizeof(__pyx_k_on_result_waiter_is_done), 0, 1, 0, 0},
  {&__pyx_n_s_on_timeout, __pyx_k_on_timeout, sizeof(__pyx_k_on_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_on_waiter_completed, __pyx_k_on_waiter_completed, sizeof(__pyx_k_on_waiter_completed), 0, 0, 1, 1},
  {&__pyx_n_u_opaque, __pyx_k_opaque, sizeof(__pyx_k_opaque), 0, 1, 0, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_kp_b_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 0, 0},
  {&__pyx_kp_u_parse_data_msgs_first_message_i, __pyx_k_parse_data_msgs_first_message_i, sizeof(__pyx_k_parse_data_msgs_first_message_i), 0, 1, 0, 0},
  {&__pyx_kp_u_parse_data_msgs_result_is_not_a, __pyx_k_parse_data_msgs_result_is_not_a, sizeof(__pyx_k_parse_data_msgs_result_is_not_a), 0, 1, 0, 0},
  {&__pyx_n_s_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 0, 1, 1},
  {&__pyx_n_u_password_iterations, __pyx_k_password_iterations, sizeof(__pyx_k_password_iterations), 0, 1, 0, 1},
  {&__pyx_n_u_password_salt, __pyx_k_password_salt, sizeof(__pyx_k_password_salt), 0, 1, 0, 1},
  {&__pyx_n_u_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 1, 0, 1},
  {&__pyx_n_s_pause_reading, __pyx_k_pause_reading, sizeof(__pyx_k_pause_reading), 0, 0, 1, 1},
  {&__pyx_n_u_pg_catalog, __pyx_k_pg_catalog, sizeof(__pyx_k_pg_catalog), 0, 1, 0, 1},
  {&__pyx_kp_u_pg_contrib_hstore, __pyx_k_pg_contrib_hstore, sizeof(__pyx_k_pg_contrib_hstore), 0, 1, 0, 0},
  {&__pyx_n_u_pg_ddl_command, __pyx_k_pg_ddl_command, sizeof(__pyx_k_pg_ddl_command), 0, 1, 0, 1},
  {&__pyx_n_u_pg_dependencies, __pyx_k_pg_dependencies, sizeof(__pyx_k_pg_dependencies), 0, 1, 0, 1},
  {&__pyx_n_u_pg_lsn, __pyx_k_pg_lsn, sizeof(__pyx_k_pg_lsn), 0, 1, 0, 1},
  {&__pyx_n_u_pg_mcv_list, __pyx_k_pg_mcv_list, sizeof(__pyx_k_pg_mcv_list), 0, 1, 0, 1},
  {&__pyx_n_u_pg_ndistinct, __pyx_k_pg_ndistinct, sizeof(__pyx_k_pg_ndistinct), 0, 1, 0, 1},
  {&__pyx_n_u_pg_node_tree, __pyx_k_pg_node_tree, sizeof(__pyx_k_pg_node_tree), 0, 1, 0, 1},
  {&__pyx_n_u_pg_snapshot, __pyx_k_pg_snapshot, sizeof(__pyx_k_pg_snapshot), 0, 1, 0, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_u_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 1, 0, 1},
  {&__pyx_n_u_polygon, __pyx_k_polygon, sizeof(__pyx_k_polygon), 0, 1, 0, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_portal_name, __pyx_k_portal_name, sizeof(__pyx_k_portal_name), 0, 0, 1, 1},
  {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_2, __pyx_k_prepare_2, sizeof(__pyx_k_prepare_2), 0, 0, 1, 1},
  {&__pyx_n_s_process_log_message, __pyx_k_process_log_message, sizeof(__pyx_k_process_log_message), 0, 0, 1, 1},
  {&__pyx_n_s_process_notification, __pyx_k_process_notification, sizeof(__pyx_k_process_notification), 0, 0, 1, 1},
  {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1},
  {&__pyx_kp_u_protocol_is_in_an_unexpected_st, __pyx_k_protocol_is_in_an_unexpected_st, sizeof(__pyx_k_protocol_is_in_an_unexpected_st), 0, 1, 0, 0},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_BaseProtocol, __pyx_k_pyx_unpickle_BaseProtocol, sizeof(__pyx_k_pyx_unpickle_BaseProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CoreProtocol, __pyx_k_pyx_unpickle_CoreProtocol, sizeof(__pyx_k_pyx_unpickle_CoreProtocol), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_DataCodecConfig, __pyx_k_pyx_unpickle_DataCodecConfig, sizeof(__pyx_k_pyx_unpickle_DataCodecConfig), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_kp_u_query_argument, __pyx_k_query_argument, sizeof(__pyx_k_query_argument), 0, 1, 0, 0},
  {&__pyx_n_b_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 0, 1},
  {&__pyx_kp_b_r_2, __pyx_k_r_2, sizeof(__pyx_k_r_2), 0, 0, 0, 0},
  {&__pyx_kp_b_r_3, __pyx_k_r_3, sizeof(__pyx_k_r_3), 0, 0, 0, 0},
  {&__pyx_kp_u_r_is_not_a_valid_element_of_com, __pyx_k_r_is_not_a_valid_element_of_com, sizeof(__pyx_k_r_is_not_a_valid_element_of_com), 0, 1, 0, 0},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_u_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 1, 0, 1},
  {&__pyx_n_u_range_subtype, __pyx_k_range_subtype, sizeof(__pyx_k_range_subtype), 0, 1, 0, 1},
  {&__pyx_n_u_range_subtype_name, __pyx_k_range_subtype_name, sizeof(__pyx_k_range_subtype_name), 0, 1, 0, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1},
  {&__pyx_kp_u_reader_is_not_an_asynchronous_it, __pyx_k_reader_is_not_an_asynchronous_it, sizeof(__pyx_k_reader_is_not_an_asynchronous_it), 0, 1, 0, 0},
  {&__pyx_n_u_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 1, 0, 1},
  {&__pyx_n_s_rec, __pyx_k_rec, sizeof(__pyx_k_rec), 0, 0, 1, 1},
  {&__pyx_n_u_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 1, 0, 1},
  {&__pyx_n_s_record_class, __pyx_k_record_class, sizeof(__pyx_k_record_class), 0, 0, 1, 1},
  {&__pyx_n_s_record_stmt, __pyx_k_record_stmt, sizeof(__pyx_k_record_stmt), 0, 0, 1, 1},
  {&__pyx_n_s_records, __pyx_k_records, sizeof(__pyx_k_records), 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_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_u_refcursor, __pyx_k_refcursor, sizeof(__pyx_k_refcursor), 0, 1, 0, 1},
  {&__pyx_n_u_regclass, __pyx_k_regclass, sizeof(__pyx_k_regclass), 0, 1, 0, 1},
  {&__pyx_n_u_regcollation, __pyx_k_regcollation, sizeof(__pyx_k_regcollation), 0, 1, 0, 1},
  {&__pyx_n_u_regconfig, __pyx_k_regconfig, sizeof(__pyx_k_regconfig), 0, 1, 0, 1},
  {&__pyx_n_u_regdictionary, __pyx_k_regdictionary, sizeof(__pyx_k_regdictionary), 0, 1, 0, 1},
  {&__pyx_n_u_regnamespace, __pyx_k_regnamespace, sizeof(__pyx_k_regnamespace), 0, 1, 0, 1},
  {&__pyx_n_u_regoper, __pyx_k_regoper, sizeof(__pyx_k_regoper), 0, 1, 0, 1},
  {&__pyx_n_u_regoperator, __pyx_k_regoperator, sizeof(__pyx_k_regoperator), 0, 1, 0, 1},
  {&__pyx_n_u_regproc, __pyx_k_regproc, sizeof(__pyx_k_regproc), 0, 1, 0, 1},
  {&__pyx_n_u_regprocedure, __pyx_k_regprocedure, sizeof(__pyx_k_regprocedure), 0, 1, 0, 1},
  {&__pyx_n_u_regrole, __pyx_k_regrole, sizeof(__pyx_k_regrole), 0, 1, 0, 1},
  {&__pyx_n_u_regtype, __pyx_k_regtype, sizeof(__pyx_k_regtype), 0, 1, 0, 1},
  {&__pyx_n_s_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
  {&__pyx_n_u_reltime, __pyx_k_reltime, sizeof(__pyx_k_reltime), 0, 1, 0, 1},
  {&__pyx_n_s_remove_python_codec, __pyx_k_remove_python_codec, sizeof(__pyx_k_remove_python_codec), 0, 0, 1, 1},
  {&__pyx_n_s_request_cancel, __pyx_k_request_cancel, sizeof(__pyx_k_request_cancel), 0, 0, 1, 1},
  {&__pyx_n_s_resume_reading, __pyx_k_resume_reading, sizeof(__pyx_k_resume_reading), 0, 0, 1, 1},
  {&__pyx_n_s_return_extra, __pyx_k_return_extra, sizeof(__pyx_k_return_extra), 0, 0, 1, 1},
  {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
  {&__pyx_kp_b_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 0, 0},
  {&__pyx_n_s_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 0, 1, 1},
  {&__pyx_n_u_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 1, 0, 1},
  {&__pyx_n_u_scalar, __pyx_k_scalar, sizeof(__pyx_k_scalar), 0, 1, 0, 1},
  {&__pyx_n_s_schema, __pyx_k_schema, sizeof(__pyx_k_schema), 0, 0, 1, 1},
  {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
  {&__pyx_n_s_secrets, __pyx_k_secrets, sizeof(__pyx_k_secrets), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_u_server_first_message, __pyx_k_server_first_message, sizeof(__pyx_k_server_first_message), 0, 1, 0, 1},
  {&__pyx_n_u_server_nonce, __pyx_k_server_nonce, sizeof(__pyx_k_server_nonce), 0, 1, 0, 1},
  {&__pyx_n_s_server_settings, __pyx_k_server_settings, sizeof(__pyx_k_server_settings), 0, 0, 1, 1},
  {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 0, 0, 1, 1},
  {&__pyx_n_s_set_builtin_type_codec, __pyx_k_set_builtin_type_codec, sizeof(__pyx_k_set_builtin_type_codec), 0, 0, 1, 1},
  {&__pyx_n_s_set_builtin_type_codec_2, __pyx_k_set_builtin_type_codec_2, sizeof(__pyx_k_set_builtin_type_codec_2), 0, 0, 1, 1},
  {&__pyx_n_s_set_exception, __pyx_k_set_exception, sizeof(__pyx_k_set_exception), 0, 0, 1, 1},
  {&__pyx_n_s_set_result, __pyx_k_set_result, sizeof(__pyx_k_set_result), 0, 0, 1, 1},
  {&__pyx_n_s_setsockopt, __pyx_k_setsockopt, sizeof(__pyx_k_setsockopt), 0, 0, 1, 1},
  {&__pyx_n_s_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_sha256, __pyx_k_sha256, sizeof(__pyx_k_sha256), 0, 0, 1, 1},
  {&__pyx_n_u_shift_jis, __pyx_k_shift_jis, sizeof(__pyx_k_shift_jis), 0, 1, 0, 1},
  {&__pyx_n_u_shift_jis_2004, __pyx_k_shift_jis_2004, sizeof(__pyx_k_shift_jis_2004), 0, 1, 0, 1},
  {&__pyx_n_s_sink, __pyx_k_sink, sizeof(__pyx_k_sink), 0, 0, 1, 1},
  {&__pyx_n_u_sjis, __pyx_k_sjis, sizeof(__pyx_k_sjis), 0, 1, 0, 1},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_u_smallint, __pyx_k_smallint, sizeof(__pyx_k_smallint), 0, 1, 0, 1},
  {&__pyx_n_u_smgr, __pyx_k_smgr, sizeof(__pyx_k_smgr), 0, 1, 0, 1},
  {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1},
  {&__pyx_n_u_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 1, 0, 1},
  {&__pyx_kp_u_specified_array_dimensions_do_no, __pyx_k_specified_array_dimensions_do_no, sizeof(__pyx_k_specified_array_dimensions_do_no), 0, 1, 0, 0},
  {&__pyx_n_u_sql_ascii, __pyx_k_sql_ascii, sizeof(__pyx_k_sql_ascii), 0, 1, 0, 1},
  {&__pyx_n_s_started, __pyx_k_started, sizeof(__pyx_k_started), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
  {&__pyx_n_s_stmt_name, __pyx_k_stmt_name, sizeof(__pyx_k_stmt_name), 0, 0, 1, 1},
  {&__pyx_n_s_stringprep, __pyx_k_stringprep, sizeof(__pyx_k_stringprep), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_u_table_am_handler, __pyx_k_table_am_handler, sizeof(__pyx_k_table_am_handler), 0, 1, 0, 1},
  {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
  {&__pyx_n_u_tcvn, __pyx_k_tcvn, sizeof(__pyx_k_tcvn), 0, 1, 0, 1},
  {&__pyx_n_u_tcvn5712, __pyx_k_tcvn5712, sizeof(__pyx_k_tcvn5712), 0, 1, 0, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_u_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 1, 0, 1},
  {&__pyx_kp_u_text_2, __pyx_k_text_2, sizeof(__pyx_k_text_2), 0, 1, 0, 0},
  {&__pyx_kp_u_text_binary_or_tuple, __pyx_k_text_binary_or_tuple, sizeof(__pyx_k_text_binary_or_tuple), 0, 1, 0, 0},
  {&__pyx_kp_u_text_or_binary, __pyx_k_text_or_binary, sizeof(__pyx_k_text_or_binary), 0, 1, 0, 0},
  {&__pyx_kp_u_text_or_binary_2, __pyx_k_text_or_binary_2, sizeof(__pyx_k_text_or_binary_2), 0, 1, 0, 0},
  {&__pyx_kp_u_the_number_of_columns_in_the_res, __pyx_k_the_number_of_columns_in_the_res, sizeof(__pyx_k_the_number_of_columns_in_the_res), 0, 1, 0, 0},
  {&__pyx_kp_u_the_number_of_query_arguments_ca, __pyx_k_the_number_of_query_arguments_ca, sizeof(__pyx_k_the_number_of_query_arguments_ca), 0, 1, 0, 0},
  {&__pyx_kp_u_the_server_expects_x_argument_s, __pyx_k_the_server_expects_x_argument_s, sizeof(__pyx_k_the_server_expects_x_argument_s), 0, 1, 0, 0},
  {&__pyx_kp_u_there_is_no, __pyx_k_there_is_no, sizeof(__pyx_k_there_is_no), 0, 1, 0, 0},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_u_tid, __pyx_k_tid, sizeof(__pyx_k_tid), 0, 1, 0, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_u_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 1, 0, 1},
  {&__pyx_kp_u_time_with_timezone, __pyx_k_time_with_timezone, sizeof(__pyx_k_time_with_timezone), 0, 1, 0, 0},
  {&__pyx_kp_u_time_without_timezone, __pyx_k_time_without_timezone, sizeof(__pyx_k_time_without_timezone), 0, 1, 0, 0},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_n_u_timestamp, __pyx_k_timestamp, sizeof(__pyx_k_timestamp), 0, 1, 0, 1},
  {&__pyx_kp_u_timestamp_with_timezone, __pyx_k_timestamp_with_timezone, sizeof(__pyx_k_timestamp_with_timezone), 0, 1, 0, 0},
  {&__pyx_kp_u_timestamp_without_timezone, __pyx_k_timestamp_without_timezone, sizeof(__pyx_k_timestamp_without_timezone), 0, 1, 0, 0},
  {&__pyx_n_u_timestamptz, __pyx_k_timestamptz, sizeof(__pyx_k_timestamptz), 0, 1, 0, 1},
  {&__pyx_n_u_timetz, __pyx_k_timetz, sizeof(__pyx_k_timetz), 0, 1, 0, 1},
  {&__pyx_n_u_tinterval, __pyx_k_tinterval, sizeof(__pyx_k_tinterval), 0, 1, 0, 1},
  {&__pyx_kp_u_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 1, 0, 0},
  {&__pyx_n_s_to_bytes, __pyx_k_to_bytes, sizeof(__pyx_k_to_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_token_bytes, __pyx_k_token_bytes, sizeof(__pyx_k_token_bytes), 0, 0, 1, 1},
  {&__pyx_kp_u_too_many_elements_in_array_value, __pyx_k_too_many_elements_in_array_value, sizeof(__pyx_k_too_many_elements_in_array_value), 0, 1, 0, 0},
  {&__pyx_kp_u_too_many_elements_in_composite_t, __pyx_k_too_many_elements_in_composite_t, sizeof(__pyx_k_too_many_elements_in_composite_t), 0, 1, 0, 0},
  {&__pyx_n_u_trigger, __pyx_k_trigger, sizeof(__pyx_k_trigger), 0, 1, 0, 1},
  {&__pyx_n_u_tsm_handler, __pyx_k_tsm_handler, sizeof(__pyx_k_tsm_handler), 0, 1, 0, 1},
  {&__pyx_n_u_tsquery, __pyx_k_tsquery, sizeof(__pyx_k_tsquery), 0, 1, 0, 1},
  {&__pyx_n_u_tsvector, __pyx_k_tsvector, sizeof(__pyx_k_tsvector), 0, 1, 0, 1},
  {&__pyx_n_u_tuple, __pyx_k_tuple, sizeof(__pyx_k_tuple), 0, 1, 0, 1},
  {&__pyx_n_u_txid_snapshot, __pyx_k_txid_snapshot, sizeof(__pyx_k_txid_snapshot), 0, 1, 0, 1},
  {&__pyx_kp_u_type_does_not_support_the_tuple, __pyx_k_type_does_not_support_the_tuple, sizeof(__pyx_k_type_does_not_support_the_tuple), 0, 1, 0, 0},
  {&__pyx_kp_u_type_record_missing_base_type_fo, __pyx_k_type_record_missing_base_type_fo, sizeof(__pyx_k_type_record_missing_base_type_fo), 0, 1, 0, 0},
  {&__pyx_kp_u_type_record_missing_base_type_fo_2, __pyx_k_type_record_missing_base_type_fo_2, sizeof(__pyx_k_type_record_missing_base_type_fo_2), 0, 1, 0, 0},
  {&__pyx_kp_u_type_record_missing_field_types, __pyx_k_type_record_missing_field_types, sizeof(__pyx_k_type_record_missing_field_types), 0, 1, 0, 0},
  {&__pyx_n_s_typekind, __pyx_k_typekind, sizeof(__pyx_k_typekind), 0, 0, 1, 1},
  {&__pyx_n_s_typename, __pyx_k_typename, sizeof(__pyx_k_typename), 0, 0, 1, 1},
  {&__pyx_n_s_typeoid, __pyx_k_typeoid, sizeof(__pyx_k_typeoid), 0, 0, 1, 1},
  {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1},
  {&__pyx_n_s_typeschema, __pyx_k_typeschema, sizeof(__pyx_k_typeschema), 0, 0, 1, 1},
  {&__pyx_kp_u_unexpected_array_dimension_size, __pyx_k_unexpected_array_dimension_size, sizeof(__pyx_k_unexpected_array_dimension_size), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_array_dimensions_valu, __pyx_k_unexpected_array_dimensions_valu, sizeof(__pyx_k_unexpected_array_dimensions_valu), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_character_r_at_positi, __pyx_k_unexpected_character_r_at_positi, sizeof(__pyx_k_unexpected_character_r_at_positi), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_codec_type, __pyx_k_unexpected_codec_type, sizeof(__pyx_k_unexpected_codec_type), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_data_format, __pyx_k_unexpected_data_format, sizeof(__pyx_k_unexpected_data_format), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_data_type_of_composit, __pyx_k_unexpected_data_type_of_composit, sizeof(__pyx_k_unexpected_data_type_of_composit), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_end_of_string, __pyx_k_unexpected_end_of_string, sizeof(__pyx_k_unexpected_end_of_string), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_exchange_format, __pyx_k_unexpected_exchange_format, sizeof(__pyx_k_unexpected_exchange_format), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_instance_of_anyarray, __pyx_k_unexpected_instance_of_anyarray, sizeof(__pyx_k_unexpected_instance_of_anyarray), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_number_of_attributes, __pyx_k_unexpected_number_of_attributes, sizeof(__pyx_k_unexpected_number_of_attributes), 0, 1, 0, 0},
  {&__pyx_kp_u_unexpected_trailing_bytes_in_buf, __pyx_k_unexpected_trailing_bytes_in_buf, sizeof(__pyx_k_unexpected_trailing_bytes_in_buf), 0, 1, 0, 0},
  {&__pyx_kp_u_unhandled_standard_data_type, __pyx_k_unhandled_standard_data_type, sizeof(__pyx_k_unhandled_standard_data_type), 0, 1, 0, 0},
  {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1},
  {&__pyx_n_s_unicodedata, __pyx_k_unicodedata, sizeof(__pyx_k_unicodedata), 0, 0, 1, 1},
  {&__pyx_n_u_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 1, 0, 1},
  {&__pyx_kp_u_unknown_error_in_protocol_implem, __pyx_k_unknown_error_in_protocol_implem, sizeof(__pyx_k_unknown_error_in_protocol_implem), 0, 1, 0, 0},
  {&__pyx_kp_u_unsupported_SASL_Authentication, __pyx_k_unsupported_SASL_Authentication, sizeof(__pyx_k_unsupported_SASL_Authentication), 0, 1, 0, 0},
  {&__pyx_kp_u_unsupported_authentication_metho, __pyx_k_unsupported_authentication_metho, sizeof(__pyx_k_unsupported_authentication_metho), 0, 1, 0, 0},
  {&__pyx_kp_u_unsupported_authentication_metho_2, __pyx_k_unsupported_authentication_metho_2, sizeof(__pyx_k_unsupported_authentication_metho_2), 0, 1, 0, 0},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_upper_inc, __pyx_k_upper_inc, sizeof(__pyx_k_upper_inc), 0, 0, 1, 1},
  {&__pyx_n_s_urandom, __pyx_k_urandom, sizeof(__pyx_k_urandom), 0, 0, 1, 1},
  {&__pyx_n_s_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 0, 1, 1},
  {&__pyx_n_u_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 1, 0, 1},
  {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
  {&__pyx_n_u_utf_8_2, __pyx_k_utf_8_2, sizeof(__pyx_k_utf_8_2), 0, 1, 0, 1},
  {&__pyx_n_u_uuid, __pyx_k_uuid, sizeof(__pyx_k_uuid), 0, 1, 0, 1},
  {&__pyx_kp_b_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 0, 0},
  {&__pyx_n_s_v_2, __pyx_k_v_2, sizeof(__pyx_k_v_2), 0, 0, 1, 1},
  {&__pyx_n_u_varbit, __pyx_k_varbit, sizeof(__pyx_k_varbit), 0, 1, 0, 1},
  {&__pyx_n_u_varchar, __pyx_k_varchar, sizeof(__pyx_k_varchar), 0, 1, 0, 1},
  {&__pyx_n_u_void, __pyx_k_void, sizeof(__pyx_k_void), 0, 1, 0, 1},
  {&__pyx_n_u_vscii, __pyx_k_vscii, sizeof(__pyx_k_vscii), 0, 1, 0, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_wait, __pyx_k_wait, sizeof(__pyx_k_wait), 0, 0, 1, 1},
  {&__pyx_n_s_wait_for, __pyx_k_wait_for, sizeof(__pyx_k_wait_for), 0, 0, 1, 1},
  {&__pyx_n_s_wait_for_cancellation, __pyx_k_wait_for_cancellation, sizeof(__pyx_k_wait_for_cancellation), 0, 0, 1, 1},
  {&__pyx_kp_u_waiter_is_not_done_while_handlin, __pyx_k_waiter_is_not_done_while_handlin, sizeof(__pyx_k_waiter_is_not_done_while_handlin), 0, 1, 0, 0},
  {&__pyx_n_u_was, __pyx_k_was, sizeof(__pyx_k_was), 0, 1, 0, 1},
  {&__pyx_n_s_weakref, __pyx_k_weakref, sizeof(__pyx_k_weakref), 0, 0, 1, 1},
  {&__pyx_n_u_were, __pyx_k_were, sizeof(__pyx_k_were), 0, 1, 0, 1},
  {&__pyx_n_u_win, __pyx_k_win, sizeof(__pyx_k_win), 0, 1, 0, 1},
  {&__pyx_n_u_win1250, __pyx_k_win1250, sizeof(__pyx_k_win1250), 0, 1, 0, 1},
  {&__pyx_n_u_win1251, __pyx_k_win1251, sizeof(__pyx_k_win1251), 0, 1, 0, 1},
  {&__pyx_n_u_win1252, __pyx_k_win1252, sizeof(__pyx_k_win1252), 0, 1, 0, 1},
  {&__pyx_n_u_win1253, __pyx_k_win1253, sizeof(__pyx_k_win1253), 0, 1, 0, 1},
  {&__pyx_n_u_win1254, __pyx_k_win1254, sizeof(__pyx_k_win1254), 0, 1, 0, 1},
  {&__pyx_n_u_win1255, __pyx_k_win1255, sizeof(__pyx_k_win1255), 0, 1, 0, 1},
  {&__pyx_n_u_win1256, __pyx_k_win1256, sizeof(__pyx_k_win1256), 0, 1, 0, 1},
  {&__pyx_n_u_win1257, __pyx_k_win1257, sizeof(__pyx_k_win1257), 0, 1, 0, 1},
  {&__pyx_n_u_win1258, __pyx_k_win1258, sizeof(__pyx_k_win1258), 0, 1, 0, 1},
  {&__pyx_n_u_win866, __pyx_k_win866, sizeof(__pyx_k_win866), 0, 1, 0, 1},
  {&__pyx_n_u_win874, __pyx_k_win874, sizeof(__pyx_k_win874), 0, 1, 0, 1},
  {&__pyx_n_u_win932, __pyx_k_win932, sizeof(__pyx_k_win932), 0, 1, 0, 1},
  {&__pyx_n_u_win936, __pyx_k_win936, sizeof(__pyx_k_win936), 0, 1, 0, 1},
  {&__pyx_n_u_win949, __pyx_k_win949, sizeof(__pyx_k_win949), 0, 1, 0, 1},
  {&__pyx_n_u_win950, __pyx_k_win950, sizeof(__pyx_k_win950), 0, 1, 0, 1},
  {&__pyx_n_u_windows1250, __pyx_k_windows1250, sizeof(__pyx_k_windows1250), 0, 1, 0, 1},
  {&__pyx_n_u_windows1251, __pyx_k_windows1251, sizeof(__pyx_k_windows1251), 0, 1, 0, 1},
  {&__pyx_n_u_windows1252, __pyx_k_windows1252, sizeof(__pyx_k_windows1252), 0, 1, 0, 1},
  {&__pyx_n_u_windows1253, __pyx_k_windows1253, sizeof(__pyx_k_windows1253), 0, 1, 0, 1},
  {&__pyx_n_u_windows1254, __pyx_k_windows1254, sizeof(__pyx_k_windows1254), 0, 1, 0, 1},
  {&__pyx_n_u_windows1255, __pyx_k_windows1255, sizeof(__pyx_k_windows1255), 0, 1, 0, 1},
  {&__pyx_n_u_windows1256, __pyx_k_windows1256, sizeof(__pyx_k_windows1256), 0, 1, 0, 1},
  {&__pyx_n_u_windows1257, __pyx_k_windows1257, sizeof(__pyx_k_windows1257), 0, 1, 0, 1},
  {&__pyx_n_u_windows1258, __pyx_k_windows1258, sizeof(__pyx_k_windows1258), 0, 1, 0, 1},
  {&__pyx_n_u_windows866, __pyx_k_windows866, sizeof(__pyx_k_windows866), 0, 1, 0, 1},
  {&__pyx_n_u_windows874, __pyx_k_windows874, sizeof(__pyx_k_windows874), 0, 1, 0, 1},
  {&__pyx_n_u_windows932, __pyx_k_windows932, sizeof(__pyx_k_windows932), 0, 1, 0, 1},
  {&__pyx_n_u_windows936, __pyx_k_windows936, sizeof(__pyx_k_windows936), 0, 1, 0, 1},
  {&__pyx_n_u_windows949, __pyx_k_windows949, sizeof(__pyx_k_windows949), 0, 1, 0, 1},
  {&__pyx_n_u_windows950, __pyx_k_windows950, sizeof(__pyx_k_windows950), 0, 1, 0, 1},
  {&__pyx_n_s_with_msg, __pyx_k_with_msg, sizeof(__pyx_k_with_msg), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_writelines, __pyx_k_writelines, sizeof(__pyx_k_writelines), 0, 0, 1, 1},
  {&__pyx_n_s_writing_allowed, __pyx_k_writing_allowed, sizeof(__pyx_k_writing_allowed), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xformat, __pyx_k_xformat, sizeof(__pyx_k_xformat), 0, 0, 1, 1},
  {&__pyx_n_u_xid, __pyx_k_xid, sizeof(__pyx_k_xid), 0, 1, 0, 1},
  {&__pyx_n_u_xid8, __pyx_k_xid8, sizeof(__pyx_k_xid8), 0, 1, 0, 1},
  {&__pyx_n_u_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 1, 0, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_kp_u_you_need_values_from_server_to_g, __pyx_k_you_need_values_from_server_to_g, sizeof(__pyx_k_you_need_values_from_server_to_g), 0, 1, 0, 0},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 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, 21, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(1, 72, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(2, 98, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(2, 99, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(3, 2, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(4, 140, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(4, 148, __pyx_L1_error)
  __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(4, 414, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(4, 495, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(5, 379, __pyx_L1_error)
  __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 139, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 161, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_builtin_UnicodeEncodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeEncodeError); if (!__pyx_builtin_UnicodeEncodeError) __PYX_ERR(0, 283, __pyx_L1_error)
  __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(6, 135, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(6, 948, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(6, 1099, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(7, 156, __pyx_L1_error)
  __pyx_builtin_BufferError = __Pyx_GetBuiltinName(__pyx_n_s_BufferError); if (!__pyx_builtin_BufferError) __PYX_ERR(7, 297, __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__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "(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__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "asyncpg/protocol/codecs/base.pyx":160
 *         count = len(obj)
 *         if count > _MAXINT32:
 *             raise ValueError('too many elements in composite type record')             # <<<<<<<<<<<<<<
 * 
 *         elem_data = WriteBuffer.new()
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_too_many_elements_in_composite_t); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(4, 160, __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__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "(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__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "asyncpg/protocol/codecs/base.pyx":461
 *                 # Canonicalize type name to "elemtype[]"
 *                 if name.startswith('_'):
 *                     name = name[1:]             # <<<<<<<<<<<<<<
 *                 name = '{}[]'.format(name)
 * 
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(4, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "asyncpg/protocol/codecs/base.pyx":802
 *     kind = 'scalar'
 * 
 *     codec = Codec(INVALIDOID)             # <<<<<<<<<<<<<<
 *     codec.init(name, None, kind, CODEC_C, format, PG_XFORMAT_OBJECT,
 *                encode, decode, None, None, None, None, None, None, 0)
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(4, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "asyncpg/protocol/codecs/array.pyx":59
 * 
 *     if mylen > _MAXINT32:
 *         raise ValueError('too many elements in array value')             # <<<<<<<<<<<<<<
 * 
 *     if ndims[0] > ARRAY_MAXDIM:
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_too_many_elements_in_array_value); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(5, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "asyncpg/protocol/codecs/array.pyx":78
 *             else:
 *                 if len(elem) != elemlen:
 *                     raise ValueError('non-homogeneous array')             # <<<<<<<<<<<<<<
 *         else:
 *             if elemlen >= 0:
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_non_homogeneous_array); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(5, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "asyncpg/protocol/codecs/array.pyx":492
 *         ptr = apg_parse_int32(ptr, &ubound)
 *         if ptr == NULL:
 *             raise ValueError('missing array dimension value')             # <<<<<<<<<<<<<<
 * 
 *         if ptr[0] == ':':
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_missing_array_dimension_value); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(5, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "asyncpg/protocol/codecs/array.pyx":506
 * 
 *         if ptr[0] != ']':
 *             raise ValueError('missing \']\' after array dimensions')             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1  # ']'
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_missing_after_array_dimensions); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(5, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "asyncpg/protocol/codecs/array.pyx":516
 *         # If dimensions were given, the '=' token is expected.
 *         if ptr[0] != '=':
 *             raise ValueError('missing \'=\' after array dimensions')             # <<<<<<<<<<<<<<
 * 
 *         ptr += 1  # '='
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_missing_after_array_dimensions_2); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(5, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "asyncpg/protocol/codecs/array.pyx":531
 * 
 *         if inferred_ndims != ndims:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'specified array dimensions do not match array content')
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_specified_array_dimensions_do_no); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(5, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "asyncpg/protocol/codecs/array.pyx":708
 *         while not end_of_item:
 *             if ptr[0] == '\0':
 *                 raise ValueError('unexpected end of string')             # <<<<<<<<<<<<<<
 * 
 *             elif ptr[0] == '"':
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_unexpected_end_of_string); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(5, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "asyncpg/protocol/codecs/record.pyx":55
 * 
 * cdef anonymous_record_encode(ConnectionSettings settings, WriteBuffer buf, obj):
 *     raise exceptions.UnsupportedClientFeatureError(             # <<<<<<<<<<<<<<
 *         'input of anonymous composite types is not supported',
 *         hint=(
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_input_of_anonymous_composite_typ); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(11, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "asyncpg/protocol/scram.pyx":130
 *         client_first_message = self.client_channel_binding + \
 *             self.client_first_message_bare
 *         msg += (len(client_first_message)).to_bytes(4, byteorder='big') + \             # <<<<<<<<<<<<<<
 *             client_first_message
 *         return msg
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "asyncpg/protocol/scram.pyx":141
 *         if any([getattr(self, val) is None for val in
 *                 self.REQUIREMENTS_CLIENT_FINAL_MESSAGE]):
 *             raise Exception(             # <<<<<<<<<<<<<<
 *                 "you need values from server to generate a client proof")
 * 
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_u_you_need_values_from_server_to_g); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "asyncpg/protocol/scram.pyx":162
 *                 self.server_first_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get nonce")             # <<<<<<<<<<<<<<
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_u_could_not_get_nonce); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "asyncpg/protocol/scram.pyx":164
 *             raise Exception("could not get nonce")
 *         if not self.server_nonce.startswith(self.client_nonce):
 *             raise Exception("invalid nonce")             # <<<<<<<<<<<<<<
 *         try:
 *             self.password_salt = re.search(b's=([^,]+),',
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_invalid_nonce); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "asyncpg/protocol/scram.pyx":169
 *                 self.server_first_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get salt")             # <<<<<<<<<<<<<<
 *         try:
 *             self.password_iterations = int(re.search(b'i=(\d+),?',
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_could_not_get_salt); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "asyncpg/protocol/scram.pyx":174
 *                 self.server_first_message).group(1))
 *         except (IndexError, TypeError, ValueError):
 *             raise Exception("could not get iterations")             # <<<<<<<<<<<<<<
 * 
 *     cdef verify_server_final_message(self, bytes server_final_message):
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_could_not_get_iterations); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "asyncpg/protocol/scram.pyx":185
 *                 server_final_message).group(1)
 *         except IndexError:
 *             raise Exception("could not get server signature")             # <<<<<<<<<<<<<<
 * 
 *         verify_server_signature = hmac.new(self.server_key.digest(),
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_could_not_get_server_signature); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "(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__38 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "(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__39 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "asyncpg/protocol/prepared_stmt.pyx":169
 *                     value_repr = repr(arg)
 *                     if len(value_repr) > 40:
 *                         value_repr = value_repr[:40] + '...'             # <<<<<<<<<<<<<<
 * 
 *                     raise exceptions.DataError(
 */
  __pyx_slice__44 = PySlice_New(Py_None, __pyx_int_40, Py_None); if (unlikely(!__pyx_slice__44)) __PYX_ERR(7, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__44);
  __Pyx_GIVEREF(__pyx_slice__44);

  /* "(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__46 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(3, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "(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__47 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "asyncpg/protocol/protocol.pyx":236
 * 
 *             while more:
 *                 with timer:             # <<<<<<<<<<<<<<
 *                     await asyncio.wait_for(
 *                         self.writing_allowed.wait(),
 */
  __pyx_tuple__48 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "asyncpg/protocol/protocol.pyx":488
 *                     aiter = reader.__aiter__
 *                 except AttributeError:
 *                     raise TypeError('reader is not an asynchronous iterable')             # <<<<<<<<<<<<<<
 *                 else:
 *                     iterator = aiter()
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_reader_is_not_an_asynchronous_it); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "asyncpg/protocol/pgtypes.pxi":112
 * DEF ANYCOMPATIBLERANGEOID = 5080
 * 
 * cdef ARRAY_TYPES = (_TEXTOID, _OIDOID,)             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_OID_MAP = {
 */
  __pyx_tuple__50 = PyTuple_Pack(2, __pyx_int_1009, __pyx_int_1028); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(21, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "asyncpg/protocol/protocol.pyx":979
 * 
 * class Timer:
 *     def __init__(self, budget):             # <<<<<<<<<<<<<<
 *         self._budget = budget
 *         self._started = 0
 */
  __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_budget); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(1, 979, __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_asyncpg_protocol_protocol_pyx, __pyx_n_s_init, 979, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(1, 979, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":983
 *         self._started = 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._started = time.monotonic()
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 983, __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_asyncpg_protocol_protocol_pyx, __pyx_n_s_enter, 983, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(1, 983, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":987
 *             self._started = time.monotonic()
 * 
 *     def __exit__(self, et, e, tb):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._budget -= time.monotonic() - self._started
 */
  __pyx_tuple__55 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_et, __pyx_n_s_e, __pyx_n_s_tb); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_asyncpg_protocol_protocol_pyx, __pyx_n_s_exit, 987, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 987, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":991
 *             self._budget -= time.monotonic() - self._started
 * 
 *     def get_remaining_budget(self):             # <<<<<<<<<<<<<<
 *         return self._budget
 * 
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_asyncpg_protocol_protocol_pyx, __pyx_n_s_get_remaining_budget, 991, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 991, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":994
 *         return self._budget
 * 
 *     def has_budget_greater_than(self, amount):             # <<<<<<<<<<<<<<
 *         if self._budget is None:
 *             # Unlimited budget.
 */
  __pyx_tuple__59 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_amount); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_asyncpg_protocol_protocol_pyx, __pyx_n_s_has_budget_greater_than, 994, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 994, __pyx_L1_error)

  /* "asyncpg/protocol/protocol.pyx":1006
 * 
 * 
 * def _create_record(object mapping, tuple elems):             # <<<<<<<<<<<<<<
 *     # Exposed only for testing purposes.
 * 
 */
  __pyx_tuple__61 = PyTuple_Pack(6, __pyx_n_s_mapping, __pyx_n_s_elems, __pyx_n_s_rec, __pyx_n_s_i, __pyx_n_s_desc, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_asyncpg_protocol_protocol_pyx, __pyx_n_s_create_record, 1006, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 1006, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_DataCodecConfig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__63 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_DataCodecConfig, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_tuple__65 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_CoreProtocol, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_tuple__67 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_BaseProtocol, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_21 = PyInt_FromLong(21); if (unlikely(!__pyx_int_21)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_23 = PyInt_FromLong(23); if (unlikely(!__pyx_int_23)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_25 = PyInt_FromLong(25); if (unlikely(!__pyx_int_25)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_26 = PyInt_FromLong(26); if (unlikely(!__pyx_int_26)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_27 = PyInt_FromLong(27); if (unlikely(!__pyx_int_27)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_28 = PyInt_FromLong(28); if (unlikely(!__pyx_int_28)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_29 = PyInt_FromLong(29); if (unlikely(!__pyx_int_29)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_114 = PyInt_FromLong(114); if (unlikely(!__pyx_int_114)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_142 = PyInt_FromLong(142); if (unlikely(!__pyx_int_142)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_194 = PyInt_FromLong(194); if (unlikely(!__pyx_int_194)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_210 = PyInt_FromLong(210); if (unlikely(!__pyx_int_210)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_269 = PyInt_FromLong(269); if (unlikely(!__pyx_int_269)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_325 = PyInt_FromLong(325); if (unlikely(!__pyx_int_325)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_600 = PyInt_FromLong(600); if (unlikely(!__pyx_int_600)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_601 = PyInt_FromLong(601); if (unlikely(!__pyx_int_601)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_602 = PyInt_FromLong(602); if (unlikely(!__pyx_int_602)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_603 = PyInt_FromLong(603); if (unlikely(!__pyx_int_603)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_604 = PyInt_FromLong(604); if (unlikely(!__pyx_int_604)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_628 = PyInt_FromLong(628); if (unlikely(!__pyx_int_628)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_650 = PyInt_FromLong(650); if (unlikely(!__pyx_int_650)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_700 = PyInt_FromLong(700); if (unlikely(!__pyx_int_700)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_701 = PyInt_FromLong(701); if (unlikely(!__pyx_int_701)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_702 = PyInt_FromLong(702); if (unlikely(!__pyx_int_702)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_703 = PyInt_FromLong(703); if (unlikely(!__pyx_int_703)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_704 = PyInt_FromLong(704); if (unlikely(!__pyx_int_704)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_705 = PyInt_FromLong(705); if (unlikely(!__pyx_int_705)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_718 = PyInt_FromLong(718); if (unlikely(!__pyx_int_718)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_774 = PyInt_FromLong(774); if (unlikely(!__pyx_int_774)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_790 = PyInt_FromLong(790); if (unlikely(!__pyx_int_790)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_829 = PyInt_FromLong(829); if (unlikely(!__pyx_int_829)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_869 = PyInt_FromLong(869); if (unlikely(!__pyx_int_869)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1009 = PyInt_FromLong(1009); if (unlikely(!__pyx_int_1009)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1028 = PyInt_FromLong(1028); if (unlikely(!__pyx_int_1028)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1033 = PyInt_FromLong(1033); if (unlikely(!__pyx_int_1033)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1042 = PyInt_FromLong(1042); if (unlikely(!__pyx_int_1042)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1043 = PyInt_FromLong(1043); if (unlikely(!__pyx_int_1043)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1082 = PyInt_FromLong(1082); if (unlikely(!__pyx_int_1082)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1083 = PyInt_FromLong(1083); if (unlikely(!__pyx_int_1083)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1114 = PyInt_FromLong(1114); if (unlikely(!__pyx_int_1114)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1184 = PyInt_FromLong(1184); if (unlikely(!__pyx_int_1184)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1186 = PyInt_FromLong(1186); if (unlikely(!__pyx_int_1186)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1266 = PyInt_FromLong(1266); if (unlikely(!__pyx_int_1266)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1560 = PyInt_FromLong(1560); if (unlikely(!__pyx_int_1560)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1562 = PyInt_FromLong(1562); if (unlikely(!__pyx_int_1562)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1700 = PyInt_FromLong(1700); if (unlikely(!__pyx_int_1700)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_1790 = PyInt_FromLong(1790); if (unlikely(!__pyx_int_1790)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2202 = PyInt_FromLong(2202); if (unlikely(!__pyx_int_2202)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2203 = PyInt_FromLong(2203); if (unlikely(!__pyx_int_2203)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2204 = PyInt_FromLong(2204); if (unlikely(!__pyx_int_2204)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2205 = PyInt_FromLong(2205); if (unlikely(!__pyx_int_2205)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2206 = PyInt_FromLong(2206); if (unlikely(!__pyx_int_2206)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2249 = PyInt_FromLong(2249); if (unlikely(!__pyx_int_2249)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2275 = PyInt_FromLong(2275); if (unlikely(!__pyx_int_2275)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2276 = PyInt_FromLong(2276); if (unlikely(!__pyx_int_2276)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2277 = PyInt_FromLong(2277); if (unlikely(!__pyx_int_2277)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2278 = PyInt_FromLong(2278); if (unlikely(!__pyx_int_2278)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2279 = PyInt_FromLong(2279); if (unlikely(!__pyx_int_2279)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2280 = PyInt_FromLong(2280); if (unlikely(!__pyx_int_2280)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2281 = PyInt_FromLong(2281); if (unlikely(!__pyx_int_2281)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2282 = PyInt_FromLong(2282); if (unlikely(!__pyx_int_2282)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2283 = PyInt_FromLong(2283); if (unlikely(!__pyx_int_2283)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2776 = PyInt_FromLong(2776); if (unlikely(!__pyx_int_2776)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2950 = PyInt_FromLong(2950); if (unlikely(!__pyx_int_2950)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_2970 = PyInt_FromLong(2970); if (unlikely(!__pyx_int_2970)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3115 = PyInt_FromLong(3115); if (unlikely(!__pyx_int_3115)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3220 = PyInt_FromLong(3220); if (unlikely(!__pyx_int_3220)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3310 = PyInt_FromLong(3310); if (unlikely(!__pyx_int_3310)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3361 = PyInt_FromLong(3361); if (unlikely(!__pyx_int_3361)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3402 = PyInt_FromLong(3402); if (unlikely(!__pyx_int_3402)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3500 = PyInt_FromLong(3500); if (unlikely(!__pyx_int_3500)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3614 = PyInt_FromLong(3614); if (unlikely(!__pyx_int_3614)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3615 = PyInt_FromLong(3615); if (unlikely(!__pyx_int_3615)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3642 = PyInt_FromLong(3642); if (unlikely(!__pyx_int_3642)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3734 = PyInt_FromLong(3734); if (unlikely(!__pyx_int_3734)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3769 = PyInt_FromLong(3769); if (unlikely(!__pyx_int_3769)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3802 = PyInt_FromLong(3802); if (unlikely(!__pyx_int_3802)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3831 = PyInt_FromLong(3831); if (unlikely(!__pyx_int_3831)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_3838 = PyInt_FromLong(3838); if (unlikely(!__pyx_int_3838)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4072 = PyInt_FromLong(4072); if (unlikely(!__pyx_int_4072)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4089 = PyInt_FromLong(4089); if (unlikely(!__pyx_int_4089)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_4191 = PyInt_FromLong(4191); if (unlikely(!__pyx_int_4191)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5017 = PyInt_FromLong(5017); if (unlikely(!__pyx_int_5017)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5038 = PyInt_FromLong(5038); if (unlikely(!__pyx_int_5038)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5069 = PyInt_FromLong(5069); if (unlikely(!__pyx_int_5069)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5077 = PyInt_FromLong(5077); if (unlikely(!__pyx_int_5077)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5078 = PyInt_FromLong(5078); if (unlikely(!__pyx_int_5078)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5079 = PyInt_FromLong(5079); if (unlikely(!__pyx_int_5079)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_5080 = PyInt_FromLong(5080); if (unlikely(!__pyx_int_5080)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_32768 = PyInt_FromLong(32768L); if (unlikely(!__pyx_int_32768)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_524288 = PyInt_FromLong(524288L); if (unlikely(!__pyx_int_524288)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_61349641 = PyInt_FromLong(61349641L); if (unlikely(!__pyx_int_61349641)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_120810133 = PyInt_FromLong(120810133L); if (unlikely(!__pyx_int_120810133)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_int_263996099 = PyInt_FromLong(263996099L); if (unlikely(!__pyx_int_263996099)) __PYX_ERR(1, 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_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES = Py_None; Py_INCREF(Py_None);
  __pyx_7genexpr__pyx_v_7asyncpg_8protocol_8protocol_k = Py_None; Py_INCREF(Py_None);
  __pyx_7genexpr__pyx_v_7asyncpg_8protocol_8protocol_v = Py_None; Py_INCREF(Py_None);
  __pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_7asyncpg_8protocol_8protocol_FLUSH_MESSAGE = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k = Py_None; Py_INCREF(Py_None);
  __pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  if (__Pyx_ExportVoidPtr(__pyx_n_s_ARRAY_TYPES, (void *)&__pyx_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES, "PyObject *") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

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
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_Codec = &__pyx_vtable_7asyncpg_8protocol_8protocol_Codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.init = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, PyObject *, PyObject *, PyObject *, Py_UCS4))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_init;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_scalar = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_scalar;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_array = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_array_text = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_array_text;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_range = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_range;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_composite = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_composite;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode_in_python = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode_in_python;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_scalar = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_scalar;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_array = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_array_text = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_array_text;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_range = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_range;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_composite = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_composite;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode_in_python = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode_in_python;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.encode = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_encode;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.decode = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_decode;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.has_encoder = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_encoder;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.has_decoder = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_has_decoder;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.is_binary = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_is_binary;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.copy = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_copy;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.new_array_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *, Py_UCS4))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_array_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.new_range_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(uint32_t, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_range_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.new_composite_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(uint32_t, PyObject *, PyObject *, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, PyObject *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_composite_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_Codec.new_python_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(uint32_t, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, __pyx_t_7asyncpg_8protocol_8protocol_encode_func, __pyx_t_7asyncpg_8protocol_8protocol_decode_func, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat))__pyx_f_7asyncpg_8protocol_8protocol_5Codec_new_python_codec;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_Codec) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_Codec.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_Codec.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_Codec.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_Codec.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_Codec.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_Codec) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Codec, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_Codec) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_Codec) < 0) __PYX_ERR(4, 20, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_Codec = &__pyx_type_7asyncpg_8protocol_8protocol_Codec;
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_DataCodecConfig = &__pyx_vtable_7asyncpg_8protocol_8protocol_DataCodecConfig;
  __pyx_vtable_7asyncpg_8protocol_8protocol_DataCodecConfig.get_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec *__pyx_optional_args))__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_DataCodecConfig.get_custom_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_DataCodecConfig *, uint32_t, enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat))__pyx_f_7asyncpg_8protocol_8protocol_15DataCodecConfig_get_custom_codec;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig) < 0) __PYX_ERR(4, 423, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_DataCodecConfig) < 0) __PYX_ERR(4, 423, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DataCodecConfig, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig) < 0) __PYX_ERR(4, 423, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig) < 0) __PYX_ERR(4, 423, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_DataCodecConfig = &__pyx_type_7asyncpg_8protocol_8protocol_DataCodecConfig;
  __pyx_t_1 = PyImport_ImportModule("asyncpg.pgproto.pgproto"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext = __Pyx_ImportType(__pyx_t_1, "asyncpg.pgproto.pgproto", "CodecContext", sizeof(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_vtabptr_7asyncpg_7pgproto_7pgproto_CodecContext = (struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_CodecContext*)__Pyx_GetVtable(__pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext->tp_dict); if (unlikely(!__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_CodecContext)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_ConnectionSettings = &__pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.__pyx_base = *__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_CodecContext;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.__pyx_base.get_text_codec = (PyObject *(*)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_text_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.__pyx_base.is_encoding_utf8 = (PyObject *(*)(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_is_encoding_utf8;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.add_setting = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_setting;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.register_data_types = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_register_data_types;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.add_python_codec = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_add_python_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.remove_python_codec = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_remove_python_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.clear_type_cache = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_clear_type_cache;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.set_builtin_type_codec = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_set_builtin_type_codec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_ConnectionSettings.get_data_codec = (struct __pyx_obj_7asyncpg_8protocol_8protocol_Codec *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_ConnectionSettings *, uint32_t, int __pyx_skip_dispatch, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec *__pyx_optional_args))__pyx_f_7asyncpg_8protocol_8protocol_18ConnectionSettings_get_data_codec;
  __pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings.tp_base = __pyx_ptype_7asyncpg_7pgproto_7pgproto_CodecContext;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_ConnectionSettings) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConnectionSettings, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings) < 0) __PYX_ERR(2, 12, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_ConnectionSettings = &__pyx_type_7asyncpg_8protocol_8protocol_ConnectionSettings;
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_SCRAMAuthentication = &__pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication.create_client_first_message = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_first_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication.create_client_final_message = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_create_client_final_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication.parse_server_first_message = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_parse_server_first_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication.verify_server_final_message = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication_verify_server_final_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication._bytes_xor = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__bytes_xor;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication._generate_client_nonce = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, int))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_nonce;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication._generate_client_proof = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_client_proof;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication._generate_salted_password = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *, PyObject *, int))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__generate_salted_password;
  __pyx_vtable_7asyncpg_8protocol_8protocol_SCRAMAuthentication._normalize_password = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_SCRAMAuthentication *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_19SCRAMAuthentication__normalize_password;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_SCRAMAuthentication) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SCRAMAuthentication, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication = &__pyx_type_7asyncpg_8protocol_8protocol_SCRAMAuthentication;
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_CoreProtocol = &__pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol.is_in_transaction = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol_is_in_transaction;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__auth = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__auth;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__prepare = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__prepare;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__bind_execute = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__bind_execute_many = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind_execute_many;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__close_stmt_portal = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__close_stmt_portal;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__simple_query = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__simple_query;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__bind = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__bind;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__copy_out = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__copy_out_data = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_out_data;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__copy_in = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._process__copy_in_data = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__process__copy_in_data;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_authentication = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_authentication;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_parameter_status = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_parameter_status;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_notification = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_notification;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_backend_key_data = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_backend_key_data;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_ready_for_query = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_ready_for_query;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_data_msgs = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_data_msgs;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_copy_data_msgs = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_copy_data_msgs;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_error_response = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_error_response;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._parse_msg_command_complete = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__parse_msg_command_complete;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._write_copy_data_msg = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_data_msg;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._write_copy_done_msg = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_done_msg;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._write_copy_fail_msg = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write_copy_fail_msg;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._auth_password_message_cleartext = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_cleartext;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._auth_password_message_md5 = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_md5;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._auth_password_message_sasl_initial = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_initial;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._auth_password_message_sasl_continue = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__auth_password_message_sasl_continue;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._write = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__write;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._writelines = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__writelines;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._read_server_messages = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__read_server_messages;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._push_result = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__push_result;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._reset_result = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__reset_result;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._set_state = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_state;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._ensure_connected = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__ensure_connected;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._build_parse_message = (struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_parse_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._build_bind_message = (struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_bind_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._build_empty_bind_data = (struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_empty_bind_data;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._build_execute_message = (struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int32_t))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__build_execute_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._connect = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__connect;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._prepare = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__prepare;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._send_bind_message = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__send_bind_message;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._bind_execute = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, int32_t))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._bind_execute_many = (int (*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._bind_execute_many_more = (int (*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more *__pyx_optional_args))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_more;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._bind_execute_many_fail = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, struct __pyx_opt_args_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail *__pyx_optional_args))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind_execute_many_fail;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._bind = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__bind;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._execute = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int32_t))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__execute;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._close = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, int))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__close;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._simple_query = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__simple_query;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._copy_out = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_out;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._copy_in = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__copy_in;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._terminate = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__terminate;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._decode_row = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char const *, Py_ssize_t))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__decode_row;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._on_result = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_result;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._on_notification = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notification;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._on_notice = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_notice;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._set_server_parameter = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__set_server_parameter;
  __pyx_vtable_7asyncpg_8protocol_8protocol_CoreProtocol._on_connection_lost = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12CoreProtocol__on_connection_lost;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol) < 0) __PYX_ERR(6, 14, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_CoreProtocol) < 0) __PYX_ERR(6, 14, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoreProtocol, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol) < 0) __PYX_ERR(6, 14, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol) < 0) __PYX_ERR(6, 14, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_CoreProtocol = &__pyx_type_7asyncpg_8protocol_8protocol_CoreProtocol;
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_PreparedStatementState = &__pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._encode_bind_msg = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__encode_bind_msg;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._init_codecs = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, int __pyx_skip_dispatch))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__init_codecs;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._ensure_rows_decoder = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_rows_decoder;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._ensure_args_encoder = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__ensure_args_encoder;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._set_row_desc = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_row_desc;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._set_args_desc = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__set_args_desc;
  __pyx_vtable_7asyncpg_8protocol_8protocol_PreparedStatementState._decode_row = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_PreparedStatementState *, char const *, Py_ssize_t))__pyx_f_7asyncpg_8protocol_8protocol_22PreparedStatementState__decode_row;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState) < 0) __PYX_ERR(7, 12, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_PreparedStatementState) < 0) __PYX_ERR(7, 12, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PreparedStatementState, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState) < 0) __PYX_ERR(7, 12, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState) < 0) __PYX_ERR(7, 12, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_PreparedStatementState = &__pyx_type_7asyncpg_8protocol_8protocol_PreparedStatementState;
  __pyx_vtabptr_7asyncpg_8protocol_8protocol_BaseProtocol = &__pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base = *__pyx_vtabptr_7asyncpg_8protocol_8protocol_CoreProtocol;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._write = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__write;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._writelines = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__writelines;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._decode_row = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, char const *, Py_ssize_t))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__decode_row;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._on_result = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._on_notification = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notification;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._on_notice = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_notice;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._set_server_parameter = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__set_server_parameter;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.__pyx_base._on_connection_lost = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_CoreProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_connection_lost;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.get_connection = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_get_connection;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._get_timeout_impl = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__get_timeout_impl;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._check_state = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__check_state;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._new_waiter = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__new_waiter;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._coreproto_error = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__coreproto_error;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__connect = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__connect;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__prepare = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__prepare;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__bind_and_exec = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind_and_exec;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__close_stmt_or_portal = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__close_stmt_or_portal;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__simple_query = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__simple_query;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__bind = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__bind;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__copy_out = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_out;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._on_result__copy_in = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__on_result__copy_in;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._handle_waiter_on_connection_lost = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *, PyObject *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__handle_waiter_on_connection_lost;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol._dispatch_result = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol__dispatch_result;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.resume_reading = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_resume_reading;
  __pyx_vtable_7asyncpg_8protocol_8protocol_BaseProtocol.pause_reading = (PyObject *(*)(struct __pyx_obj_7asyncpg_8protocol_8protocol_BaseProtocol *))__pyx_f_7asyncpg_8protocol_8protocol_12BaseProtocol_pause_reading;
  __pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_base = __pyx_ptype_7asyncpg_8protocol_8protocol_CoreProtocol;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol) < 0) __PYX_ERR(1, 75, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol.tp_dict, __pyx_vtabptr_7asyncpg_8protocol_8protocol_BaseProtocol) < 0) __PYX_ERR(1, 75, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseProtocol, (PyObject *)&__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol) < 0) __PYX_ERR(1, 75, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol) < 0) __PYX_ERR(1, 75, __pyx_L1_error)
  __pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol = &__pyx_type_7asyncpg_8protocol_8protocol_BaseProtocol;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct___bytes_xor;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password) < 0) __PYX_ERR(0, 263, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_2__normalize_password;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_4_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_5_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_6_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare) < 0) __PYX_ERR(1, 142, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_7_prepare;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute) < 0) __PYX_ERR(1, 171, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_8_bind_execute;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many) < 0) __PYX_ERR(1, 204, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_9_bind_execute_many;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr) < 0) __PYX_ERR(1, 220, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_10_genexpr;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind) < 0) __PYX_ERR(1, 257, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_11_bind;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute) < 0) __PYX_ERR(1, 286, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_12_execute;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query) < 0) __PYX_ERR(1, 316, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_13_query;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out) < 0) __PYX_ERR(1, 341, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_14_copy_out;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_15_copy_in;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement) < 0) __PYX_ERR(1, 534, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_16_close_statement;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close) < 0) __PYX_ERR(1, 574, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_17_close;
  if (PyType_Ready(&__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation) < 0) __PYX_ERR(1, 717, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation.tp_dictoffset && __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation = &__pyx_type_7asyncpg_8protocol_8protocol___pyx_scope_struct_18__wait_for_cancellation;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(18, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(19, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(20, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(20, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("asyncpg.pgproto.pgproto"); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer = __Pyx_ImportType(__pyx_t_1, "asyncpg.pgproto.pgproto", "WriteBuffer", sizeof(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer) __PYX_ERR(17, 8, __pyx_L1_error)
  __pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer = (struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer*)__Pyx_GetVtable(__pyx_ptype_7asyncpg_7pgproto_7pgproto_WriteBuffer->tp_dict); if (unlikely(!__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer)) __PYX_ERR(17, 8, __pyx_L1_error)
  __pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer = __Pyx_ImportType(__pyx_t_1, "asyncpg.pgproto.pgproto", "ReadBuffer", sizeof(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_ReadBuffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer) __PYX_ERR(17, 68, __pyx_L1_error)
  __pyx_vtabptr_7asyncpg_7pgproto_7pgproto_ReadBuffer = (struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_ReadBuffer*)__Pyx_GetVtable(__pyx_ptype_7asyncpg_7pgproto_7pgproto_ReadBuffer->tp_dict); if (unlikely(!__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_ReadBuffer)) __PYX_ERR(17, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

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
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("asyncpg.pgproto.pgproto"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "frb_check", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_frb_check, "PyObject *(struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *, Py_ssize_t)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "date_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "date_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "date_encode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_date_encode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "date_decode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_date_decode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamp_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamp_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamp_encode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_encode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamp_decode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamp_decode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamptz_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timestamptz_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timestamptz_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "time_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "time_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "time_encode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_time_encode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "time_decode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_time_decode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timetz_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timetz_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timetz_encode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_encode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "timetz_decode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_timetz_decode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "interval_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "interval_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "interval_encode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_interval_encode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "interval_decode_tuple", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_interval_decode_tuple, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bits_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bits_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bits_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bits_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bool_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bool_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bool_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bool_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "box_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_box_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "box_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_box_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "line_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_line_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "line_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_line_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "lseg_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "lseg_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_lseg_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "point_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_point_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "point_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_point_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "path_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_path_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "path_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_path_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "poly_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_poly_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "poly_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_poly_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "circle_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_circle_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "circle_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_circle_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "hstore_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "hstore_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_hstore_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int2_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int2_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int2_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int2_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int4_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int4_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int4_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int4_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uint4_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uint4_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uint4_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int8_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int8_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "int8_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_int8_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uint8_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uint8_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uint8_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "float4_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_float4_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "float4_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_float4_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "float8_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_float8_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "float8_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_float8_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "jsonb_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "jsonb_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_jsonb_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "jsonpath_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "jsonpath_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_jsonpath_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "as_pg_string_and_size", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_as_pg_string_and_size, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, PyObject *, char **, Py_ssize_t *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "text_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_text_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "text_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_text_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bytea_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "bytea_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_bytea_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uuid_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "uuid_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_uuid_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "numeric_encode_text", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_text, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "numeric_decode_text", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_text, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "numeric_encode_binary", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_encode_binary, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "numeric_decode_binary", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_numeric_decode_binary, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "void_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_void_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "void_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_void_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "tid_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_tid_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "tid_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_tid_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "cidr_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "cidr_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_cidr_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "inet_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_inet_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "inet_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_inet_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pg_snapshot_encode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_encode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *, PyObject *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pg_snapshot_decode", (void (**)(void))&__pyx_f_7asyncpg_7pgproto_7pgproto_pg_snapshot_decode, "PyObject *(struct __pyx_obj_7asyncpg_7pgproto_7pgproto_CodecContext *, struct __pyx_t_7asyncpg_7pgproto_7pgproto_FRBuffer *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#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 initprotocol(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initprotocol(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_protocol(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_protocol(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_protocol(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  static Py_UCS4 __pyx_t_9[5];
  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;
  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;
  PyTypeObject *__pyx_t_20;
  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 'protocol' 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_protocol(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 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(1, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 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("protocol", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 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(1, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_asyncpg__protocol__protocol) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "asyncpg.protocol.protocol")) {
      if (unlikely(PyDict_SetItemString(modules, "asyncpg.protocol.protocol", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  if (unlikely(__Pyx_modinit_variable_export_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  #endif

  /* "asyncpg/protocol/protocol.pyx":13
 * cimport cpython
 * 
 * import asyncio             # <<<<<<<<<<<<<<
 * import builtins
 * import codecs
 */
  __pyx_t_1 = __Pyx_patch_asyncio(__Pyx_Import(__pyx_n_s_asyncio, 0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, __pyx_t_1) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":14
 * 
 * import asyncio
 * import builtins             # <<<<<<<<<<<<<<
 * import codecs
 * import collections.abc
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_builtins, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_builtins, __pyx_t_1) < 0) __PYX_ERR(1, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":15
 * import asyncio
 * import builtins
 * import codecs             # <<<<<<<<<<<<<<
 * import collections.abc
 * import socket
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_codecs, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_codecs, __pyx_t_1) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":16
 * import builtins
 * import codecs
 * import collections.abc             # <<<<<<<<<<<<<<
 * import socket
 * import time
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections_abc, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_1) < 0) __PYX_ERR(1, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":17
 * import codecs
 * import collections.abc
 * import socket             # <<<<<<<<<<<<<<
 * import time
 * import weakref
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_socket, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_1) < 0) __PYX_ERR(1, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":18
 * import collections.abc
 * import socket
 * import time             # <<<<<<<<<<<<<<
 * import weakref
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":19
 * import socket
 * import time
 * import weakref             # <<<<<<<<<<<<<<
 * 
 * from asyncpg.pgproto.pgproto cimport (
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_weakref, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_weakref, __pyx_t_1) < 0) __PYX_ERR(1, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":43
 *                          UINT32_MAX
 * 
 * from asyncpg.exceptions import _base as apg_exc_base             # <<<<<<<<<<<<<<
 * from asyncpg import compat
 * from asyncpg import types as apg_types
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_base);
  __Pyx_GIVEREF(__pyx_n_s_base);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_base);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asyncpg_exceptions, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apg_exc_base, __pyx_t_1) < 0) __PYX_ERR(1, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":44
 * 
 * from asyncpg.exceptions import _base as apg_exc_base
 * from asyncpg import compat             # <<<<<<<<<<<<<<
 * from asyncpg import types as apg_types
 * from asyncpg import exceptions as apg_exc
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_compat);
  __Pyx_GIVEREF(__pyx_n_s_compat);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_compat);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_compat); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compat, __pyx_t_2) < 0) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/protocol.pyx":45
 * from asyncpg.exceptions import _base as apg_exc_base
 * from asyncpg import compat
 * from asyncpg import types as apg_types             # <<<<<<<<<<<<<<
 * from asyncpg import exceptions as apg_exc
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_types);
  __Pyx_GIVEREF(__pyx_n_s_types);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_types);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apg_types, __pyx_t_1) < 0) __PYX_ERR(1, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":46
 * from asyncpg import compat
 * from asyncpg import types as apg_types
 * from asyncpg import exceptions as apg_exc             # <<<<<<<<<<<<<<
 * 
 * from asyncpg.pgproto cimport hton
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apg_exc, __pyx_t_2) < 0) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":112
 * DEF ANYCOMPATIBLERANGEOID = 5080
 * 
 * cdef ARRAY_TYPES = (_TEXTOID, _OIDOID,)             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_OID_MAP = {
 */
  __Pyx_INCREF(__pyx_tuple__50);
  __Pyx_XGOTREF(__pyx_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES);
  __Pyx_DECREF_SET(__pyx_v_7asyncpg_8protocol_8protocol_ARRAY_TYPES, __pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "asyncpg/protocol/pgtypes.pxi":115
 * 
 * BUILTIN_TYPE_OID_MAP = {
 *     ABSTIMEOID: 'abstime',             # <<<<<<<<<<<<<<
 *     ACLITEMOID: 'aclitem',
 *     ANYARRAYOID: 'anyarray',
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(96); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_702, __pyx_n_u_abstime) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1033, __pyx_n_u_aclitem) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2277, __pyx_n_u_anyarray) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5078, __pyx_n_u_anycompatiblearray) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5079, __pyx_n_u_anycompatiblenonarray) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5077, __pyx_n_u_anycompatible) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5080, __pyx_n_u_anycompatiblerange) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2283, __pyx_n_u_anyelement) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3500, __pyx_n_u_anyenum) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2776, __pyx_n_u_anynonarray) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2276, __pyx_n_u_any) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3831, __pyx_n_u_anyrange) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1560, __pyx_n_u_bit) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, __pyx_n_u_bool) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_603, __pyx_n_u_box) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1042, __pyx_n_u_bpchar) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, __pyx_n_u_bytea) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, __pyx_n_u_char) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, __pyx_n_u_cid) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_650, __pyx_n_u_cidr) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_718, __pyx_n_u_circle) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2275, __pyx_n_u_cstring) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1082, __pyx_n_u_date) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3838, __pyx_n_u_event_trigger) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3115, __pyx_n_u_fdw_handler) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_700, __pyx_n_u_float4) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_701, __pyx_n_u_float8) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3642, __pyx_n_u_gtsvector) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_325, __pyx_n_u_index_am_handler) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_869, __pyx_n_u_inet) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, __pyx_n_u_int2) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, __pyx_n_u_int4) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, __pyx_n_u_int8) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2281, __pyx_n_u_internal) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1186, __pyx_n_u_interval) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3802, __pyx_n_u_jsonb) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_114, __pyx_n_u_json) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4072, __pyx_n_u_jsonpath) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2280, __pyx_n_u_language_handler) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_628, __pyx_n_u_line) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_601, __pyx_n_u_lseg) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_774, __pyx_n_u_macaddr8) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_829, __pyx_n_u_macaddr) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_790, __pyx_n_u_money) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, __pyx_n_u_name) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1700, __pyx_n_u_numeric) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, __pyx_n_u_oid) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2282, __pyx_n_u_opaque) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_602, __pyx_n_u_path) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, __pyx_n_u_pg_ddl_command) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3402, __pyx_n_u_pg_dependencies) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3220, __pyx_n_u_pg_lsn) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5017, __pyx_n_u_pg_mcv_list) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3361, __pyx_n_u_pg_ndistinct) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_194, __pyx_n_u_pg_node_tree) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5038, __pyx_n_u_pg_snapshot) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_600, __pyx_n_u_point) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_604, __pyx_n_u_polygon) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2249, __pyx_n_u_record) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1790, __pyx_n_u_refcursor) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2205, __pyx_n_u_regclass) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4191, __pyx_n_u_regcollation) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3734, __pyx_n_u_regconfig) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3769, __pyx_n_u_regdictionary) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4089, __pyx_n_u_regnamespace) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2204, __pyx_n_u_regoperator) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2203, __pyx_n_u_regoper) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2202, __pyx_n_u_regprocedure) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, __pyx_n_u_regproc) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4096, __pyx_n_u_regrole) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2206, __pyx_n_u_regtype) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_703, __pyx_n_u_reltime) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_210, __pyx_n_u_smgr) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_269, __pyx_n_u_table_am_handler) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, __pyx_n_u_text) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, __pyx_n_u_tid) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1083, __pyx_n_u_time) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1114, __pyx_n_u_timestamp) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1184, __pyx_n_u_timestamptz) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1266, __pyx_n_u_timetz) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_704, __pyx_n_u_tinterval) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2279, __pyx_n_u_trigger) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3310, __pyx_n_u_tsm_handler) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3615, __pyx_n_u_tsquery) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3614, __pyx_n_u_tsvector) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2970, __pyx_n_u_txid_snapshot) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_705, __pyx_n_u_unknown) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2950, __pyx_n_u_uuid) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1562, __pyx_n_u_varbit) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1043, __pyx_n_u_varchar) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2278, __pyx_n_u_void) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5069, __pyx_n_u_xid8) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, __pyx_n_u_xid) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_142, __pyx_n_u_xml) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1028, __pyx_kp_u_oid_2) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1009, __pyx_kp_u_text_2) < 0) __PYX_ERR(21, 115, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUILTIN_TYPE_OID_MAP, __pyx_t_1) < 0) __PYX_ERR(21, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":213
 * }
 * 
 * BUILTIN_TYPE_NAME_MAP = {v: k for k, v in BUILTIN_TYPE_OID_MAP.items()}             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['smallint'] = \
 */
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 213, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_BUILTIN_TYPE_OID_MAP); if (unlikely(!__pyx_t_6)) __PYX_ERR(21, 213, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_t_6 == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(21, 213, __pyx_L4_error)
    }
    __pyx_t_7 = __Pyx_dict_iterator(__pyx_t_6, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_7)) __PYX_ERR(21, 213, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_7;
    __pyx_t_7 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_7, &__pyx_t_6, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(21, 213, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k);
      __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XGOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v);
      __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v, (PyObject*)__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k))) __PYX_ERR(21, 213, __pyx_L4_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k, Py_None);
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v, Py_None);
    goto __pyx_L7_exit_scope;
    __pyx_L4_error:;
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_k, Py_None);
    __Pyx_GOTREF(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v);
    __Pyx_DECREF_SET(__pyx_8genexpr1__pyx_v_7asyncpg_8protocol_8protocol_v, Py_None);
    goto __pyx_L1_error;
    __pyx_L7_exit_scope:;
  } /* exit inner scope */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUILTIN_TYPE_NAME_MAP, __pyx_t_1) < 0) __PYX_ERR(21, 213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":216
 * 
 * BUILTIN_TYPE_NAME_MAP['smallint'] = \
 *     BUILTIN_TYPE_NAME_MAP['int2']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['int'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_int2); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":215
 * BUILTIN_TYPE_NAME_MAP = {v: k for k, v in BUILTIN_TYPE_OID_MAP.items()}
 * 
 * BUILTIN_TYPE_NAME_MAP['smallint'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['int2']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_smallint, __pyx_t_2) < 0)) __PYX_ERR(21, 215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":219
 * 
 * BUILTIN_TYPE_NAME_MAP['int'] = \
 *     BUILTIN_TYPE_NAME_MAP['int4']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['integer'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_int4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":218
 *     BUILTIN_TYPE_NAME_MAP['int2']
 * 
 * BUILTIN_TYPE_NAME_MAP['int'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['int4']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_int, __pyx_t_1) < 0)) __PYX_ERR(21, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":222
 * 
 * BUILTIN_TYPE_NAME_MAP['integer'] = \
 *     BUILTIN_TYPE_NAME_MAP['int4']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['bigint'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_int4); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":221
 *     BUILTIN_TYPE_NAME_MAP['int4']
 * 
 * BUILTIN_TYPE_NAME_MAP['integer'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['int4']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_integer, __pyx_t_2) < 0)) __PYX_ERR(21, 221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":225
 * 
 * BUILTIN_TYPE_NAME_MAP['bigint'] = \
 *     BUILTIN_TYPE_NAME_MAP['int8']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['decimal'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_int8); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":224
 *     BUILTIN_TYPE_NAME_MAP['int4']
 * 
 * BUILTIN_TYPE_NAME_MAP['bigint'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['int8']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_bigint, __pyx_t_1) < 0)) __PYX_ERR(21, 224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":228
 * 
 * BUILTIN_TYPE_NAME_MAP['decimal'] = \
 *     BUILTIN_TYPE_NAME_MAP['numeric']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['real'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_numeric); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":227
 *     BUILTIN_TYPE_NAME_MAP['int8']
 * 
 * BUILTIN_TYPE_NAME_MAP['decimal'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['numeric']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_decimal, __pyx_t_2) < 0)) __PYX_ERR(21, 227, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":231
 * 
 * BUILTIN_TYPE_NAME_MAP['real'] = \
 *     BUILTIN_TYPE_NAME_MAP['float4']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['double precision'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_float4); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":230
 *     BUILTIN_TYPE_NAME_MAP['numeric']
 * 
 * BUILTIN_TYPE_NAME_MAP['real'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['float4']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_real, __pyx_t_1) < 0)) __PYX_ERR(21, 230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":234
 * 
 * BUILTIN_TYPE_NAME_MAP['double precision'] = \
 *     BUILTIN_TYPE_NAME_MAP['float8']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp with timezone'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_float8); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":233
 *     BUILTIN_TYPE_NAME_MAP['float4']
 * 
 * BUILTIN_TYPE_NAME_MAP['double precision'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['float8']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_kp_u_double_precision, __pyx_t_2) < 0)) __PYX_ERR(21, 233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":237
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp with timezone'] = \
 *     BUILTIN_TYPE_NAME_MAP['timestamptz']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp without timezone'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_timestamptz); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":236
 *     BUILTIN_TYPE_NAME_MAP['float8']
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp with timezone'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['timestamptz']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_kp_u_timestamp_with_timezone, __pyx_t_1) < 0)) __PYX_ERR(21, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":240
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp without timezone'] = \
 *     BUILTIN_TYPE_NAME_MAP['timestamp']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['time with timezone'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":239
 *     BUILTIN_TYPE_NAME_MAP['timestamptz']
 * 
 * BUILTIN_TYPE_NAME_MAP['timestamp without timezone'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['timestamp']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_kp_u_timestamp_without_timezone, __pyx_t_2) < 0)) __PYX_ERR(21, 239, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":243
 * 
 * BUILTIN_TYPE_NAME_MAP['time with timezone'] = \
 *     BUILTIN_TYPE_NAME_MAP['timetz']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['time without timezone'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_timetz); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":242
 *     BUILTIN_TYPE_NAME_MAP['timestamp']
 * 
 * BUILTIN_TYPE_NAME_MAP['time with timezone'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['timetz']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_kp_u_time_with_timezone, __pyx_t_1) < 0)) __PYX_ERR(21, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":246
 * 
 * BUILTIN_TYPE_NAME_MAP['time without timezone'] = \
 *     BUILTIN_TYPE_NAME_MAP['time']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['char'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":245
 *     BUILTIN_TYPE_NAME_MAP['timetz']
 * 
 * BUILTIN_TYPE_NAME_MAP['time without timezone'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['time']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_kp_u_time_without_timezone, __pyx_t_2) < 0)) __PYX_ERR(21, 245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":249
 * 
 * BUILTIN_TYPE_NAME_MAP['char'] = \
 *     BUILTIN_TYPE_NAME_MAP['bpchar']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['character'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_bpchar); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":248
 *     BUILTIN_TYPE_NAME_MAP['time']
 * 
 * BUILTIN_TYPE_NAME_MAP['char'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['bpchar']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_char, __pyx_t_1) < 0)) __PYX_ERR(21, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":252
 * 
 * BUILTIN_TYPE_NAME_MAP['character'] = \
 *     BUILTIN_TYPE_NAME_MAP['bpchar']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['character varying'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_bpchar); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":251
 *     BUILTIN_TYPE_NAME_MAP['bpchar']
 * 
 * BUILTIN_TYPE_NAME_MAP['character'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['bpchar']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_character, __pyx_t_2) < 0)) __PYX_ERR(21, 251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":255
 * 
 * BUILTIN_TYPE_NAME_MAP['character varying'] = \
 *     BUILTIN_TYPE_NAME_MAP['varchar']             # <<<<<<<<<<<<<<
 * 
 * BUILTIN_TYPE_NAME_MAP['bit varying'] = \
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_varchar); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":254
 *     BUILTIN_TYPE_NAME_MAP['bpchar']
 * 
 * BUILTIN_TYPE_NAME_MAP['character varying'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['varchar']
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_kp_u_character_varying, __pyx_t_1) < 0)) __PYX_ERR(21, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":258
 * 
 * BUILTIN_TYPE_NAME_MAP['bit varying'] = \
 *     BUILTIN_TYPE_NAME_MAP['varbit']             # <<<<<<<<<<<<<<
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_varbit); if (unlikely(!__pyx_t_2)) __PYX_ERR(21, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/pgtypes.pxi":257
 *     BUILTIN_TYPE_NAME_MAP['varchar']
 * 
 * BUILTIN_TYPE_NAME_MAP['bit varying'] = \             # <<<<<<<<<<<<<<
 *     BUILTIN_TYPE_NAME_MAP['varbit']
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BUILTIN_TYPE_NAME_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(21, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_kp_u_bit_varying, __pyx_t_2) < 0)) __PYX_ERR(21, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/encodings.pyx":14
 * 
 * cdef dict ENCODINGS_MAP = {
 *     'abc': 'cp1258',             # <<<<<<<<<<<<<<
 *     'alt': 'cp866',
 *     'euc_cn': 'euccn',
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(45); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_abc, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_alt, __pyx_n_u_cp866) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_euc_cn, __pyx_n_u_euccn) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_euc_jp, __pyx_n_u_eucjp) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_euc_kr, __pyx_n_u_euckr) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_koi8r, __pyx_n_u_koi8_r) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_koi8u, __pyx_n_u_koi8_u) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_shift_jis_2004, __pyx_n_u_euc_jis_2004) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_sjis, __pyx_n_u_shift_jis) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_sql_ascii, __pyx_n_u_ascii) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_vscii, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_tcvn, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_tcvn5712, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_unicode, __pyx_n_u_utf_8_2) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win, __pyx_n_u_cp1521) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1250, __pyx_n_u_cp1250) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1251, __pyx_n_u_cp1251) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1252, __pyx_n_u_cp1252) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1253, __pyx_n_u_cp1253) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1254, __pyx_n_u_cp1254) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1255, __pyx_n_u_cp1255) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1256, __pyx_n_u_cp1256) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1257, __pyx_n_u_cp1257) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win1258, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win866, __pyx_n_u_cp866) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win874, __pyx_n_u_cp874) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win932, __pyx_n_u_cp932) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win936, __pyx_n_u_cp936) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win949, __pyx_n_u_cp949) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_win950, __pyx_n_u_cp950) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1250, __pyx_n_u_cp1250) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1251, __pyx_n_u_cp1251) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1252, __pyx_n_u_cp1252) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1253, __pyx_n_u_cp1253) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1254, __pyx_n_u_cp1254) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1255, __pyx_n_u_cp1255) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1256, __pyx_n_u_cp1256) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1257, __pyx_n_u_cp1257) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows1258, __pyx_n_u_cp1258) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows866, __pyx_n_u_cp866) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows874, __pyx_n_u_cp874) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows932, __pyx_n_u_cp932) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows936, __pyx_n_u_cp936) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows949, __pyx_n_u_cp949) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_u_windows950, __pyx_n_u_cp950) < 0) __PYX_ERR(8, 14, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP);
  __Pyx_DECREF_SET(__pyx_v_7asyncpg_8protocol_8protocol_ENCODINGS_MAP, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/settings.pyx":8
 * 
 * 
 * from asyncpg import exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/settings.pyx":90
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,
 *                                       ServerDataFormat format=PG_FORMAT_ANY,             # <<<<<<<<<<<<<<
 *                                       bint ignore_custom_codec=False):
 *         return self._data_codecs.get_codec(oid, format, ignore_custom_codec)
 */
  __pyx_k_ = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY;

  /* "asyncpg/protocol/settings.pyx":89
 *                                                  typekind, alias_to, _format)
 * 
 *     cpdef inline Codec get_data_codec(self, uint32_t oid,             # <<<<<<<<<<<<<<
 *                                       ServerDataFormat format=PG_FORMAT_ANY,
 *                                       bint ignore_custom_codec=False):
 */
  __pyx_k_ = __pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY;

  /* "asyncpg/protocol/codecs/base.pyx":8
 * 
 * 
 * from collections.abc import Mapping as MappingABC             # <<<<<<<<<<<<<<
 * 
 * import asyncpg
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Mapping);
  __Pyx_GIVEREF(__pyx_n_s_Mapping);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Mapping);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MappingABC, __pyx_t_1) < 0) __PYX_ERR(4, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":10
 * from collections.abc import Mapping as MappingABC
 * 
 * import asyncpg             # <<<<<<<<<<<<<<
 * from asyncpg import exceptions
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asyncpg, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncpg, __pyx_t_2) < 0) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":11
 * 
 * import asyncpg
 * from asyncpg import exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(4, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":16
 * cdef void* binary_codec_map[(MAXSUPPORTEDOID + 1) * 2]
 * cdef void* text_codec_map[(MAXSUPPORTEDOID + 1) * 2]
 * cdef dict EXTRA_CODECS = {}             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS);
  __Pyx_DECREF_SET(__pyx_v_7asyncpg_8protocol_8protocol_EXTRA_CODECS, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":588
 * 
 *     def _set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,
 *                                 alias_to, format=PG_FORMAT_ANY):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Codec codec
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k__10 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":637
 * 
 *     def set_builtin_type_codec(self, typeoid, typename, typeschema, typekind,
 *                                alias_to, format=PG_FORMAT_ANY):             # <<<<<<<<<<<<<<
 *         self._set_builtin_type_codec(typeoid, typename, typeschema, typekind,
 *                                      alias_to, format)
 */
  __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(__pyx_e_7asyncpg_8protocol_8protocol_PG_FORMAT_ANY); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k__11 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/base.pyx":721
 * cdef inline Codec get_core_codec(
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):             # <<<<<<<<<<<<<<
 *     cdef:
 *         void *ptr = NULL
 */
  __pyx_k__13 = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT;

  /* "asyncpg/protocol/codecs/base.pyx":740
 * cdef inline Codec get_any_core_codec(
 *         uint32_t oid, ServerDataFormat format,
 *         ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):             # <<<<<<<<<<<<<<
 *     """A version of get_core_codec that accepts PG_FORMAT_ANY."""
 *     cdef:
 */
  __pyx_k__14 = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT;

  /* "asyncpg/protocol/codecs/base.pyx":763
 *                          decode_func decode,
 *                          ServerDataFormat format,
 *                          ClientExchangeFormat xformat=PG_XFORMAT_OBJECT):             # <<<<<<<<<<<<<<
 * 
 *     if oid > MAXSUPPORTEDOID:
 */
  __pyx_k__15 = __pyx_e_7asyncpg_8protocol_8protocol_PG_XFORMAT_OBJECT;

  /* "asyncpg/protocol/codecs/pgproto.pyx":470
 * 
 * 
 * init_all_pgproto_codecs()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_all_pgproto_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":8
 * 
 * 
 * from collections.abc import (Iterable as IterableABC,             # <<<<<<<<<<<<<<
 *                              Mapping as MappingABC,
 *                              Sized as SizedABC)
 */
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Iterable);
  __Pyx_GIVEREF(__pyx_n_s_Iterable);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Iterable);
  __Pyx_INCREF(__pyx_n_s_Mapping);
  __Pyx_GIVEREF(__pyx_n_s_Mapping);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Mapping);
  __Pyx_INCREF(__pyx_n_s_Sized);
  __Pyx_GIVEREF(__pyx_n_s_Sized);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_Sized);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IterableABC, __pyx_t_1) < 0) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MappingABC, __pyx_t_1) < 0) __PYX_ERR(5, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Sized); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SizedABC, __pyx_t_1) < 0) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":12
 *                              Sized as SizedABC)
 * 
 * from asyncpg import exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/array.pyx":18
 * 
 * # "NULL"
 * cdef Py_UCS4 *APG_NULL = [0x004E, 0x0055, 0x004C, 0x004C, 0x0000]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_9[0] = 0x004E;
  __pyx_t_9[1] = 0x0055;
  __pyx_t_9[2] = 0x004C;
  __pyx_t_9[3] = 0x004C;
  __pyx_t_9[4] = 0x0000;
  __pyx_v_7asyncpg_8protocol_8protocol_APG_NULL = __pyx_t_9;

  /* "asyncpg/protocol/codecs/array.pyx":887
 *                         PG_FORMAT_BINARY)
 * 
 * init_array_codecs()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_array_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":8
 * 
 * 
 * from asyncpg import types as apg_types             # <<<<<<<<<<<<<<
 * 
 * # defined in postgresql/src/include/utils/rangetypes.h
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_types);
  __Pyx_GIVEREF(__pyx_n_s_types);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_types);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apg_types, __pyx_t_1) < 0) __PYX_ERR(10, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/range.pyx":149
 * 
 * 
 * init_range_codecs()             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = __pyx_f_7asyncpg_8protocol_8protocol_init_range_codecs(); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":8
 * 
 * 
 * from asyncpg import exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/codecs/record.pyx":71
 *                         PG_FORMAT_BINARY)
 * 
 * init_record_codecs()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_f_7asyncpg_8protocol_8protocol_init_record_codecs(); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asyncpg/protocol/coreproto.pyx":8
 * 
 * 
 * from hashlib import md5 as hashlib_md5  # for MD5 authentication             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_md5);
  __Pyx_GIVEREF(__pyx_n_s_md5);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_md5);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_hashlib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_md5); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib_md5, __pyx_t_1) < 0) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":8
 * 
 * 
 * import base64             # <<<<<<<<<<<<<<
 * import hashlib
 * import hmac
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_base64, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_base64, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":9
 * 
 * import base64
 * import hashlib             # <<<<<<<<<<<<<<
 * import hmac
 * import re
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_hashlib, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":10
 * import base64
 * import hashlib
 * import hmac             # <<<<<<<<<<<<<<
 * import re
 * import stringprep
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_hmac, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hmac, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":11
 * import hashlib
 * import hmac
 * import re             # <<<<<<<<<<<<<<
 * import stringprep
 * import unicodedata
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":12
 * import hmac
 * import re
 * import stringprep             # <<<<<<<<<<<<<<
 * import unicodedata
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_stringprep, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_stringprep, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":13
 * import re
 * import stringprep
 * import unicodedata             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_unicodedata, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicodedata, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":19
 * # cryptographic token generator for generating nonces as part of SCRAM
 * # Otherwise fall back on os.urandom
 * try:             # <<<<<<<<<<<<<<
 *     from secrets import token_bytes as generate_token_bytes
 * except ImportError:
 */
  {
    __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:*/ {

      /* "asyncpg/protocol/scram.pyx":20
 * # Otherwise fall back on os.urandom
 * try:
 *     from secrets import token_bytes as generate_token_bytes             # <<<<<<<<<<<<<<
 * except ImportError:
 *     from os import urandom as generate_token_bytes
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_token_bytes);
      __Pyx_GIVEREF(__pyx_n_s_token_bytes);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_token_bytes);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_secrets, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_token_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_generate_token_bytes, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L8_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asyncpg/protocol/scram.pyx":19
 * # cryptographic token generator for generating nonces as part of SCRAM
 * # Otherwise fall back on os.urandom
 * try:             # <<<<<<<<<<<<<<
 *     from secrets import token_bytes as generate_token_bytes
 * except ImportError:
 */
    }
    __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_L13_try_end;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "asyncpg/protocol/scram.pyx":21
 * try:
 *     from secrets import token_bytes as generate_token_bytes
 * except ImportError:             # <<<<<<<<<<<<<<
 *     from os import urandom as generate_token_bytes
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("asyncpg.protocol.protocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_6) < 0) __PYX_ERR(0, 21, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_6);

      /* "asyncpg/protocol/scram.pyx":22
 *     from secrets import token_bytes as generate_token_bytes
 * except ImportError:
 *     from os import urandom as generate_token_bytes             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_n_s_urandom);
      __Pyx_GIVEREF(__pyx_n_s_urandom);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_urandom);
      __pyx_t_13 = __Pyx_Import(__pyx_n_s_os, __pyx_t_7, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 22, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_13, __pyx_n_s_urandom); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L10_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_generate_token_bytes, __pyx_t_7) < 0) __PYX_ERR(0, 22, __pyx_L10_except_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L9_exception_handled;
    }
    goto __pyx_L10_except_error;
    __pyx_L10_except_error:;

    /* "asyncpg/protocol/scram.pyx":19
 * # cryptographic token generator for generating nonces as part of SCRAM
 * # Otherwise fall back on os.urandom
 * try:             # <<<<<<<<<<<<<<
 *     from secrets import token_bytes as generate_token_bytes
 * except ImportError:
 */
    __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_L9_exception_handled:;
    __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_L13_try_end:;
  }

  /* "asyncpg/protocol/scram.pyx":80
 *     to support other channel binding methos in the future
 *     """
 *     AUTHENTICATION_METHODS = [b"SCRAM-SHA-256"]             # <<<<<<<<<<<<<<
 *     DEFAULT_CLIENT_NONCE_BYTES = 24
 *     DIGEST = hashlib.sha256
 */
  __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_b_SCRAM_SHA_256);
  __Pyx_GIVEREF(__pyx_kp_b_SCRAM_SHA_256);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_kp_b_SCRAM_SHA_256);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_AUTHENTICATION_METHODS, __pyx_t_6) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/scram.pyx":81
 *     """
 *     AUTHENTICATION_METHODS = [b"SCRAM-SHA-256"]
 *     DEFAULT_CLIENT_NONCE_BYTES = 24             # <<<<<<<<<<<<<<
 *     DIGEST = hashlib.sha256
 *     REQUIREMENTS_CLIENT_FINAL_MESSAGE = ['client_channel_binding',
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_DEFAULT_CLIENT_NONCE_BYTES, __pyx_int_24) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/scram.pyx":82
 *     AUTHENTICATION_METHODS = [b"SCRAM-SHA-256"]
 *     DEFAULT_CLIENT_NONCE_BYTES = 24
 *     DIGEST = hashlib.sha256             # <<<<<<<<<<<<<<
 *     REQUIREMENTS_CLIENT_FINAL_MESSAGE = ['client_channel_binding',
 *         'server_nonce']
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sha256); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_DIGEST, __pyx_t_2) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/scram.pyx":83
 *     DEFAULT_CLIENT_NONCE_BYTES = 24
 *     DIGEST = hashlib.sha256
 *     REQUIREMENTS_CLIENT_FINAL_MESSAGE = ['client_channel_binding',             # <<<<<<<<<<<<<<
 *         'server_nonce']
 *     REQUIREMENTS_CLIENT_PROOF = ['password_iterations', 'password_salt',
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_client_channel_binding);
  __Pyx_GIVEREF(__pyx_n_u_client_channel_binding);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_client_channel_binding);
  __Pyx_INCREF(__pyx_n_u_server_nonce);
  __Pyx_GIVEREF(__pyx_n_u_server_nonce);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_server_nonce);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_REQUIREMENTS_CLIENT_FINAL_MESSAG, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/scram.pyx":85
 *     REQUIREMENTS_CLIENT_FINAL_MESSAGE = ['client_channel_binding',
 *         'server_nonce']
 *     REQUIREMENTS_CLIENT_PROOF = ['password_iterations', 'password_salt',             # <<<<<<<<<<<<<<
 *         'server_first_message', 'server_nonce']
 *     SASLPREP_PROHIBITED = (
 */
  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_password_iterations);
  __Pyx_GIVEREF(__pyx_n_u_password_iterations);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_password_iterations);
  __Pyx_INCREF(__pyx_n_u_password_salt);
  __Pyx_GIVEREF(__pyx_n_u_password_salt);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_password_salt);
  __Pyx_INCREF(__pyx_n_u_server_first_message);
  __Pyx_GIVEREF(__pyx_n_u_server_first_message);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_u_server_first_message);
  __Pyx_INCREF(__pyx_n_u_server_nonce);
  __Pyx_GIVEREF(__pyx_n_u_server_nonce);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_u_server_nonce);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_REQUIREMENTS_CLIENT_PROOF, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/scram.pyx":88
 *         'server_first_message', 'server_nonce']
 *     SASLPREP_PROHIBITED = (
 *         stringprep.in_table_a1, # PostgreSQL treats this as prohibited             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c12,
 *         stringprep.in_table_c21_c22,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_a1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":89
 *     SASLPREP_PROHIBITED = (
 *         stringprep.in_table_a1, # PostgreSQL treats this as prohibited
 *         stringprep.in_table_c12,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c21_c22,
 *         stringprep.in_table_c3,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":90
 *         stringprep.in_table_a1, # PostgreSQL treats this as prohibited
 *         stringprep.in_table_c12,
 *         stringprep.in_table_c21_c22,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c3,
 *         stringprep.in_table_c4,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c21_c22); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":91
 *         stringprep.in_table_c12,
 *         stringprep.in_table_c21_c22,
 *         stringprep.in_table_c3,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c4,
 *         stringprep.in_table_c5,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":92
 *         stringprep.in_table_c21_c22,
 *         stringprep.in_table_c3,
 *         stringprep.in_table_c4,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c5,
 *         stringprep.in_table_c6,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":93
 *         stringprep.in_table_c3,
 *         stringprep.in_table_c4,
 *         stringprep.in_table_c5,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c6,
 *         stringprep.in_table_c7,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":94
 *         stringprep.in_table_c4,
 *         stringprep.in_table_c5,
 *         stringprep.in_table_c6,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c7,
 *         stringprep.in_table_c8,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":95
 *         stringprep.in_table_c5,
 *         stringprep.in_table_c6,
 *         stringprep.in_table_c7,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c8,
 *         stringprep.in_table_c9,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":96
 *         stringprep.in_table_c6,
 *         stringprep.in_table_c7,
 *         stringprep.in_table_c8,             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c9,
 *     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":97
 *         stringprep.in_table_c7,
 *         stringprep.in_table_c8,
 *         stringprep.in_table_c9,             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_stringprep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_in_table_c9); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/scram.pyx":88
 *         'server_first_message', 'server_nonce']
 *     SASLPREP_PROHIBITED = (
 *         stringprep.in_table_a1, # PostgreSQL treats this as prohibited             # <<<<<<<<<<<<<<
 *         stringprep.in_table_c12,
 *         stringprep.in_table_c21_c22,
 */
  __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_17);
  PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_18);
  PyTuple_SET_ITEM(__pyx_t_2, 8, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_2, 9, __pyx_t_19);
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_13 = 0;
  __pyx_t_7 = 0;
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;
  __pyx_t_18 = 0;
  __pyx_t_19 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication->tp_dict, __pyx_n_s_SASLPREP_PROHIBITED, __pyx_t_2) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7asyncpg_8protocol_8protocol_SCRAMAuthentication);

  /* "asyncpg/protocol/coreproto.pyx":1123
 * 
 * 
 * cdef bytes SYNC_MESSAGE = bytes(WriteBuffer.new_message(b'S').end_message())             # <<<<<<<<<<<<<<
 * cdef bytes FLUSH_MESSAGE = bytes(WriteBuffer.new_message(b'H').end_message())
 */
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('S')); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2)->__pyx_vtab)->end_message(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2)); if (unlikely(!__pyx_t_19)) __PYX_ERR(6, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_19); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_XGOTREF(__pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE);
  __Pyx_DECREF_SET(__pyx_v_7asyncpg_8protocol_8protocol_SYNC_MESSAGE, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/coreproto.pyx":1124
 * 
 * cdef bytes SYNC_MESSAGE = bytes(WriteBuffer.new_message(b'S').end_message())
 * cdef bytes FLUSH_MESSAGE = bytes(WriteBuffer.new_message(b'H').end_message())             # <<<<<<<<<<<<<<
 */
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_7asyncpg_7pgproto_7pgproto_WriteBuffer->new_message('H')); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = ((struct __pyx_vtabstruct_7asyncpg_7pgproto_7pgproto_WriteBuffer *)((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2)->__pyx_vtab)->end_message(((struct __pyx_obj_7asyncpg_7pgproto_7pgproto_WriteBuffer *)__pyx_t_2)); if (unlikely(!__pyx_t_19)) __PYX_ERR(6, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_19); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __Pyx_XGOTREF(__pyx_v_7asyncpg_8protocol_8protocol_FLUSH_MESSAGE);
  __Pyx_DECREF_SET(__pyx_v_7asyncpg_8protocol_8protocol_FLUSH_MESSAGE, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asyncpg/protocol/prepared_stmt.pyx":8
 * 
 * 
 * from asyncpg import exceptions             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_exceptions);
  __Pyx_GIVEREF(__pyx_n_s_exceptions);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exceptions);
  __pyx_t_19 = __Pyx_Import(__pyx_n_s_asyncpg, __pyx_t_2, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_19, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_2) < 0) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":72
 * 
 * 
 * NO_TIMEOUT = object()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_19 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NO_TIMEOUT, __pyx_t_19) < 0) __PYX_ERR(1, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":978
 * 
 * 
 * class Timer:             # <<<<<<<<<<<<<<
 *     def __init__(self, budget):
 *         self._budget = budget
 */
  __pyx_t_19 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Timer, __pyx_n_s_Timer, (PyObject *) NULL, __pyx_n_s_asyncpg_protocol_protocol, (PyObject *) NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);

  /* "asyncpg/protocol/protocol.pyx":979
 * 
 * class Timer:
 *     def __init__(self, budget):             # <<<<<<<<<<<<<<
 *         self._budget = budget
 *         self._started = 0
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_1__init__, 0, __pyx_n_s_Timer___init, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_19, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(1, 979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":983
 *         self._started = 0
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._started = time.monotonic()
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_3__enter__, 0, __pyx_n_s_Timer___enter, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_19, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(1, 983, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":987
 *             self._started = time.monotonic()
 * 
 *     def __exit__(self, et, e, tb):             # <<<<<<<<<<<<<<
 *         if self._budget is not None:
 *             self._budget -= time.monotonic() - self._started
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_5__exit__, 0, __pyx_n_s_Timer___exit, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_19, __pyx_n_s_exit, __pyx_t_2) < 0) __PYX_ERR(1, 987, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":991
 *             self._budget -= time.monotonic() - self._started
 * 
 *     def get_remaining_budget(self):             # <<<<<<<<<<<<<<
 *         return self._budget
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_7get_remaining_budget, 0, __pyx_n_s_Timer_get_remaining_budget, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_19, __pyx_n_s_get_remaining_budget, __pyx_t_2) < 0) __PYX_ERR(1, 991, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":994
 *         return self._budget
 * 
 *     def has_budget_greater_than(self, amount):             # <<<<<<<<<<<<<<
 *         if self._budget is None:
 *             # Unlimited budget.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7asyncpg_8protocol_8protocol_5Timer_9has_budget_greater_than, 0, __pyx_n_s_Timer_has_budget_greater_than, NULL, __pyx_n_s_asyncpg_protocol_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_19, __pyx_n_s_has_budget_greater_than, __pyx_t_2) < 0) __PYX_ERR(1, 994, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asyncpg/protocol/protocol.pyx":978
 * 
 * 
 * class Timer:             # <<<<<<<<<<<<<<
 *     def __init__(self, budget):
 *         self._budget = budget
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Timer, __pyx_empty_tuple, __pyx_t_19, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timer, __pyx_t_2) < 0) __PYX_ERR(1, 978, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":1002
 * 
 * 
 * class Protocol(BaseProtocol, asyncio.Protocol):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol));
  PyTuple_SET_ITEM(__pyx_t_19, 0, ((PyObject *)__pyx_ptype_7asyncpg_8protocol_8protocol_BaseProtocol));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_19); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_18 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_19, __pyx_n_s_Protocol, __pyx_n_s_Protocol, (PyObject *) NULL, __pyx_n_s_asyncpg_protocol_protocol, (PyObject *) NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_17 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Protocol, __pyx_t_19, __pyx_t_18, NULL, 0, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Protocol, __pyx_t_17) < 0) __PYX_ERR(1, 1002, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":1006
 * 
 * 
 * def _create_record(object mapping, tuple elems):             # <<<<<<<<<<<<<<
 *     # Exposed only for testing purposes.
 * 
 */
  __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_7asyncpg_8protocol_8protocol_1_create_record, NULL, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_record, __pyx_t_19) < 0) __PYX_ERR(1, 1006, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":1027
 * 
 * 
 * Record = <object>record.ApgRecord_InitTypes()             # <<<<<<<<<<<<<<
 */
  __pyx_t_20 = ApgRecord_InitTypes(); if (unlikely(__pyx_t_20 == ((PyTypeObject *)NULL))) __PYX_ERR(1, 1027, __pyx_L1_error)
  __pyx_t_19 = ((PyObject *)__pyx_t_20);
  __Pyx_INCREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Record, __pyx_t_19) < 0) __PYX_ERR(1, 1027, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_DataCodecConfig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_7asyncpg_8protocol_8protocol_3__pyx_unpickle_DataCodecConfig, NULL, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!__pyx_t_19)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_DataCodecConfig, __pyx_t_19) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_DataCodecConfig__set_state(<DataCodecConfig> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_DataCodecConfig__set_state(DataCodecConfig __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result._custom_type_codecs = __pyx_state[0]; __pyx_result._derived_type_codecs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_7asyncpg_8protocol_8protocol_5__pyx_unpickle_CoreProtocol, NULL, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!__pyx_t_19)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CoreProtocol, __pyx_t_19) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseProtocol(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_7asyncpg_8protocol_8protocol_7__pyx_unpickle_BaseProtocol, NULL, __pyx_n_s_asyncpg_protocol_protocol); if (unlikely(!__pyx_t_19)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BaseProtocol, __pyx_t_19) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/protocol/protocol.pyx":1
 * # Copyright (C) 2016-present the asyncpg authors and contributors             # <<<<<<<<<<<<<<
 * # <see AUTHORS file>
 * #
 */
  __pyx_t_19 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_19) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

  /* "asyncpg/pgproto/buffer.pxd":106
 *         return self._current_message_type
 * 
 *     cdef inline int32_t get_message_length(self):             # <<<<<<<<<<<<<<
 *         return self._current_message_len
 * 
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init asyncpg.protocol.protocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init asyncpg.protocol.protocol");
  }
  __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;
}

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

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* dict_getitem_default */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

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

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

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

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

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

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

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

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

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

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

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#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

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#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

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

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

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

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

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

/* py_dict_pop */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3
    if ((1)) {
        return _PyDict_Pop(d, key, default_value);
    } else
#endif
    if (default_value) {
        return __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_pop, d, key, default_value);
    } else {
        return __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_pop, d, key);
    }
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyString_CheckExact(s))) {
        PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
        Py_DECREF(s);
        return result;
    }
    #endif
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(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_subtract(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_subtract(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("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(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(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    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(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* bytes_tailmatch */
static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
                                         Py_ssize_t start, Py_ssize_t end, int direction) {
    const char* self_ptr = PyBytes_AS_STRING(self);
    Py_ssize_t self_len = PyBytes_GET_SIZE(self);
    const char* sub_ptr;
    Py_ssize_t sub_len;
    int retval;
    Py_buffer view;
    view.obj = NULL;
    if ( PyBytes_Check(arg) ) {
        sub_ptr = PyBytes_AS_STRING(arg);
        sub_len = PyBytes_GET_SIZE(arg);
    }
#if PY_MAJOR_VERSION < 3
    else if ( PyUnicode_Check(arg) ) {
        return (int) PyUnicode_Tailmatch(self, arg, start, end, direction);
    }
#endif
    else {
        if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
            return -1;
        sub_ptr = (const char*) view.buf;
        sub_len = view.len;
    }
    if (end > self_len)
        end = self_len;
    else if (end < 0)
        end += self_len;
    if (end < 0)
        end = 0;
    if (start < 0)
        start += self_len;
    if (start < 0)
        start = 0;
    if (direction > 0) {
        if (end-sub_len > start)
            start = end - sub_len;
    }
    if (start + sub_len <= end)
        retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
    else
        retval = 0;
    if (view.obj)
        PyBuffer_Release(&view);
    return retval;
}
static int __Pyx_PyBytes_TailmatchTuple(PyObject* self, PyObject* substrings,
                                        Py_ssize_t start, Py_ssize_t end, int direction) {
    Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
    for (i = 0; i < count; i++) {
        int result;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substrings, i),
                                               start, end, direction);
#else
        PyObject* sub = PySequence_ITEM(substrings, i);
        if (unlikely(!sub)) return -1;
        result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction);
        Py_DECREF(sub);
#endif
        if (result) {
            return result;
        }
    }
    return 0;
}
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
                                   Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        return __Pyx_PyBytes_TailmatchTuple(self, substr, start, end, direction);
    }
    return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

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

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

/* CIntToDigits */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
#if CYTHON_PEP393_ENABLED
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
#else
    Py_UNICODE *udata;
    uval = PyUnicode_FromUnicode(NULL, ulength);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_AS_UNICODE(uval);
#endif
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp;
                    PyObject *repeat = PyInt_FromSize_t(uoffset - prepend_sign);
                    if (unlikely(!repeat)) goto done_or_error;
                    tmp = PyNumber_Multiply(padding, repeat);
                    Py_DECREF(repeat);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyNumber_Add(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyNumber_Add(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)*3+2];
    char *dpos, *end = digits + sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    if (last_one_off) {
        assert(*dpos == '0');
        dpos++;
    }
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* decode_c_bytes */
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
         const char* cstring, Py_ssize_t length, 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)) {
    if (unlikely((start < 0) | (stop < 0))) {
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (stop > length)
        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);
    }
}

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

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* IterNext */
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_Occurred();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    PyErr_Format(PyExc_TypeError,
        "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
    if (likely(iternext)) {
#if CYTHON_USE_TYPE_SLOTS
        next = iternext(iterator);
        if (likely(next))
            return next;
        #if PY_VERSION_HEX >= 0x02070000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
        #endif
#else
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
#endif
    } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    }
#if !CYTHON_USE_TYPE_SLOTS
    else {
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
    }
#endif
    return __Pyx_PyIter_Next2Default(defval);
}

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

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_long(long value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(long)*3+2];
    char *dpos, *end = digits + sizeof(long)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    long remaining;
#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 (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (long) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (long) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (long) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    if (last_one_off) {
        assert(*dpos == '0');
        dpos++;
    }
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* RaiseKeywordRequired */
static void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name) {
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() needs keyword-only argument %U", func_name, kw_name);
        #else
        "%s() needs keyword-only argument %s", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

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

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, 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 = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, 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 = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

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

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Coroutine */
static void __Pyx_CoroutineAwait_dealloc(PyObject *self) {
    PyObject_GC_UnTrack(self);
    Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine);
    PyObject_GC_Del(self);
}
static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) {
    Py_VISIT(self->coroutine);
    return 0;
}
static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) {
    Py_CLEAR(self->coroutine);
    return 0;
}
static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) {
    return __Pyx_Generator_Next(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) {
    return __Pyx_Coroutine_Send(self->coroutine, value);
}
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) {
    return __Pyx_Coroutine_Throw(self->coroutine, args);
}
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) {
    Py_INCREF(self);
    return self;
}
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_CoroutineAwait_no_new(CYTHON_UNUSED PyTypeObject *type, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwargs) {
    PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead");
    return NULL;
}
#endif
static PyMethodDef __pyx_CoroutineAwait_methods[] = {
    {"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_CoroutineAwait_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_CoroutineAwaitType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "coroutine_wrapper",
    sizeof(__pyx_CoroutineAwaitObject),
    0,
    (destructor) __Pyx_CoroutineAwait_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    PyDoc_STR("A wrapper object implementing __await__ for coroutines."),
    (traverseproc) __Pyx_CoroutineAwait_traverse,
    (inquiry) __Pyx_CoroutineAwait_clear,
    0,
    0,
    __Pyx_CoroutineAwait_self,
    (iternextfunc) __Pyx_CoroutineAwait_Next,
    __pyx_CoroutineAwait_methods,
    0                         ,
    0                      ,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if !CYTHON_COMPILING_IN_PYPY
    __Pyx_CoroutineAwait_no_new,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    0,
#endif
};
#if PY_VERSION_HEX < 0x030500B1 || defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS
static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) {
    __pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_CoroutineAwaitType);
    if (unlikely(!await)) return NULL;
    Py_INCREF(coroutine);
    await->coroutine = coroutine;
    PyObject_GC_Track(await);
    return (PyObject*)await;
}
#endif
#if PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_await_method(PyObject *coroutine, CYTHON_UNUSED PyObject *arg) {
    return __Pyx__Coroutine_await(coroutine);
}
#endif
#if defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
    if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) {
        PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine");
        return NULL;
    }
    return __Pyx__Coroutine_await(coroutine);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) {
    PyObject* result;
    switch (op) {
        case Py_EQ: result = (other == obj) ? Py_True : Py_False; break;
        case Py_NE: result = (other != obj) ? Py_True : Py_False; break;
        default:
            result = Py_NotImplemented;
    }
    Py_INCREF(result);
    return result;
}
#endif
static PyMethodDef __pyx_Coroutine_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1
    {"__await__", (PyCFunction) __Pyx_Coroutine_await_method, METH_NOARGS,
     (char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")},
#endif
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Coroutine_memberlist[] = {
    {(char *) "cr_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being awaited, or None")},
    {(char*) "cr_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Coroutine_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the coroutine"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the coroutine"), 0},
    {(char *) "cr_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the coroutine"), 0},
    {0, 0, 0, 0, 0}
};
#if CYTHON_USE_ASYNC_SLOTS
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = {
    __Pyx_Coroutine_await,
    0,
    0,
};
#endif
static PyTypeObject __pyx_CoroutineType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
#if CYTHON_USE_ASYNC_SLOTS
    &__pyx_Coroutine_as_async,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
    __Pyx_Coroutine_compare,
#else
    0,
#endif
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    0,
    __pyx_Coroutine_methods,
    __pyx_Coroutine_memberlist,
    __pyx_Coroutine_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif 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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    0,
#endif
};
static int __pyx_Coroutine_init(void) {
    __pyx_CoroutineType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_CoroutineType = __Pyx_FetchCommonType(&__pyx_CoroutineType_type);
    if (unlikely(!__pyx_CoroutineType))
        return -1;
#ifdef __Pyx_IterableCoroutine_USED
    if (unlikely(__pyx_IterableCoroutine_init() == -1))
        return -1;
#endif
    __pyx_CoroutineAwaitType = __Pyx_FetchCommonType(&__pyx_CoroutineAwaitType_type);
    if (unlikely(!__pyx_CoroutineAwaitType))
        return -1;
    return 0;
}

/* GetAwaitIter */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(o)) {
        return __Pyx_NewRef(o);
    }
#endif
    return __Pyx__Coroutine_GetAwaitableIter(o);
}
static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) {
#if PY_VERSION_HEX >= 0x030600B3 || defined(_PyErr_FormatFromCause)
    _PyErr_FormatFromCause(
        PyExc_TypeError,
        "'async for' received an invalid object "
        "from __anext__: %.100s",
        Py_TYPE(source)->tp_name);
#elif PY_MAJOR_VERSION >= 3
    PyObject *exc, *val, *val2, *tb;
    assert(PyErr_Occurred());
    PyErr_Fetch(&exc, &val, &tb);
    PyErr_NormalizeException(&exc, &val, &tb);
    if (tb != NULL) {
        PyException_SetTraceback(val, tb);
        Py_DECREF(tb);
    }
    Py_DECREF(exc);
    assert(!PyErr_Occurred());
    PyErr_Format(
        PyExc_TypeError,
        "'async for' received an invalid object "
        "from __anext__: %.100s",
        Py_TYPE(source)->tp_name);
    PyErr_Fetch(&exc, &val2, &tb);
    PyErr_NormalizeException(&exc, &val2, &tb);
    Py_INCREF(val);
    PyException_SetCause(val2, val);
    PyException_SetContext(val2, val);
    PyErr_Restore(exc, val2, tb);
#else
    source++;
#endif
}
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
    PyObject *res;
#if CYTHON_USE_ASYNC_SLOTS
    __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
    if (likely(am && am->am_await)) {
        res = (*am->am_await)(obj);
    } else
#endif
#if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
    if (PyCoro_CheckExact(obj)) {
        return __Pyx_NewRef(obj);
    } else
#endif
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
    if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) {
        return __Pyx_NewRef(obj);
    } else
#endif
    {
        PyObject *method = NULL;
        int is_method = __Pyx_PyObject_GetMethod(obj, __pyx_n_s_await, &method);
        if (likely(is_method)) {
            res = __Pyx_PyObject_CallOneArg(method, obj);
        } else if (likely(method)) {
            res = __Pyx_PyObject_CallNoArg(method);
        } else
            goto slot_error;
        Py_DECREF(method);
    }
    if (unlikely(!res)) {
        __Pyx_Coroutine_AwaitableIterError(obj);
        goto bad;
    }
    if (unlikely(!PyIter_Check(res))) {
        PyErr_Format(PyExc_TypeError,
                     "__await__() returned non-iterator of type '%.100s'",
                     Py_TYPE(res)->tp_name);
        Py_CLEAR(res);
    } else {
        int is_coroutine = 0;
        #ifdef __Pyx_Coroutine_USED
        is_coroutine |= __Pyx_Coroutine_Check(res);
        #endif
        #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
        is_coroutine |= PyCoro_CheckExact(res);
        #endif
        if (unlikely(is_coroutine)) {
            /* __await__ must return an *iterator*, not
               a coroutine or another awaitable (see PEP 492) */
            PyErr_SetString(PyExc_TypeError,
                            "__await__() returned a coroutine");
            Py_CLEAR(res);
        }
    }
    return res;
slot_error:
    PyErr_Format(PyExc_TypeError,
                 "object %.100s can't be used in 'await' expression",
                 Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* CoroutineYieldFrom */
static PyObject* __Pyx__Coroutine_Yield_From_Generic(__pyx_CoroutineObject *gen, PyObject *source) {
    PyObject *retval;
    PyObject *source_gen = __Pyx__Coroutine_GetAwaitableIter(source);
    if (unlikely(!source_gen)) {
        return NULL;
    }
    if (__Pyx_Coroutine_Check(source_gen)) {
        retval = __Pyx_Generator_Next(source_gen);
    } else {
#if CYTHON_USE_TYPE_SLOTS
        retval = Py_TYPE(source_gen)->tp_iternext(source_gen);
#else
        retval = PyIter_Next(source_gen);
#endif
    }
    if (retval) {
        gen->yieldfrom = source_gen;
        return retval;
    }
    Py_DECREF(source_gen);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) {
    PyObject *retval;
    if (__Pyx_Coroutine_Check(source)) {
        if (unlikely(((__pyx_CoroutineObject*)source)->yieldfrom)) {
            PyErr_SetString(
                PyExc_RuntimeError,
                "coroutine is being awaited already");
            return NULL;
        }
        retval = __Pyx_Generator_Next(source);
#ifdef __Pyx_AsyncGen_USED
    } else if (__pyx_PyAsyncGenASend_CheckExact(source)) {
        retval = __Pyx_async_gen_asend_iternext(source);
#endif
    } else {
        return __Pyx__Coroutine_Yield_From_Generic(gen, source);
    }
    if (retval) {
        Py_INCREF(source);
        gen->yieldfrom = source;
    }
    return retval;
}

/* ReturnWithStopIteration */
static void __Pyx__ReturnWithStopIteration(PyObject* value) {
    PyObject *exc, *args;
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_PYSTON
    __Pyx_PyThreadState_declare
    if ((PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030500B1)
            || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        args = PyTuple_New(1);
        if (unlikely(!args)) return;
        Py_INCREF(value);
        PyTuple_SET_ITEM(args, 0, value);
        exc = PyType_Type.tp_call(PyExc_StopIteration, args, NULL);
        Py_DECREF(args);
        if (!exc) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_type)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(PyExc_StopIteration);
        __Pyx_ErrRestore(PyExc_StopIteration, exc, NULL);
        return;
    }
    #endif
#else
    args = PyTuple_Pack(1, value);
    if (unlikely(!args)) return;
    exc = PyObject_Call(PyExc_StopIteration, args, NULL);
    Py_DECREF(args);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(PyExc_StopIteration, exc);
    Py_DECREF(exc);
}

/* 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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    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;
}

/* AsyncIter */
static PyObject *__Pyx_Coroutine_GetAsyncIter_Generic(PyObject *obj) {
#if PY_VERSION_HEX < 0x030500B1
    {
        PyObject *iter = __Pyx_PyObject_CallMethod0(obj, __pyx_n_s_aiter);
        if (likely(iter))
            return iter;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            return NULL;
    }
#else
    if ((0)) (void) __Pyx_PyObject_CallMethod0(obj, __pyx_n_s_aiter);
#endif
    PyErr_Format(PyExc_TypeError, "'async for' requires an object with __aiter__ method, got %.100s",
                 Py_TYPE(obj)->tp_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *obj) {
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(obj)) {
        return __Pyx_NewRef(obj);
    }
#endif
#if CYTHON_USE_ASYNC_SLOTS
    {
        __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
        if (likely(am && am->am_aiter)) {
            return (*am->am_aiter)(obj);
        }
    }
#endif
    return __Pyx_Coroutine_GetAsyncIter_Generic(obj);
}
static PyObject *__Pyx__Coroutine_AsyncIterNext(PyObject *obj) {
#if PY_VERSION_HEX < 0x030500B1
    {
        PyObject *value = __Pyx_PyObject_CallMethod0(obj, __pyx_n_s_anext);
        if (likely(value))
            return value;
    }
    if (PyErr_ExceptionMatches(PyExc_AttributeError))
#endif
        PyErr_Format(PyExc_TypeError, "'async for' requires an object with __anext__ method, got %.100s",
                     Py_TYPE(obj)->tp_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *obj) {
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(obj)) {
        return __Pyx_async_gen_anext(obj);
    }
#endif
#if CYTHON_USE_ASYNC_SLOTS
    {
        __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
        if (likely(am && am->am_anext)) {
            return (*am->am_anext)(obj);
        }
    }
#endif
    return __Pyx__Coroutine_AsyncIterNext(obj);
}

/* StopAsyncIteration */
#if PY_VERSION_HEX < 0x030500B1
static PyTypeObject __Pyx__PyExc_StopAsyncIteration_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "StopAsyncIteration",
    sizeof(PyBaseExceptionObject),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
    PyDoc_STR("Signal the end from iterator.__anext__()."),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    0,
#endif
};
#endif
static int __pyx_StopAsyncIteration_init(void) {
#if PY_VERSION_HEX >= 0x030500B1
    __Pyx_PyExc_StopAsyncIteration = PyExc_StopAsyncIteration;
#else
    PyObject *builtins = PyEval_GetBuiltins();
    if (likely(builtins)) {
        PyObject *exc = PyMapping_GetItemString(builtins, (char*) "StopAsyncIteration");
        if (exc) {
            __Pyx_PyExc_StopAsyncIteration = exc;
            return 0;
        }
    }
    PyErr_Clear();
    __Pyx__PyExc_StopAsyncIteration_type.tp_traverse = ((PyTypeObject*)PyExc_BaseException)->tp_traverse;
    __Pyx__PyExc_StopAsyncIteration_type.tp_clear = ((PyTypeObject*)PyExc_BaseException)->tp_clear;
    __Pyx__PyExc_StopAsyncIteration_type.tp_dictoffset = ((PyTypeObject*)PyExc_BaseException)->tp_dictoffset;
    __Pyx__PyExc_StopAsyncIteration_type.tp_base = (PyTypeObject*)PyExc_Exception;
    __Pyx_PyExc_StopAsyncIteration = (PyObject*) __Pyx_FetchCommonType(&__Pyx__PyExc_StopAsyncIteration_type);
    if (unlikely(!__Pyx_PyExc_StopAsyncIteration))
        return -1;
    if (builtins && unlikely(PyMapping_SetItemString(builtins, (char*) "StopAsyncIteration", __Pyx_PyExc_StopAsyncIteration) < 0))
        return -1;
#endif
    return 0;
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_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;
}

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

/* CallNextTpDealloc */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_dealloc != current_tp_dealloc)
        type = type->tp_base;
    while (type && type->tp_dealloc == current_tp_dealloc)
        type = type->tp_base;
    if (type)
        type->tp_dealloc(obj);
}

/* CallNextTpTraverse */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_traverse != current_tp_traverse)
        type = type->tp_base;
    while (type && type->tp_traverse == current_tp_traverse)
        type = type->tp_base;
    if (type && type->tp_traverse)
        return type->tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_clear != current_tp_clear)
        type = type->tp_base;
    while (type && type->tp_clear == current_tp_clear)
        type = type->tp_base;
    if (type && type->tp_clear)
        type->tp_clear(obj);
}

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

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

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

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

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

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

/* 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;\
    }

/* UnicodeAsUCS4 */
static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
   Py_ssize_t length;
   #if CYTHON_PEP393_ENABLED
   length = PyUnicode_GET_LENGTH(x);
   if (likely(length == 1)) {
       return PyUnicode_READ_CHAR(x, 0);
   }
   #else
   length = PyUnicode_GET_SIZE(x);
   if (likely(length == 1)) {
       return PyUnicode_AS_UNICODE(x)[0];
   }
   #if Py_UNICODE_SIZE == 2
   else if (PyUnicode_GET_SIZE(x) == 2) {
       Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
       if (high_val >= 0xD800 && high_val <= 0xDBFF) {
           Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
           if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
               return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
           }
       }
   }
   #endif
   #endif
   PyErr_Format(PyExc_ValueError,
                "only single character unicode strings can be converted to Py_UCS4, "
                "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
   return (Py_UCS4)-1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_AuthenticationMessage),
                                     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);
    }
}

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

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ConnectionStatus) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ResultType(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ResultType) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ProtocolState(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) (((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_TransactionStatus) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_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(uint64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_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(uint64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
                            return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
                            return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
                            return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (uint64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint64_t) -1;
        }
    } else {
        uint64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint64_t) -1;
        val = __Pyx_PyInt_As_uint64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint64_t");
    return (uint64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint64_t");
    return (uint64_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE 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;
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ServerDataFormat),
                                     little, !is_unsigned);
    }
}

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

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

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_7asyncpg_8protocol_8protocol_CodecType(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_CodecType),
                                     little, !is_unsigned);
    }
}

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

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

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

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat neg_one = (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1, const_zero = (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) >= 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) >= 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) >= 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)-1)*(((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 2 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) ((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)-1)*(((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 3 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) ((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) (((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)-1)*(((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, 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(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) - 1 > 4 * PyLong_SHIFT) {
                            return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) ((((((((((enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat, 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
            enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat 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 (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1;
        }
    } else {
        enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1;
        val = __Pyx_PyInt_As_enum____pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat");
    return (enum __pyx_t_7asyncpg_8protocol_8protocol_ClientExchangeFormat) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_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(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_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(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const ptrdiff_t neg_one = (ptrdiff_t) -1, const_zero = (ptrdiff_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(ptrdiff_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(ptrdiff_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(ptrdiff_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(ptrdiff_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const char neg_one = (char) -1, const_zero = (char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= 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(char),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int16_t(int16_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int16_t neg_one = (int16_t) -1, const_zero = (int16_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(int16_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int16_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int16_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(int16_t),
                                     little, !is_unsigned);
    }
}

/* ObjectAsUCS4 */
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
   if (ival < 0) {
       if (!PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "cannot convert negative value to Py_UCS4");
   } else {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to Py_UCS4");
   }
   return (Py_UCS4)-1;
}
static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
   long ival;
   ival = __Pyx_PyInt_As_long(x);
   if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
       return __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
   }
   return (Py_UCS4)ival;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif 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 CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* IterableCoroutine */
static PyTypeObject __pyx_IterableCoroutineType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "iterable_coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
#if CYTHON_USE_ASYNC_SLOTS
    &__pyx_Coroutine_as_async,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
    __Pyx_Coroutine_compare,
#else
    0,
#endif
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    __Pyx_Coroutine_await,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Coroutine_methods,
    __pyx_Coroutine_memberlist,
    __pyx_Coroutine_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Coroutine_del,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
    0,
#endif
};
static int __pyx_IterableCoroutine_init(void) {
    __pyx_IterableCoroutineType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_IterableCoroutineType = __Pyx_FetchCommonType(&__pyx_IterableCoroutineType_type);
    if (unlikely(!__pyx_IterableCoroutineType))
        return -1;
    return 0;
}

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

/* VoidPtrExport */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) {
    PyObject *d;
    PyObject *cobj = 0;
    d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi);
    Py_XINCREF(d);
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0)
            goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItem(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        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 */
