/* Generated by Cython 0.29.15 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_15"
#define CYTHON_HEX_VERSION 0x001D0FF0
#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
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #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
  #include "longintrepr.h"
  #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 __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#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"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#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
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#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
  #define PyObject_Unicode             PyObject_Str
#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 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   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), 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_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; 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__pyarrow___flight
#define __PYX_HAVE_API__pyarrow___flight
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include "datetime.h"

    #include <type_traits>
    #include <utility>
    namespace cymove {
    template <typename T>
    inline typename std::remove_reference<T>::type&& cymove(T& t) {
        return std::move(t);
    }
    template <typename T>
    inline typename std::remove_reference<T>::type&& cymove(T&& t) {
        return std::move(t);
    }
    }  // namespace cymove
    
#include "arrow/python/platform.h"
#include <Python.h>
#include "numpy/halffloat.h"
#include "arrow/api.h"
#include "arrow/result.h"
#include "arrow/python/common.h"
#include "arrow/util/key_value_metadata.h"
#include "arrow/builder.h"
#include "arrow/io/api.h"
#include "arrow/ipc/api.h"
#include "arrow/csv/api.h"
#include "arrow/json/options.h"
#include "arrow/json/reader.h"
#include "arrow/compute/api.h"
#include "arrow/python/api.h"
#include "arrow/python/init.h"
#include "arrow/python/pyarrow.h"
#include "arrow/python/config.h"
#include "arrow/python/inference.h"
#include "arrow/extension_type.h"
#include "arrow/python/extension_type.h"
#include "arrow/python/benchmark.h"
#include "arrow/util/compression.h"
#include "arrow/util/io_util.h"
#include "arrow/util/iterator.h"
#include "arrow/util/thread_pool.h"
#include "arrow/array/concatenate.h"
#include <functional>
#include "arrow/flight/api.h"
#include "arrow/python/flight.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);
#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[] = {
  "pyarrow\\_flight.pyx",
  "stringsource",
  "datetime.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "pyarrow\\lib.pxd",
};
/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()


/*--- Type declarations ---*/
struct __pyx_obj_7pyarrow_3lib_Message;
struct __pyx_obj_7pyarrow_3lib_MemoryPool;
struct __pyx_obj_7pyarrow_3lib_DataType;
struct __pyx_obj_7pyarrow_3lib_ListType;
struct __pyx_obj_7pyarrow_3lib_LargeListType;
struct __pyx_obj_7pyarrow_3lib_MapType;
struct __pyx_obj_7pyarrow_3lib_FixedSizeListType;
struct __pyx_obj_7pyarrow_3lib_StructType;
struct __pyx_obj_7pyarrow_3lib_DictionaryMemo;
struct __pyx_obj_7pyarrow_3lib_DictionaryType;
struct __pyx_obj_7pyarrow_3lib_TimestampType;
struct __pyx_obj_7pyarrow_3lib_Time32Type;
struct __pyx_obj_7pyarrow_3lib_Time64Type;
struct __pyx_obj_7pyarrow_3lib_DurationType;
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryType;
struct __pyx_obj_7pyarrow_3lib_Decimal128Type;
struct __pyx_obj_7pyarrow_3lib_BaseExtensionType;
struct __pyx_obj_7pyarrow_3lib_ExtensionType;
struct __pyx_obj_7pyarrow_3lib_PyExtensionType;
struct __pyx_obj_7pyarrow_3lib_Field;
struct __pyx_obj_7pyarrow_3lib_Schema;
struct __pyx_obj_7pyarrow_3lib_Scalar;
struct __pyx_obj_7pyarrow_3lib_NAType;
struct __pyx_obj_7pyarrow_3lib_ArrayValue;
struct __pyx_obj_7pyarrow_3lib_ScalarValue;
struct __pyx_obj_7pyarrow_3lib_Int8Value;
struct __pyx_obj_7pyarrow_3lib_Int64Value;
struct __pyx_obj_7pyarrow_3lib_ListValue;
struct __pyx_obj_7pyarrow_3lib_LargeListValue;
struct __pyx_obj_7pyarrow_3lib_MapValue;
struct __pyx_obj_7pyarrow_3lib_FixedSizeListValue;
struct __pyx_obj_7pyarrow_3lib_StructValue;
struct __pyx_obj_7pyarrow_3lib_UnionValue;
struct __pyx_obj_7pyarrow_3lib_StringValue;
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryValue;
struct __pyx_obj_7pyarrow_3lib__PandasConvertible;
struct __pyx_obj_7pyarrow_3lib_Array;
struct __pyx_obj_7pyarrow_3lib_Tensor;
struct __pyx_obj_7pyarrow_3lib_SparseCSRMatrix;
struct __pyx_obj_7pyarrow_3lib_SparseCOOTensor;
struct __pyx_obj_7pyarrow_3lib_NullArray;
struct __pyx_obj_7pyarrow_3lib_BooleanArray;
struct __pyx_obj_7pyarrow_3lib_NumericArray;
struct __pyx_obj_7pyarrow_3lib_IntegerArray;
struct __pyx_obj_7pyarrow_3lib_FloatingPointArray;
struct __pyx_obj_7pyarrow_3lib_Int8Array;
struct __pyx_obj_7pyarrow_3lib_UInt8Array;
struct __pyx_obj_7pyarrow_3lib_Int16Array;
struct __pyx_obj_7pyarrow_3lib_UInt16Array;
struct __pyx_obj_7pyarrow_3lib_Int32Array;
struct __pyx_obj_7pyarrow_3lib_UInt32Array;
struct __pyx_obj_7pyarrow_3lib_Int64Array;
struct __pyx_obj_7pyarrow_3lib_UInt64Array;
struct __pyx_obj_7pyarrow_3lib_HalfFloatArray;
struct __pyx_obj_7pyarrow_3lib_FloatArray;
struct __pyx_obj_7pyarrow_3lib_DoubleArray;
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryArray;
struct __pyx_obj_7pyarrow_3lib_Decimal128Array;
struct __pyx_obj_7pyarrow_3lib_StructArray;
struct __pyx_obj_7pyarrow_3lib_ListArray;
struct __pyx_obj_7pyarrow_3lib_LargeListArray;
struct __pyx_obj_7pyarrow_3lib_MapArray;
struct __pyx_obj_7pyarrow_3lib_FixedSizeListArray;
struct __pyx_obj_7pyarrow_3lib_UnionArray;
struct __pyx_obj_7pyarrow_3lib_StringArray;
struct __pyx_obj_7pyarrow_3lib_BinaryArray;
struct __pyx_obj_7pyarrow_3lib_DictionaryArray;
struct __pyx_obj_7pyarrow_3lib_ExtensionArray;
struct __pyx_obj_7pyarrow_3lib_ChunkedArray;
struct __pyx_obj_7pyarrow_3lib_Table;
struct __pyx_obj_7pyarrow_3lib_RecordBatch;
struct __pyx_obj_7pyarrow_3lib_Buffer;
struct __pyx_obj_7pyarrow_3lib_ResizableBuffer;
struct __pyx_obj_7pyarrow_3lib_NativeFile;
struct __pyx_obj_7pyarrow_3lib_BufferedInputStream;
struct __pyx_obj_7pyarrow_3lib_BufferedOutputStream;
struct __pyx_obj_7pyarrow_3lib_CompressedInputStream;
struct __pyx_obj_7pyarrow_3lib_CompressedOutputStream;
struct __pyx_obj_7pyarrow_3lib__CRecordBatchWriter;
struct __pyx_obj_7pyarrow_3lib__CRecordBatchReader;
struct __pyx_obj_7pyarrow_3lib_CastOptions;
struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions;
struct __pyx_obj_7pyarrow_7_flight_FlightError;
struct __pyx_obj_7pyarrow_7_flight_FlightInternalError;
struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError;
struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError;
struct __pyx_obj_7pyarrow_7_flight_FlightServerError;
struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError;
struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError;
struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError;
struct __pyx_obj_7pyarrow_7_flight_Action;
struct __pyx_obj_7pyarrow_7_flight_Result;
struct __pyx_obj_7pyarrow_7_flight_BasicAuth;
struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor;
struct __pyx_obj_7pyarrow_7_flight_Ticket;
struct __pyx_obj_7pyarrow_7_flight_Location;
struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint;
struct __pyx_obj_7pyarrow_7_flight_SchemaResult;
struct __pyx_obj_7pyarrow_7_flight_FlightInfo;
struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk;
struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader;
struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader;
struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader;
struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter;
struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader;
struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter;
struct __pyx_obj_7pyarrow_7_flight_FlightClient;
struct __pyx_obj_7pyarrow_7_flight_FlightDataStream;
struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream;
struct __pyx_obj_7pyarrow_7_flight_GeneratorStream;
struct __pyx_obj_7pyarrow_7_flight_ServerCallContext;
struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader;
struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender;
struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader;
struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender;
struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler;
struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler;
struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory;
struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware;
struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory;
struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware;
struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper;
struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper;
struct __pyx_obj_7pyarrow_7_flight_FlightServerBase;
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__;
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action;
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights;
struct __pyx_opt_args_7pyarrow_3lib_ensure_type;

/* "pyarrow/lib.pxd":553
 * 
 * # Default is allow_none=False
 * cdef DataType ensure_type(object type, c_bool allow_none=*)             # <<<<<<<<<<<<<<
 * 
 * cdef shared_ptr[CKeyValueMetadata] pyarrow_unwrap_metadata(object meta)
 */
struct __pyx_opt_args_7pyarrow_3lib_ensure_type {
  int __pyx_n;
  bool allow_none;
};

/* "pyarrow/includes/libarrow_flight.pxd":335
 * # Callbacks for implementing Flight servers
 * # Use typedef to emulate syntax for std::function<void(..)>
 * ctypedef CStatus cb_list_flights(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                                  const CCriteria*,
 *                                  unique_ptr[CFlightListing]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_list_flights(PyObject *,  arrow::flight::ServerCallContext const &,  arrow::flight::Criteria const *, std::unique_ptr< arrow::flight::FlightListing>  *);

/* "pyarrow/includes/libarrow_flight.pxd":338
 *                                  const CCriteria*,
 *                                  unique_ptr[CFlightListing]*)
 * ctypedef CStatus cb_get_flight_info(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                                     const CFlightDescriptor&,
 *                                     unique_ptr[CFlightInfo]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_flight_info(PyObject *,  arrow::flight::ServerCallContext const &,  arrow::flight::FlightDescriptor const &, std::unique_ptr< arrow::flight::FlightInfo>  *);

/* "pyarrow/includes/libarrow_flight.pxd":341
 *                                     const CFlightDescriptor&,
 *                                     unique_ptr[CFlightInfo]*)
 * ctypedef CStatus cb_get_schema(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                                const CFlightDescriptor&,
 *                                unique_ptr[CSchemaResult]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_schema(PyObject *,  arrow::flight::ServerCallContext const &,  arrow::flight::FlightDescriptor const &, std::unique_ptr< arrow::flight::SchemaResult>  *);

/* "pyarrow/includes/libarrow_flight.pxd":344
 *                                const CFlightDescriptor&,
 *                                unique_ptr[CSchemaResult]*)
 * ctypedef CStatus cb_do_put(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                            unique_ptr[CFlightMessageReader],
 *                            unique_ptr[CFlightMetadataWriter])
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_put(PyObject *,  arrow::flight::ServerCallContext const &, std::unique_ptr< arrow::flight::FlightMessageReader> , std::unique_ptr< arrow::flight::FlightMetadataWriter> );

/* "pyarrow/includes/libarrow_flight.pxd":347
 *                            unique_ptr[CFlightMessageReader],
 *                            unique_ptr[CFlightMetadataWriter])
 * ctypedef CStatus cb_do_get(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                            const CTicket&,
 *                            unique_ptr[CFlightDataStream]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_get(PyObject *,  arrow::flight::ServerCallContext const &,  arrow::flight::Ticket const &, std::unique_ptr< arrow::flight::FlightDataStream>  *);

/* "pyarrow/includes/libarrow_flight.pxd":350
 *                            const CTicket&,
 *                            unique_ptr[CFlightDataStream]*)
 * ctypedef CStatus cb_do_action(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                               const CAction&,
 *                               unique_ptr[CResultStream]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_action(PyObject *,  arrow::flight::ServerCallContext const &,  arrow::flight::Action const &, std::unique_ptr< arrow::flight::ResultStream>  *);

/* "pyarrow/includes/libarrow_flight.pxd":353
 *                               const CAction&,
 *                               unique_ptr[CResultStream]*)
 * ctypedef CStatus cb_list_actions(object, const CServerCallContext&,             # <<<<<<<<<<<<<<
 *                                  vector[CActionType]*)
 * ctypedef CStatus cb_result_next(object, unique_ptr[CFlightResult]*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_list_actions(PyObject *,  arrow::flight::ServerCallContext const &, std::vector< arrow::flight::ActionType>  *);

/* "pyarrow/includes/libarrow_flight.pxd":355
 * ctypedef CStatus cb_list_actions(object, const CServerCallContext&,
 *                                  vector[CActionType]*)
 * ctypedef CStatus cb_result_next(object, unique_ptr[CFlightResult]*)             # <<<<<<<<<<<<<<
 * ctypedef CStatus cb_data_stream_next(object, CFlightPayload*)
 * ctypedef CStatus cb_server_authenticate(object, CServerAuthSender*,
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_result_next(PyObject *, std::unique_ptr< arrow::flight::Result>  *);

/* "pyarrow/includes/libarrow_flight.pxd":356
 *                                  vector[CActionType]*)
 * ctypedef CStatus cb_result_next(object, unique_ptr[CFlightResult]*)
 * ctypedef CStatus cb_data_stream_next(object, CFlightPayload*)             # <<<<<<<<<<<<<<
 * ctypedef CStatus cb_server_authenticate(object, CServerAuthSender*,
 *                                         CServerAuthReader*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_data_stream_next(PyObject *,  arrow::flight::FlightPayload *);

/* "pyarrow/includes/libarrow_flight.pxd":357
 * ctypedef CStatus cb_result_next(object, unique_ptr[CFlightResult]*)
 * ctypedef CStatus cb_data_stream_next(object, CFlightPayload*)
 * ctypedef CStatus cb_server_authenticate(object, CServerAuthSender*,             # <<<<<<<<<<<<<<
 *                                         CServerAuthReader*)
 * ctypedef CStatus cb_is_valid(object, const c_string&, c_string*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_server_authenticate(PyObject *,  arrow::flight::ServerAuthSender *,  arrow::flight::ServerAuthReader *);

/* "pyarrow/includes/libarrow_flight.pxd":359
 * ctypedef CStatus cb_server_authenticate(object, CServerAuthSender*,
 *                                         CServerAuthReader*)
 * ctypedef CStatus cb_is_valid(object, const c_string&, c_string*)             # <<<<<<<<<<<<<<
 * ctypedef CStatus cb_client_authenticate(object, CClientAuthSender*,
 *                                         CClientAuthReader*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_is_valid(PyObject *, std::string const &, std::string *);

/* "pyarrow/includes/libarrow_flight.pxd":360
 *                                         CServerAuthReader*)
 * ctypedef CStatus cb_is_valid(object, const c_string&, c_string*)
 * ctypedef CStatus cb_client_authenticate(object, CClientAuthSender*,             # <<<<<<<<<<<<<<
 *                                         CClientAuthReader*)
 * ctypedef CStatus cb_get_token(object, c_string*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_authenticate(PyObject *,  arrow::flight::ClientAuthSender *,  arrow::flight::ClientAuthReader *);

/* "pyarrow/includes/libarrow_flight.pxd":362
 * ctypedef CStatus cb_client_authenticate(object, CClientAuthSender*,
 *                                         CClientAuthReader*)
 * ctypedef CStatus cb_get_token(object, c_string*)             # <<<<<<<<<<<<<<
 * 
 * ctypedef CStatus cb_middleware_sending_headers(object, CAddCallHeaders*)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_token(PyObject *, std::string *);

/* "pyarrow/includes/libarrow_flight.pxd":364
 * ctypedef CStatus cb_get_token(object, c_string*)
 * 
 * ctypedef CStatus cb_middleware_sending_headers(object, CAddCallHeaders*)             # <<<<<<<<<<<<<<
 * ctypedef CStatus cb_middleware_call_completed(object, const CStatus&)
 * ctypedef CStatus cb_client_middleware_received_headers(
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_sending_headers(PyObject *,  arrow::flight::AddCallHeaders *);

/* "pyarrow/includes/libarrow_flight.pxd":365
 * 
 * ctypedef CStatus cb_middleware_sending_headers(object, CAddCallHeaders*)
 * ctypedef CStatus cb_middleware_call_completed(object, const CStatus&)             # <<<<<<<<<<<<<<
 * ctypedef CStatus cb_client_middleware_received_headers(
 *     object, const CCallHeaders&)
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_call_completed(PyObject *, arrow::Status const &);

/* "pyarrow/includes/libarrow_flight.pxd":366
 * ctypedef CStatus cb_middleware_sending_headers(object, CAddCallHeaders*)
 * ctypedef CStatus cb_middleware_call_completed(object, const CStatus&)
 * ctypedef CStatus cb_client_middleware_received_headers(             # <<<<<<<<<<<<<<
 *     object, const CCallHeaders&)
 * ctypedef CStatus cb_server_middleware_start_call(
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_middleware_received_headers(PyObject *,  arrow::flight::CallHeaders const &);

/* "pyarrow/includes/libarrow_flight.pxd":368
 * ctypedef CStatus cb_client_middleware_received_headers(
 *     object, const CCallHeaders&)
 * ctypedef CStatus cb_server_middleware_start_call(             # <<<<<<<<<<<<<<
 *     object,
 *     const CCallInfo&,
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_server_middleware_start_call(PyObject *,  arrow::flight::CallInfo const &,  arrow::flight::CallHeaders const &, std::shared_ptr< arrow::flight::ServerMiddleware>  *);

/* "pyarrow/includes/libarrow_flight.pxd":373
 *     const CCallHeaders&,
 *     shared_ptr[CServerMiddleware]*)
 * ctypedef CStatus cb_client_middleware_start_call(             # <<<<<<<<<<<<<<
 *     object,
 *     const CCallInfo&,
 */
typedef arrow::Status __pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_middleware_start_call(PyObject *,  arrow::flight::CallInfo const &, std::unique_ptr< arrow::flight::ClientMiddleware>  *);

/* "pyarrow/lib.pxd":36
 * cdef int check_status(const CStatus& status) nogil except -1
 * 
 * cdef class Message:             # <<<<<<<<<<<<<<
 *     cdef:
 *         unique_ptr[CMessage] message
 */
struct __pyx_obj_7pyarrow_3lib_Message {
  PyObject_HEAD
  std::unique_ptr< arrow::ipc::Message>  message;
};


/* "pyarrow/lib.pxd":41
 * 
 * 
 * cdef class MemoryPool:             # <<<<<<<<<<<<<<
 *     cdef:
 *         CMemoryPool* pool
 */
struct __pyx_obj_7pyarrow_3lib_MemoryPool {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_MemoryPool *__pyx_vtab;
   arrow::MemoryPool *pool;
};


/* "pyarrow/lib.pxd":51
 * 
 * 
 * cdef class DataType:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CDataType] sp_type
 */
struct __pyx_obj_7pyarrow_3lib_DataType {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType *__pyx_vtab;
  std::shared_ptr< arrow::DataType>  sp_type;
   arrow::DataType *type;
  PyObject *pep3118_format;
  PyObject *__weakref__;
};


/* "pyarrow/lib.pxd":62
 * 
 * 
 * cdef class ListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CListType* list_type
 */
struct __pyx_obj_7pyarrow_3lib_ListType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::ListType const *list_type;
};


/* "pyarrow/lib.pxd":67
 * 
 * 
 * cdef class LargeListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CLargeListType* list_type
 */
struct __pyx_obj_7pyarrow_3lib_LargeListType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::LargeListType const *list_type;
};


/* "pyarrow/lib.pxd":72
 * 
 * 
 * cdef class MapType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CMapType* map_type
 */
struct __pyx_obj_7pyarrow_3lib_MapType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::MapType const *map_type;
};


/* "pyarrow/lib.pxd":77
 * 
 * 
 * cdef class FixedSizeListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CFixedSizeListType* list_type
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeListType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::FixedSizeListType const *list_type;
};


/* "pyarrow/lib.pxd":82
 * 
 * 
 * cdef class StructType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CStructType* struct_type
 */
struct __pyx_obj_7pyarrow_3lib_StructType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::StructType const *struct_type;
};


/* "pyarrow/lib.pxd":90
 * 
 * 
 * cdef class DictionaryMemo:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # Even though the CDictionaryMemo instance is private, we allocate
 */
struct __pyx_obj_7pyarrow_3lib_DictionaryMemo {
  PyObject_HEAD
  std::shared_ptr< arrow::ipc::DictionaryMemo>  sp_memo;
   arrow::ipc::DictionaryMemo *memo;
};


/* "pyarrow/lib.pxd":98
 * 
 * 
 * cdef class DictionaryType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDictionaryType* dict_type
 */
struct __pyx_obj_7pyarrow_3lib_DictionaryType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::DictionaryType const *dict_type;
};


/* "pyarrow/lib.pxd":103
 * 
 * 
 * cdef class TimestampType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTimestampType* ts_type
 */
struct __pyx_obj_7pyarrow_3lib_TimestampType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::TimestampType const *ts_type;
};


/* "pyarrow/lib.pxd":108
 * 
 * 
 * cdef class Time32Type(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTime32Type* time_type
 */
struct __pyx_obj_7pyarrow_3lib_Time32Type {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::Time32Type const *time_type;
};


/* "pyarrow/lib.pxd":113
 * 
 * 
 * cdef class Time64Type(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTime64Type* time_type
 */
struct __pyx_obj_7pyarrow_3lib_Time64Type {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::Time64Type const *time_type;
};


/* "pyarrow/lib.pxd":118
 * 
 * 
 * cdef class DurationType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDurationType* duration_type
 */
struct __pyx_obj_7pyarrow_3lib_DurationType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::DurationType const *duration_type;
};


/* "pyarrow/lib.pxd":123
 * 
 * 
 * cdef class FixedSizeBinaryType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CFixedSizeBinaryType* fixed_size_binary_type
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::FixedSizeBinaryType const *fixed_size_binary_type;
};


/* "pyarrow/lib.pxd":128
 * 
 * 
 * cdef class Decimal128Type(FixedSizeBinaryType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDecimal128Type* decimal128_type
 */
struct __pyx_obj_7pyarrow_3lib_Decimal128Type {
  struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryType __pyx_base;
   arrow::Decimal128Type const *decimal128_type;
};


/* "pyarrow/lib.pxd":133
 * 
 * 
 * cdef class BaseExtensionType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CExtensionType* ext_type
 */
struct __pyx_obj_7pyarrow_3lib_BaseExtensionType {
  struct __pyx_obj_7pyarrow_3lib_DataType __pyx_base;
   arrow::ExtensionType const *ext_type;
};


/* "pyarrow/lib.pxd":138
 * 
 * 
 * cdef class ExtensionType(BaseExtensionType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CPyExtensionType* cpy_ext_type
 */
struct __pyx_obj_7pyarrow_3lib_ExtensionType {
  struct __pyx_obj_7pyarrow_3lib_BaseExtensionType __pyx_base;
   arrow::py::PyExtensionType const *cpy_ext_type;
};


/* "pyarrow/lib.pxd":143
 * 
 * 
 * cdef class PyExtensionType(ExtensionType):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_PyExtensionType {
  struct __pyx_obj_7pyarrow_3lib_ExtensionType __pyx_base;
};


/* "pyarrow/lib.pxd":147
 * 
 * 
 * cdef class Field:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CField] sp_field
 */
struct __pyx_obj_7pyarrow_3lib_Field {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_Field *__pyx_vtab;
  std::shared_ptr< arrow::Field>  sp_field;
   arrow::Field *field;
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
};


/* "pyarrow/lib.pxd":158
 * 
 * 
 * cdef class Schema:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSchema] sp_schema
 */
struct __pyx_obj_7pyarrow_3lib_Schema {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_Schema *__pyx_vtab;
  std::shared_ptr< arrow::Schema>  sp_schema;
   arrow::Schema *schema;
};


/* "pyarrow/lib.pxd":167
 * 
 * 
 * cdef class Scalar:             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType type
 */
struct __pyx_obj_7pyarrow_3lib_Scalar {
  PyObject_HEAD
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
};


/* "pyarrow/lib.pxd":172
 * 
 * 
 * cdef class NAType(Scalar):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_NAType {
  struct __pyx_obj_7pyarrow_3lib_Scalar __pyx_base;
};


/* "pyarrow/lib.pxd":176
 * 
 * 
 * cdef class ArrayValue(Scalar):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CArray] sp_array
 */
struct __pyx_obj_7pyarrow_3lib_ArrayValue {
  struct __pyx_obj_7pyarrow_3lib_Scalar __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue *__pyx_vtab;
  std::shared_ptr< arrow::Array>  sp_array;
  int64_t index;
};


/* "pyarrow/lib.pxd":186
 *     cdef void _set_array(self, const shared_ptr[CArray]& sp_array)
 * 
 * cdef class ScalarValue(Scalar):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CScalar] sp_scalar
 */
struct __pyx_obj_7pyarrow_3lib_ScalarValue {
  struct __pyx_obj_7pyarrow_3lib_Scalar __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_ScalarValue *__pyx_vtab;
  std::shared_ptr< arrow::Scalar>  sp_scalar;
};


/* "pyarrow/lib.pxd":192
 *     cdef void init(self, const shared_ptr[CScalar]& sp_scalar)
 * 
 * cdef class Int8Value(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int8Value {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
};


/* "pyarrow/lib.pxd":196
 * 
 * 
 * cdef class Int64Value(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int64Value {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
};


/* "pyarrow/lib.pxd":200
 * 
 * 
 * cdef class ListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */
struct __pyx_obj_7pyarrow_3lib_ListValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
  struct __pyx_obj_7pyarrow_3lib_DataType *value_type;
   arrow::ListArray *ap;
};


/* "pyarrow/lib.pxd":211
 * 
 * 
 * cdef class LargeListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */
struct __pyx_obj_7pyarrow_3lib_LargeListValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
  struct __pyx_obj_7pyarrow_3lib_DataType *value_type;
   arrow::LargeListArray *ap;
};


/* "pyarrow/lib.pxd":222
 * 
 * 
 * cdef class MapValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType key_type
 */
struct __pyx_obj_7pyarrow_3lib_MapValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
  struct __pyx_obj_7pyarrow_3lib_DataType *key_type;
  struct __pyx_obj_7pyarrow_3lib_DataType *item_type;
   arrow::MapArray *ap;
};


/* "pyarrow/lib.pxd":234
 * 
 * 
 * cdef class FixedSizeListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeListValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
  struct __pyx_obj_7pyarrow_3lib_DataType *value_type;
   arrow::FixedSizeListArray *ap;
};


/* "pyarrow/lib.pxd":245
 * 
 * 
 * cdef class StructValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CStructArray* ap
 */
struct __pyx_obj_7pyarrow_3lib_StructValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
   arrow::StructArray *ap;
};


/* "pyarrow/lib.pxd":250
 * 
 * 
 * cdef class UnionValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CUnionArray* ap
 */
struct __pyx_obj_7pyarrow_3lib_UnionValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
   arrow::UnionArray *ap;
  PyObject *value_types;
};


/* "pyarrow/lib.pxd":258
 * 
 * 
 * cdef class StringValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_StringValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
};


/* "pyarrow/lib.pxd":262
 * 
 * 
 * cdef class FixedSizeBinaryValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryValue {
  struct __pyx_obj_7pyarrow_3lib_ArrayValue __pyx_base;
};


/* "pyarrow/lib.pxd":266
 * 
 * 
 * cdef class _PandasConvertible:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib__PandasConvertible {
  PyObject_HEAD
};


/* "pyarrow/lib.pxd":270
 * 
 * 
 * cdef class Array(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CArray] sp_array
 */
struct __pyx_obj_7pyarrow_3lib_Array {
  struct __pyx_obj_7pyarrow_3lib__PandasConvertible __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_Array *__pyx_vtab;
  std::shared_ptr< arrow::Array>  sp_array;
   arrow::Array *ap;
  PyObject *__weakref__;
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
  PyObject *_name;
};


/* "pyarrow/lib.pxd":286
 * 
 * 
 * cdef class Tensor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CTensor] sp_tensor
 */
struct __pyx_obj_7pyarrow_3lib_Tensor {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_Tensor *__pyx_vtab;
  std::shared_ptr< arrow::Tensor>  sp_tensor;
   arrow::Tensor *tp;
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
};


/* "pyarrow/lib.pxd":297
 * 
 * 
 * cdef class SparseCSRMatrix:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSparseCSRMatrix] sp_sparse_tensor
 */
struct __pyx_obj_7pyarrow_3lib_SparseCSRMatrix {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_SparseCSRMatrix *__pyx_vtab;
  std::shared_ptr< arrow::SparseCSRMatrix>  sp_sparse_tensor;
   arrow::SparseCSRMatrix *stp;
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
};


/* "pyarrow/lib.pxd":308
 * 
 * 
 * cdef class SparseCOOTensor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSparseCOOTensor] sp_sparse_tensor
 */
struct __pyx_obj_7pyarrow_3lib_SparseCOOTensor {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_SparseCOOTensor *__pyx_vtab;
  std::shared_ptr< arrow::SparseCOOTensor>  sp_sparse_tensor;
   arrow::SparseCOOTensor *stp;
  struct __pyx_obj_7pyarrow_3lib_DataType *type;
};


/* "pyarrow/lib.pxd":319
 * 
 * 
 * cdef class NullArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_NullArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":323
 * 
 * 
 * cdef class BooleanArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_BooleanArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":327
 * 
 * 
 * cdef class NumericArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_NumericArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":331
 * 
 * 
 * cdef class IntegerArray(NumericArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_IntegerArray {
  struct __pyx_obj_7pyarrow_3lib_NumericArray __pyx_base;
};


/* "pyarrow/lib.pxd":335
 * 
 * 
 * cdef class FloatingPointArray(NumericArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_FloatingPointArray {
  struct __pyx_obj_7pyarrow_3lib_NumericArray __pyx_base;
};


/* "pyarrow/lib.pxd":339
 * 
 * 
 * cdef class Int8Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int8Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":343
 * 
 * 
 * cdef class UInt8Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_UInt8Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":347
 * 
 * 
 * cdef class Int16Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int16Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":351
 * 
 * 
 * cdef class UInt16Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_UInt16Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":355
 * 
 * 
 * cdef class Int32Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int32Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":359
 * 
 * 
 * cdef class UInt32Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_UInt32Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":363
 * 
 * 
 * cdef class Int64Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Int64Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":367
 * 
 * 
 * cdef class UInt64Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_UInt64Array {
  struct __pyx_obj_7pyarrow_3lib_IntegerArray __pyx_base;
};


/* "pyarrow/lib.pxd":371
 * 
 * 
 * cdef class HalfFloatArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_HalfFloatArray {
  struct __pyx_obj_7pyarrow_3lib_FloatingPointArray __pyx_base;
};


/* "pyarrow/lib.pxd":375
 * 
 * 
 * cdef class FloatArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_FloatArray {
  struct __pyx_obj_7pyarrow_3lib_FloatingPointArray __pyx_base;
};


/* "pyarrow/lib.pxd":379
 * 
 * 
 * cdef class DoubleArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_DoubleArray {
  struct __pyx_obj_7pyarrow_3lib_FloatingPointArray __pyx_base;
};


/* "pyarrow/lib.pxd":383
 * 
 * 
 * cdef class FixedSizeBinaryArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":387
 * 
 * 
 * cdef class Decimal128Array(FixedSizeBinaryArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_Decimal128Array {
  struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryArray __pyx_base;
};


/* "pyarrow/lib.pxd":391
 * 
 * 
 * cdef class StructArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_StructArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":395
 * 
 * 
 * cdef class ListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_ListArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":399
 * 
 * 
 * cdef class LargeListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_LargeListArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":403
 * 
 * 
 * cdef class MapArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_MapArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":407
 * 
 * 
 * cdef class FixedSizeListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_FixedSizeListArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":411
 * 
 * 
 * cdef class UnionArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_UnionArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":415
 * 
 * 
 * cdef class StringArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_StringArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":419
 * 
 * 
 * cdef class BinaryArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_BinaryArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":423
 * 
 * 
 * cdef class DictionaryArray(Array):             # <<<<<<<<<<<<<<
 *     cdef:
 *         object _indices, _dictionary
 */
struct __pyx_obj_7pyarrow_3lib_DictionaryArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
  PyObject *_indices;
  PyObject *_dictionary;
};


/* "pyarrow/lib.pxd":428
 * 
 * 
 * cdef class ExtensionArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_ExtensionArray {
  struct __pyx_obj_7pyarrow_3lib_Array __pyx_base;
};


/* "pyarrow/lib.pxd":439
 * 
 * 
 * cdef class ChunkedArray(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CChunkedArray] sp_chunked_array
 */
struct __pyx_obj_7pyarrow_3lib_ChunkedArray {
  struct __pyx_obj_7pyarrow_3lib__PandasConvertible __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_ChunkedArray *__pyx_vtab;
  std::shared_ptr< arrow::ChunkedArray>  sp_chunked_array;
   arrow::ChunkedArray *chunked_array;
  PyObject *_name;
};


/* "pyarrow/lib.pxd":452
 * 
 * 
 * cdef class Table(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CTable] sp_table
 */
struct __pyx_obj_7pyarrow_3lib_Table {
  struct __pyx_obj_7pyarrow_3lib__PandasConvertible __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_Table *__pyx_vtab;
  std::shared_ptr< arrow::Table>  sp_table;
   arrow::Table *table;
};


/* "pyarrow/lib.pxd":460
 * 
 * 
 * cdef class RecordBatch(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CRecordBatch] sp_batch
 */
struct __pyx_obj_7pyarrow_3lib_RecordBatch {
  struct __pyx_obj_7pyarrow_3lib__PandasConvertible __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_3lib_RecordBatch *__pyx_vtab;
  std::shared_ptr< arrow::RecordBatch>  sp_batch;
   arrow::RecordBatch *batch;
  struct __pyx_obj_7pyarrow_3lib_Schema *_schema;
};


/* "pyarrow/lib.pxd":469
 * 
 * 
 * cdef class Buffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CBuffer] buffer
 */
struct __pyx_obj_7pyarrow_3lib_Buffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_Buffer *__pyx_vtab;
  std::shared_ptr< arrow::Buffer>  buffer;
  Py_ssize_t shape[1];
  Py_ssize_t strides[1];
};


/* "pyarrow/lib.pxd":479
 * 
 * 
 * cdef class ResizableBuffer(Buffer):             # <<<<<<<<<<<<<<
 * 
 *     cdef void init_rz(self, const shared_ptr[CResizableBuffer]& buffer)
 */
struct __pyx_obj_7pyarrow_3lib_ResizableBuffer {
  struct __pyx_obj_7pyarrow_3lib_Buffer __pyx_base;
};


/* "pyarrow/lib.pxd":484
 * 
 * 
 * cdef class NativeFile:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CInputStream] input_stream
 */
struct __pyx_obj_7pyarrow_3lib_NativeFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile *__pyx_vtab;
  std::shared_ptr< arrow::io::InputStream>  input_stream;
  std::shared_ptr< arrow::io::RandomAccessFile>  random_access;
  std::shared_ptr< arrow::io::OutputStream>  output_stream;
  int is_readable;
  int is_writable;
  int is_seekable;
  int own_file;
  PyObject *__weakref__;
};


/* "pyarrow/lib.pxd":508
 * 
 * 
 * cdef class BufferedInputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_BufferedInputStream {
  struct __pyx_obj_7pyarrow_3lib_NativeFile __pyx_base;
};


/* "pyarrow/lib.pxd":512
 * 
 * 
 * cdef class BufferedOutputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_BufferedOutputStream {
  struct __pyx_obj_7pyarrow_3lib_NativeFile __pyx_base;
};


/* "pyarrow/lib.pxd":516
 * 
 * 
 * cdef class CompressedInputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_CompressedInputStream {
  struct __pyx_obj_7pyarrow_3lib_NativeFile __pyx_base;
};


/* "pyarrow/lib.pxd":520
 * 
 * 
 * cdef class CompressedOutputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_7pyarrow_3lib_CompressedOutputStream {
  struct __pyx_obj_7pyarrow_3lib_NativeFile __pyx_base;
};


/* "pyarrow/lib.pxd":524
 * 
 * 
 * cdef class _CRecordBatchWriter:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CRecordBatchWriter] writer
 */
struct __pyx_obj_7pyarrow_3lib__CRecordBatchWriter {
  PyObject_HEAD
  std::shared_ptr< arrow::ipc::RecordBatchWriter>  writer;
};


/* "pyarrow/lib.pxd":529
 * 
 * 
 * cdef class _CRecordBatchReader:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CRecordBatchReader] reader
 */
struct __pyx_obj_7pyarrow_3lib__CRecordBatchReader {
  PyObject_HEAD
  std::shared_ptr< arrow::RecordBatchReader>  reader;
};


/* "pyarrow/lib.pxd":534
 * 
 * 
 * cdef class CastOptions:             # <<<<<<<<<<<<<<
 *     cdef:
 *         CCastOptions options
 */
struct __pyx_obj_7pyarrow_3lib_CastOptions {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_3lib_CastOptions *__pyx_vtab;
   arrow::compute::CastOptions options;
};


/* "pyarrow/_flight.pyx":94
 * 
 * 
 * cdef class FlightCallOptions:             # <<<<<<<<<<<<<<
 *     """RPC-layer options for a Flight call."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCallOptions *__pyx_vtab;
   arrow::flight::FlightCallOptions options;
};


/* "pyarrow/_flight.pyx":130
 * 
 * 
 * cdef class FlightError(Exception):             # <<<<<<<<<<<<<<
 *     cdef dict __dict__
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightError {
  PyBaseExceptionObject __pyx_base;
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *__pyx_vtab;
  PyObject *__dict__;
};


/* "pyarrow/_flight.pyx":138
 * 
 * 
 * cdef class FlightInternalError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightInternalError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":143
 * 
 * 
 * cdef class FlightTimedOutError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":148
 * 
 * 
 * cdef class FlightCancelledError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":153
 * 
 * 
 * cdef class FlightServerError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightServerError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":158
 * 
 * 
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(
 */
struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":164
 * 
 * 
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":169
 * 
 * 
 * cdef class FlightUnavailableError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))
 */
struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError {
  struct __pyx_obj_7pyarrow_7_flight_FlightError __pyx_base;
};


/* "pyarrow/_flight.pyx":174
 * 
 * 
 * cdef class Action:             # <<<<<<<<<<<<<<
 *     """An action executable on a Flight service."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_Action {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_Action *__pyx_vtab;
   arrow::flight::Action action;
};


/* "pyarrow/_flight.pyx":225
 * 
 * 
 * cdef class Result:             # <<<<<<<<<<<<<<
 *     """A result from executing an Action."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_Result {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::Result>  result;
};


/* "pyarrow/_flight.pyx":246
 * 
 * 
 * cdef class BasicAuth:             # <<<<<<<<<<<<<<
 *     """A container for basic auth."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_BasicAuth {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::BasicAuth>  basic_auth;
};


/* "pyarrow/_flight.pyx":345
 * 
 * 
 * cdef class FlightDescriptor:             # <<<<<<<<<<<<<<
 *     """A description of a data stream available from a Flight service."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDescriptor *__pyx_vtab;
   arrow::flight::FlightDescriptor descriptor;
};


/* "pyarrow/_flight.pyx":443
 * 
 * 
 * cdef class Ticket:             # <<<<<<<<<<<<<<
 *     """A ticket for requesting a Flight stream."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_Ticket {
  PyObject_HEAD
   arrow::flight::Ticket ticket;
};


/* "pyarrow/_flight.pyx":491
 * 
 * 
 * cdef class Location:             # <<<<<<<<<<<<<<
 *     """The location of a Flight service."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_Location {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_Location *__pyx_vtab;
   arrow::flight::Location location;
};


/* "pyarrow/_flight.pyx":564
 * 
 * 
 * cdef class FlightEndpoint:             # <<<<<<<<<<<<<<
 *     """A Flight stream, along with the ticket and locations to access it."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint {
  PyObject_HEAD
   arrow::flight::FlightEndpoint endpoint;
};


/* "pyarrow/_flight.pyx":619
 * 
 * 
 * cdef class SchemaResult:             # <<<<<<<<<<<<<<
 *     """A result from a getschema request. Holding a schema"""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_SchemaResult {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::SchemaResult>  result;
};


/* "pyarrow/_flight.pyx":647
 * 
 * 
 * cdef class FlightInfo:             # <<<<<<<<<<<<<<
 *     """A description of a Flight stream."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_FlightInfo {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::FlightInfo>  info;
};


/* "pyarrow/_flight.pyx":754
 * 
 * 
 * cdef class FlightStreamChunk:             # <<<<<<<<<<<<<<
 *     """A RecordBatch with application metadata on the side."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk {
  PyObject_HEAD
   arrow::flight::FlightStreamChunk chunk;
};


/* "pyarrow/_flight.pyx":775
 * 
 * 
 * cdef class _MetadataRecordBatchReader:             # <<<<<<<<<<<<<<
 *     """A reader for Flight streams."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader {
  PyObject_HEAD
  PyObject *__dict__;
  std::shared_ptr< arrow::flight::MetadataRecordBatchReader>  reader;
  struct __pyx_obj_7pyarrow_3lib_Schema *schema;
};


/* "pyarrow/_flight.pyx":788
 * 
 * 
 * cdef class MetadataRecordBatchReader(_MetadataRecordBatchReader,             # <<<<<<<<<<<<<<
 *                                      _ReadPandasOption):
 *     """A reader for Flight streams."""
 */
struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader {
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader __pyx_base;
};


/* "pyarrow/_flight.pyx":832
 * 
 * 
 * cdef class FlightStreamReader(MetadataRecordBatchReader):             # <<<<<<<<<<<<<<
 *     """A reader that can also be canceled."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader {
  struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader __pyx_base;
};


/* "pyarrow/_flight.pyx":841
 * 
 * 
 * cdef class FlightStreamWriter(_CRecordBatchWriter):             # <<<<<<<<<<<<<<
 *     """A RecordBatchWriter that also allows writing application metadata."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter {
  struct __pyx_obj_7pyarrow_3lib__CRecordBatchWriter __pyx_base;
};


/* "pyarrow/_flight.pyx":869
 * 
 * 
 * cdef class FlightMetadataReader:             # <<<<<<<<<<<<<<
 *     """A reader for Flight metadata messages sent during a DoPut."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::FlightMetadataReader>  reader;
};


/* "pyarrow/_flight.pyx":885
 * 
 * 
 * cdef class FlightMetadataWriter:             # <<<<<<<<<<<<<<
 *     """A sender for Flight metadata messages during a DoPut."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter {
  PyObject_HEAD
  std::unique_ptr< arrow::flight::FlightMetadataWriter>  writer;
};


/* "pyarrow/_flight.pyx":904
 * 
 * 
 * cdef class FlightClient:             # <<<<<<<<<<<<<<
 *     """A client to a Flight service.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightClient {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightClient *__pyx_vtab;
  std::unique_ptr< arrow::flight::FlightClient>  client;
};


/* "pyarrow/_flight.pyx":1182
 * 
 * 
 * cdef class FlightDataStream:             # <<<<<<<<<<<<<<
 *     """Abstract base class for Flight data streams."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightDataStream {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream *__pyx_vtab;
};


/* "pyarrow/_flight.pyx":1194
 * 
 * 
 * cdef class RecordBatchStream(FlightDataStream):             # <<<<<<<<<<<<<<
 *     """A Flight data stream backed by RecordBatches."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream {
  struct __pyx_obj_7pyarrow_7_flight_FlightDataStream __pyx_base;
  PyObject *data_source;
};


/* "pyarrow/_flight.pyx":1226
 * 
 * 
 * cdef class GeneratorStream(FlightDataStream):             # <<<<<<<<<<<<<<
 *     """A Flight data stream backed by a Python generator."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_GeneratorStream {
  struct __pyx_obj_7pyarrow_7_flight_FlightDataStream __pyx_base;
  std::shared_ptr< arrow::Schema>  schema;
  PyObject *generator;
  std::unique_ptr< arrow::flight::FlightDataStream>  current_stream;
};


/* "pyarrow/_flight.pyx":1256
 * 
 * 
 * cdef class ServerCallContext:             # <<<<<<<<<<<<<<
 *     """Per-call state/context."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_ServerCallContext {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerCallContext *__pyx_vtab;
   arrow::flight::ServerCallContext const *context;
};


/* "pyarrow/_flight.pyx":1294
 * 
 * 
 * cdef class ServerAuthReader:             # <<<<<<<<<<<<<<
 *     """A reader for messages from the client during an auth handshake."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader *__pyx_vtab;
   arrow::flight::ServerAuthReader *reader;
};


/* "pyarrow/_flight.pyx":1325
 * 
 * 
 * cdef class ServerAuthSender:             # <<<<<<<<<<<<<<
 *     """A writer for messages to the client during an auth handshake."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender *__pyx_vtab;
   arrow::flight::ServerAuthSender *sender;
};


/* "pyarrow/_flight.pyx":1355
 * 
 * 
 * cdef class ClientAuthReader:             # <<<<<<<<<<<<<<
 *     """A reader for messages from the server during an auth handshake."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader *__pyx_vtab;
   arrow::flight::ClientAuthReader *reader;
};


/* "pyarrow/_flight.pyx":1386
 * 
 * 
 * cdef class ClientAuthSender:             # <<<<<<<<<<<<<<
 *     """A writer for messages to the server during an auth handshake."""
 *     cdef:
 */
struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender *__pyx_vtab;
   arrow::flight::ClientAuthSender *sender;
};


/* "pyarrow/_flight.pyx":1819
 * 
 * 
 * cdef class ServerAuthHandler:             # <<<<<<<<<<<<<<
 *     """Authentication middleware for a server.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthHandler *__pyx_vtab;
};


/* "pyarrow/_flight.pyx":1863
 * 
 * 
 * cdef class ClientAuthHandler:             # <<<<<<<<<<<<<<
 *     """Authentication plugin for a client."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthHandler *__pyx_vtab;
};


/* "pyarrow/_flight.pyx":1901
 * 
 * 
 * cdef class ClientMiddlewareFactory:             # <<<<<<<<<<<<<<
 *     """A factory for new middleware instances.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory {
  PyObject_HEAD
};


/* "pyarrow/_flight.pyx":1929
 * 
 * 
 * cdef class ClientMiddleware:             # <<<<<<<<<<<<<<
 *     """Client-side middleware for a call, instantiated per RPC.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ClientMiddleware *__pyx_vtab;
};


/* "pyarrow/_flight.pyx":1986
 * 
 * 
 * cdef class ServerMiddlewareFactory:             # <<<<<<<<<<<<<<
 *     """A factory for new middleware instances.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory {
  PyObject_HEAD
};


/* "pyarrow/_flight.pyx":2024
 * 
 * 
 * cdef class ServerMiddleware:             # <<<<<<<<<<<<<<
 *     """Server-side middleware for a call, instantiated per RPC.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware *__pyx_vtab;
};


/* "pyarrow/_flight.pyx":2065
 * 
 * 
 * cdef class _ServerMiddlewareFactoryWrapper(ServerMiddlewareFactory):             # <<<<<<<<<<<<<<
 *     """Wrapper to bundle server middleware into a single C++ one."""
 * 
 */
struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper {
  struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory __pyx_base;
  PyObject *factories;
};


/* "pyarrow/_flight.pyx":2087
 * 
 * 
 * cdef class _ServerMiddlewareWrapper(ServerMiddleware):             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict middleware
 */
struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper {
  struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware __pyx_base;
  PyObject *middleware;
};


/* "pyarrow/_flight.pyx":2113
 * 
 * 
 * cdef class FlightServerBase:             # <<<<<<<<<<<<<<
 *     """A Flight service definition.
 * 
 */
struct __pyx_obj_7pyarrow_7_flight_FlightServerBase {
  PyObject_HEAD
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerBase *__pyx_vtab;
  std::unique_ptr<arrow::py::flight::PyFlightServer>  server;
};


/* "pyarrow/_flight.pyx":792
 *     """A reader for Flight streams."""
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             yield self.read_chunk()
 */
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ {
  PyObject_HEAD
  struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self;
};


/* "pyarrow/_flight.pyx":1038
 *         return result
 * 
 *     def do_action(self, action, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute an action on a service.
 */
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action {
  PyObject_HEAD
  PyObject *__pyx_v_action;
   arrow::flight::Action __pyx_v_c_action;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options;
  struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_result;
  std::unique_ptr< arrow::flight::ResultStream>  __pyx_v_results;
  struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self;
};


/* "pyarrow/_flight.pyx":1080
 *             yield result
 * 
 *     def list_flights(self, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """List the flights available on a service."""
 *         cdef:
 */
struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights {
  PyObject_HEAD
   arrow::flight::Criteria __pyx_v_c_criteria;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
  std::unique_ptr< arrow::flight::FlightListing>  __pyx_v_listing;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options;
  struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_result;
  struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self;
};



/* "pyarrow/lib.pxd":41
 * 
 * 
 * cdef class MemoryPool:             # <<<<<<<<<<<<<<
 *     cdef:
 *         CMemoryPool* pool
 */

struct __pyx_vtabstruct_7pyarrow_3lib_MemoryPool {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_MemoryPool *,  arrow::MemoryPool *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_MemoryPool *__pyx_vtabptr_7pyarrow_3lib_MemoryPool;


/* "pyarrow/lib.pxd":51
 * 
 * 
 * cdef class DataType:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CDataType] sp_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_DataType {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_DataType *, std::shared_ptr< arrow::DataType>  const &);
  struct __pyx_obj_7pyarrow_3lib_Field *(*child)(struct __pyx_obj_7pyarrow_3lib_DataType *, int);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_DataType *__pyx_vtabptr_7pyarrow_3lib_DataType;


/* "pyarrow/lib.pxd":62
 * 
 * 
 * cdef class ListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CListType* list_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ListType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ListType *__pyx_vtabptr_7pyarrow_3lib_ListType;


/* "pyarrow/lib.pxd":67
 * 
 * 
 * cdef class LargeListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CLargeListType* list_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_LargeListType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_LargeListType *__pyx_vtabptr_7pyarrow_3lib_LargeListType;


/* "pyarrow/lib.pxd":72
 * 
 * 
 * cdef class MapType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CMapType* map_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_MapType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_MapType *__pyx_vtabptr_7pyarrow_3lib_MapType;


/* "pyarrow/lib.pxd":77
 * 
 * 
 * cdef class FixedSizeListType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CFixedSizeListType* list_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListType *__pyx_vtabptr_7pyarrow_3lib_FixedSizeListType;


/* "pyarrow/lib.pxd":82
 * 
 * 
 * cdef class StructType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CStructType* struct_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_StructType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
  struct __pyx_obj_7pyarrow_3lib_Field *(*field)(struct __pyx_obj_7pyarrow_3lib_StructType *, int);
  struct __pyx_obj_7pyarrow_3lib_Field *(*field_by_name)(struct __pyx_obj_7pyarrow_3lib_StructType *, PyObject *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_StructType *__pyx_vtabptr_7pyarrow_3lib_StructType;


/* "pyarrow/lib.pxd":98
 * 
 * 
 * cdef class DictionaryType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDictionaryType* dict_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryType *__pyx_vtabptr_7pyarrow_3lib_DictionaryType;


/* "pyarrow/lib.pxd":103
 * 
 * 
 * cdef class TimestampType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTimestampType* ts_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_TimestampType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_TimestampType *__pyx_vtabptr_7pyarrow_3lib_TimestampType;


/* "pyarrow/lib.pxd":108
 * 
 * 
 * cdef class Time32Type(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTime32Type* time_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Time32Type {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Time32Type *__pyx_vtabptr_7pyarrow_3lib_Time32Type;


/* "pyarrow/lib.pxd":113
 * 
 * 
 * cdef class Time64Type(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CTime64Type* time_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Time64Type {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Time64Type *__pyx_vtabptr_7pyarrow_3lib_Time64Type;


/* "pyarrow/lib.pxd":118
 * 
 * 
 * cdef class DurationType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDurationType* duration_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_DurationType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_DurationType *__pyx_vtabptr_7pyarrow_3lib_DurationType;


/* "pyarrow/lib.pxd":123
 * 
 * 
 * cdef class FixedSizeBinaryType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CFixedSizeBinaryType* fixed_size_binary_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryType *__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryType;


/* "pyarrow/lib.pxd":128
 * 
 * 
 * cdef class Decimal128Type(FixedSizeBinaryType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CDecimal128Type* decimal128_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Type {
  struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Type *__pyx_vtabptr_7pyarrow_3lib_Decimal128Type;


/* "pyarrow/lib.pxd":133
 * 
 * 
 * cdef class BaseExtensionType(DataType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CExtensionType* ext_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_BaseExtensionType {
  struct __pyx_vtabstruct_7pyarrow_3lib_DataType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_BaseExtensionType *__pyx_vtabptr_7pyarrow_3lib_BaseExtensionType;


/* "pyarrow/lib.pxd":138
 * 
 * 
 * cdef class ExtensionType(BaseExtensionType):             # <<<<<<<<<<<<<<
 *     cdef:
 *         const CPyExtensionType* cpy_ext_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionType {
  struct __pyx_vtabstruct_7pyarrow_3lib_BaseExtensionType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionType *__pyx_vtabptr_7pyarrow_3lib_ExtensionType;


/* "pyarrow/lib.pxd":143
 * 
 * 
 * cdef class PyExtensionType(ExtensionType):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_PyExtensionType {
  struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionType __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_PyExtensionType *__pyx_vtabptr_7pyarrow_3lib_PyExtensionType;


/* "pyarrow/lib.pxd":147
 * 
 * 
 * cdef class Field:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CField] sp_field
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Field {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Field *, std::shared_ptr< arrow::Field>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Field *__pyx_vtabptr_7pyarrow_3lib_Field;


/* "pyarrow/lib.pxd":158
 * 
 * 
 * cdef class Schema:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSchema] sp_schema
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Schema {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Schema *, std::vector<std::shared_ptr< arrow::Field> >  const &);
  void (*init_schema)(struct __pyx_obj_7pyarrow_3lib_Schema *, std::shared_ptr< arrow::Schema>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Schema *__pyx_vtabptr_7pyarrow_3lib_Schema;


/* "pyarrow/lib.pxd":176
 * 
 * 
 * cdef class ArrayValue(Scalar):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CArray] sp_array
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_ArrayValue *, struct __pyx_obj_7pyarrow_3lib_DataType *, std::shared_ptr< arrow::Array>  const &, int64_t);
  void (*_set_array)(struct __pyx_obj_7pyarrow_3lib_ArrayValue *, std::shared_ptr< arrow::Array>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue *__pyx_vtabptr_7pyarrow_3lib_ArrayValue;


/* "pyarrow/lib.pxd":186
 *     cdef void _set_array(self, const shared_ptr[CArray]& sp_array)
 * 
 * cdef class ScalarValue(Scalar):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CScalar] sp_scalar
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ScalarValue {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_ScalarValue *, std::shared_ptr< arrow::Scalar>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ScalarValue *__pyx_vtabptr_7pyarrow_3lib_ScalarValue;


/* "pyarrow/lib.pxd":192
 *     cdef void init(self, const shared_ptr[CScalar]& sp_scalar)
 * 
 * cdef class Int8Value(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int8Value {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int8Value *__pyx_vtabptr_7pyarrow_3lib_Int8Value;


/* "pyarrow/lib.pxd":196
 * 
 * 
 * cdef class Int64Value(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int64Value {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int64Value *__pyx_vtabptr_7pyarrow_3lib_Int64Value;


/* "pyarrow/lib.pxd":200
 * 
 * 
 * cdef class ListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ListValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_ListValue *, int64_t);
  int64_t (*length)(struct __pyx_obj_7pyarrow_3lib_ListValue *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ListValue *__pyx_vtabptr_7pyarrow_3lib_ListValue;


/* "pyarrow/lib.pxd":211
 * 
 * 
 * cdef class LargeListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_LargeListValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_LargeListValue *, int64_t);
  int64_t (*length)(struct __pyx_obj_7pyarrow_3lib_LargeListValue *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_LargeListValue *__pyx_vtabptr_7pyarrow_3lib_LargeListValue;


/* "pyarrow/lib.pxd":222
 * 
 * 
 * cdef class MapValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType key_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_MapValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_MapValue *, int64_t);
  int64_t (*length)(struct __pyx_obj_7pyarrow_3lib_MapValue *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_MapValue *__pyx_vtabptr_7pyarrow_3lib_MapValue;


/* "pyarrow/lib.pxd":234
 * 
 * 
 * cdef class FixedSizeListValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef readonly:
 *         DataType value_type
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_FixedSizeListValue *, int64_t);
  int64_t (*length)(struct __pyx_obj_7pyarrow_3lib_FixedSizeListValue *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListValue *__pyx_vtabptr_7pyarrow_3lib_FixedSizeListValue;


/* "pyarrow/lib.pxd":245
 * 
 * 
 * cdef class StructValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CStructArray* ap
 */

struct __pyx_vtabstruct_7pyarrow_3lib_StructValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_StructValue *__pyx_vtabptr_7pyarrow_3lib_StructValue;


/* "pyarrow/lib.pxd":250
 * 
 * 
 * cdef class UnionValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CUnionArray* ap
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UnionValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_UnionValue *, int64_t);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UnionValue *__pyx_vtabptr_7pyarrow_3lib_UnionValue;


/* "pyarrow/lib.pxd":258
 * 
 * 
 * cdef class StringValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_StringValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_StringValue *__pyx_vtabptr_7pyarrow_3lib_StringValue;


/* "pyarrow/lib.pxd":262
 * 
 * 
 * cdef class FixedSizeBinaryValue(ArrayValue):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryValue {
  struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryValue *__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryValue;


/* "pyarrow/lib.pxd":270
 * 
 * 
 * cdef class Array(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CArray] sp_array
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Array {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Array *, std::shared_ptr< arrow::Array>  const &);
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_Array *, int64_t);
  int64_t (*length)(struct __pyx_obj_7pyarrow_3lib_Array *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Array *__pyx_vtabptr_7pyarrow_3lib_Array;


/* "pyarrow/lib.pxd":286
 * 
 * 
 * cdef class Tensor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CTensor] sp_tensor
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Tensor {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Tensor *, std::shared_ptr< arrow::Tensor>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Tensor *__pyx_vtabptr_7pyarrow_3lib_Tensor;


/* "pyarrow/lib.pxd":297
 * 
 * 
 * cdef class SparseCSRMatrix:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSparseCSRMatrix] sp_sparse_tensor
 */

struct __pyx_vtabstruct_7pyarrow_3lib_SparseCSRMatrix {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_SparseCSRMatrix *, std::shared_ptr< arrow::SparseCSRMatrix>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_SparseCSRMatrix *__pyx_vtabptr_7pyarrow_3lib_SparseCSRMatrix;


/* "pyarrow/lib.pxd":308
 * 
 * 
 * cdef class SparseCOOTensor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CSparseCOOTensor] sp_sparse_tensor
 */

struct __pyx_vtabstruct_7pyarrow_3lib_SparseCOOTensor {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_SparseCOOTensor *, std::shared_ptr< arrow::SparseCOOTensor>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_SparseCOOTensor *__pyx_vtabptr_7pyarrow_3lib_SparseCOOTensor;


/* "pyarrow/lib.pxd":319
 * 
 * 
 * cdef class NullArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_NullArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_NullArray *__pyx_vtabptr_7pyarrow_3lib_NullArray;


/* "pyarrow/lib.pxd":323
 * 
 * 
 * cdef class BooleanArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_BooleanArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_BooleanArray *__pyx_vtabptr_7pyarrow_3lib_BooleanArray;


/* "pyarrow/lib.pxd":327
 * 
 * 
 * cdef class NumericArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_NumericArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_NumericArray *__pyx_vtabptr_7pyarrow_3lib_NumericArray;


/* "pyarrow/lib.pxd":331
 * 
 * 
 * cdef class IntegerArray(NumericArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_NumericArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray *__pyx_vtabptr_7pyarrow_3lib_IntegerArray;


/* "pyarrow/lib.pxd":335
 * 
 * 
 * cdef class FloatingPointArray(NumericArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_NumericArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray *__pyx_vtabptr_7pyarrow_3lib_FloatingPointArray;


/* "pyarrow/lib.pxd":339
 * 
 * 
 * cdef class Int8Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int8Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int8Array *__pyx_vtabptr_7pyarrow_3lib_Int8Array;


/* "pyarrow/lib.pxd":343
 * 
 * 
 * cdef class UInt8Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UInt8Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UInt8Array *__pyx_vtabptr_7pyarrow_3lib_UInt8Array;


/* "pyarrow/lib.pxd":347
 * 
 * 
 * cdef class Int16Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int16Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int16Array *__pyx_vtabptr_7pyarrow_3lib_Int16Array;


/* "pyarrow/lib.pxd":351
 * 
 * 
 * cdef class UInt16Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UInt16Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UInt16Array *__pyx_vtabptr_7pyarrow_3lib_UInt16Array;


/* "pyarrow/lib.pxd":355
 * 
 * 
 * cdef class Int32Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int32Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int32Array *__pyx_vtabptr_7pyarrow_3lib_Int32Array;


/* "pyarrow/lib.pxd":359
 * 
 * 
 * cdef class UInt32Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UInt32Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UInt32Array *__pyx_vtabptr_7pyarrow_3lib_UInt32Array;


/* "pyarrow/lib.pxd":363
 * 
 * 
 * cdef class Int64Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Int64Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Int64Array *__pyx_vtabptr_7pyarrow_3lib_Int64Array;


/* "pyarrow/lib.pxd":367
 * 
 * 
 * cdef class UInt64Array(IntegerArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UInt64Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UInt64Array *__pyx_vtabptr_7pyarrow_3lib_UInt64Array;


/* "pyarrow/lib.pxd":371
 * 
 * 
 * cdef class HalfFloatArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_HalfFloatArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_HalfFloatArray *__pyx_vtabptr_7pyarrow_3lib_HalfFloatArray;


/* "pyarrow/lib.pxd":375
 * 
 * 
 * cdef class FloatArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FloatArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FloatArray *__pyx_vtabptr_7pyarrow_3lib_FloatArray;


/* "pyarrow/lib.pxd":379
 * 
 * 
 * cdef class DoubleArray(FloatingPointArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_DoubleArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_DoubleArray *__pyx_vtabptr_7pyarrow_3lib_DoubleArray;


/* "pyarrow/lib.pxd":383
 * 
 * 
 * cdef class FixedSizeBinaryArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryArray *__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryArray;


/* "pyarrow/lib.pxd":387
 * 
 * 
 * cdef class Decimal128Array(FixedSizeBinaryArray):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Array {
  struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryArray __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Array *__pyx_vtabptr_7pyarrow_3lib_Decimal128Array;


/* "pyarrow/lib.pxd":391
 * 
 * 
 * cdef class StructArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_StructArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_StructArray *__pyx_vtabptr_7pyarrow_3lib_StructArray;


/* "pyarrow/lib.pxd":395
 * 
 * 
 * cdef class ListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ListArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ListArray *__pyx_vtabptr_7pyarrow_3lib_ListArray;


/* "pyarrow/lib.pxd":399
 * 
 * 
 * cdef class LargeListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_LargeListArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_LargeListArray *__pyx_vtabptr_7pyarrow_3lib_LargeListArray;


/* "pyarrow/lib.pxd":403
 * 
 * 
 * cdef class MapArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_MapArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_MapArray *__pyx_vtabptr_7pyarrow_3lib_MapArray;


/* "pyarrow/lib.pxd":407
 * 
 * 
 * cdef class FixedSizeListArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListArray *__pyx_vtabptr_7pyarrow_3lib_FixedSizeListArray;


/* "pyarrow/lib.pxd":411
 * 
 * 
 * cdef class UnionArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_UnionArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_UnionArray *__pyx_vtabptr_7pyarrow_3lib_UnionArray;


/* "pyarrow/lib.pxd":415
 * 
 * 
 * cdef class StringArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_StringArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_StringArray *__pyx_vtabptr_7pyarrow_3lib_StringArray;


/* "pyarrow/lib.pxd":419
 * 
 * 
 * cdef class BinaryArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_BinaryArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_BinaryArray *__pyx_vtabptr_7pyarrow_3lib_BinaryArray;


/* "pyarrow/lib.pxd":423
 * 
 * 
 * cdef class DictionaryArray(Array):             # <<<<<<<<<<<<<<
 *     cdef:
 *         object _indices, _dictionary
 */

struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryArray *__pyx_vtabptr_7pyarrow_3lib_DictionaryArray;


/* "pyarrow/lib.pxd":428
 * 
 * 
 * cdef class ExtensionArray(Array):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionArray {
  struct __pyx_vtabstruct_7pyarrow_3lib_Array __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionArray *__pyx_vtabptr_7pyarrow_3lib_ExtensionArray;


/* "pyarrow/lib.pxd":439
 * 
 * 
 * cdef class ChunkedArray(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CChunkedArray] sp_chunked_array
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ChunkedArray {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_ChunkedArray *, std::shared_ptr< arrow::ChunkedArray>  const &);
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_ChunkedArray *, int64_t);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ChunkedArray *__pyx_vtabptr_7pyarrow_3lib_ChunkedArray;


/* "pyarrow/lib.pxd":452
 * 
 * 
 * cdef class Table(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CTable] sp_table
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Table {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Table *, std::shared_ptr< arrow::Table>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Table *__pyx_vtabptr_7pyarrow_3lib_Table;


/* "pyarrow/lib.pxd":460
 * 
 * 
 * cdef class RecordBatch(_PandasConvertible):             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CRecordBatch] sp_batch
 */

struct __pyx_vtabstruct_7pyarrow_3lib_RecordBatch {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_RecordBatch *, std::shared_ptr< arrow::RecordBatch>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_RecordBatch *__pyx_vtabptr_7pyarrow_3lib_RecordBatch;


/* "pyarrow/lib.pxd":469
 * 
 * 
 * cdef class Buffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CBuffer] buffer
 */

struct __pyx_vtabstruct_7pyarrow_3lib_Buffer {
  void (*init)(struct __pyx_obj_7pyarrow_3lib_Buffer *, std::shared_ptr< arrow::Buffer>  const &);
  PyObject *(*getitem)(struct __pyx_obj_7pyarrow_3lib_Buffer *, int64_t);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_Buffer *__pyx_vtabptr_7pyarrow_3lib_Buffer;


/* "pyarrow/lib.pxd":479
 * 
 * 
 * cdef class ResizableBuffer(Buffer):             # <<<<<<<<<<<<<<
 * 
 *     cdef void init_rz(self, const shared_ptr[CResizableBuffer]& buffer)
 */

struct __pyx_vtabstruct_7pyarrow_3lib_ResizableBuffer {
  struct __pyx_vtabstruct_7pyarrow_3lib_Buffer __pyx_base;
  void (*init_rz)(struct __pyx_obj_7pyarrow_3lib_ResizableBuffer *, std::shared_ptr< arrow::ResizableBuffer>  const &);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_ResizableBuffer *__pyx_vtabptr_7pyarrow_3lib_ResizableBuffer;


/* "pyarrow/lib.pxd":484
 * 
 * 
 * cdef class NativeFile:             # <<<<<<<<<<<<<<
 *     cdef:
 *         shared_ptr[CInputStream] input_stream
 */

struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile {
  PyObject *(*set_random_access_file)(struct __pyx_obj_7pyarrow_3lib_NativeFile *, std::shared_ptr< arrow::io::RandomAccessFile> );
  PyObject *(*set_input_stream)(struct __pyx_obj_7pyarrow_3lib_NativeFile *, std::shared_ptr< arrow::io::InputStream> );
  PyObject *(*set_output_stream)(struct __pyx_obj_7pyarrow_3lib_NativeFile *, std::shared_ptr< arrow::io::OutputStream> );
  std::shared_ptr< arrow::io::RandomAccessFile>  (*get_random_access_file)(struct __pyx_obj_7pyarrow_3lib_NativeFile *);
  std::shared_ptr< arrow::io::InputStream>  (*get_input_stream)(struct __pyx_obj_7pyarrow_3lib_NativeFile *);
  std::shared_ptr< arrow::io::OutputStream>  (*get_output_stream)(struct __pyx_obj_7pyarrow_3lib_NativeFile *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile *__pyx_vtabptr_7pyarrow_3lib_NativeFile;


/* "pyarrow/lib.pxd":508
 * 
 * 
 * cdef class BufferedInputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_BufferedInputStream {
  struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_BufferedInputStream *__pyx_vtabptr_7pyarrow_3lib_BufferedInputStream;


/* "pyarrow/lib.pxd":512
 * 
 * 
 * cdef class BufferedOutputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_BufferedOutputStream {
  struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_BufferedOutputStream *__pyx_vtabptr_7pyarrow_3lib_BufferedOutputStream;


/* "pyarrow/lib.pxd":516
 * 
 * 
 * cdef class CompressedInputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_CompressedInputStream {
  struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_CompressedInputStream *__pyx_vtabptr_7pyarrow_3lib_CompressedInputStream;


/* "pyarrow/lib.pxd":520
 * 
 * 
 * cdef class CompressedOutputStream(NativeFile):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

struct __pyx_vtabstruct_7pyarrow_3lib_CompressedOutputStream {
  struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_3lib_CompressedOutputStream *__pyx_vtabptr_7pyarrow_3lib_CompressedOutputStream;


/* "pyarrow/lib.pxd":534
 * 
 * 
 * cdef class CastOptions:             # <<<<<<<<<<<<<<
 *     cdef:
 *         CCastOptions options
 */

struct __pyx_vtabstruct_7pyarrow_3lib_CastOptions {
  PyObject *(*wrap)( arrow::compute::CastOptions);
   arrow::compute::CastOptions (*unwrap)(struct __pyx_obj_7pyarrow_3lib_CastOptions *);
};
static struct __pyx_vtabstruct_7pyarrow_3lib_CastOptions *__pyx_vtabptr_7pyarrow_3lib_CastOptions;


/* "pyarrow/_flight.pyx":94
 * 
 * 
 * cdef class FlightCallOptions:             # <<<<<<<<<<<<<<
 *     """RPC-layer options for a Flight call."""
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCallOptions {
   arrow::flight::FlightCallOptions *(*unwrap)(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCallOptions *__pyx_vtabptr_7pyarrow_7_flight_FlightCallOptions;


/* "pyarrow/_flight.pyx":130
 * 
 * 
 * cdef class FlightError(Exception):             # <<<<<<<<<<<<<<
 *     cdef dict __dict__
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError {
  arrow::Status (*to_status)(struct __pyx_obj_7pyarrow_7_flight_FlightError *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *__pyx_vtabptr_7pyarrow_7_flight_FlightError;


/* "pyarrow/_flight.pyx":138
 * 
 * 
 * cdef class FlightInternalError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightInternalError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightInternalError *__pyx_vtabptr_7pyarrow_7_flight_FlightInternalError;


/* "pyarrow/_flight.pyx":143
 * 
 * 
 * cdef class FlightTimedOutError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightTimedOutError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightTimedOutError *__pyx_vtabptr_7pyarrow_7_flight_FlightTimedOutError;


/* "pyarrow/_flight.pyx":148
 * 
 * 
 * cdef class FlightCancelledError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCancelledError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCancelledError *__pyx_vtabptr_7pyarrow_7_flight_FlightCancelledError;


/* "pyarrow/_flight.pyx":153
 * 
 * 
 * cdef class FlightServerError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerError *__pyx_vtabptr_7pyarrow_7_flight_FlightServerError;


/* "pyarrow/_flight.pyx":158
 * 
 * 
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthenticatedError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_vtabptr_7pyarrow_7_flight_FlightUnauthenticatedError;


/* "pyarrow/_flight.pyx":164
 * 
 * 
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthorizedError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_vtabptr_7pyarrow_7_flight_FlightUnauthorizedError;


/* "pyarrow/_flight.pyx":169
 * 
 * 
 * cdef class FlightUnavailableError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnavailableError {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnavailableError *__pyx_vtabptr_7pyarrow_7_flight_FlightUnavailableError;


/* "pyarrow/_flight.pyx":174
 * 
 * 
 * cdef class Action:             # <<<<<<<<<<<<<<
 *     """An action executable on a Flight service."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_Action {
   arrow::flight::Action (*unwrap)(struct __pyx_obj_7pyarrow_7_flight_Action *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_Action *__pyx_vtabptr_7pyarrow_7_flight_Action;


/* "pyarrow/_flight.pyx":345
 * 
 * 
 * cdef class FlightDescriptor:             # <<<<<<<<<<<<<<
 *     """A description of a data stream available from a Flight service."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDescriptor {
   arrow::flight::FlightDescriptor (*unwrap)(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDescriptor *__pyx_vtabptr_7pyarrow_7_flight_FlightDescriptor;


/* "pyarrow/_flight.pyx":491
 * 
 * 
 * cdef class Location:             # <<<<<<<<<<<<<<
 *     """The location of a Flight service."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_Location {
  struct __pyx_obj_7pyarrow_7_flight_Location *(*wrap)( arrow::flight::Location);
   arrow::flight::Location (*unwrap)(PyObject *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_Location *__pyx_vtabptr_7pyarrow_7_flight_Location;


/* "pyarrow/_flight.pyx":904
 * 
 * 
 * cdef class FlightClient:             # <<<<<<<<<<<<<<
 *     """A client to a Flight service.
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightClient {
  PyObject *(*init)(struct __pyx_obj_7pyarrow_7_flight_FlightClient *, struct __pyx_obj_7pyarrow_7_flight_Location *, PyObject *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightClient *__pyx_vtabptr_7pyarrow_7_flight_FlightClient;


/* "pyarrow/_flight.pyx":1182
 * 
 * 
 * cdef class FlightDataStream:             # <<<<<<<<<<<<<<
 *     """Abstract base class for Flight data streams."""
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream {
   arrow::flight::FlightDataStream *(*to_stream)(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream *__pyx_vtabptr_7pyarrow_7_flight_FlightDataStream;


/* "pyarrow/_flight.pyx":1194
 * 
 * 
 * cdef class RecordBatchStream(FlightDataStream):             # <<<<<<<<<<<<<<
 *     """A Flight data stream backed by RecordBatches."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_RecordBatchStream {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_RecordBatchStream *__pyx_vtabptr_7pyarrow_7_flight_RecordBatchStream;


/* "pyarrow/_flight.pyx":1226
 * 
 * 
 * cdef class GeneratorStream(FlightDataStream):             # <<<<<<<<<<<<<<
 *     """A Flight data stream backed by a Python generator."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_GeneratorStream {
  struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_GeneratorStream *__pyx_vtabptr_7pyarrow_7_flight_GeneratorStream;


/* "pyarrow/_flight.pyx":1256
 * 
 * 
 * cdef class ServerCallContext:             # <<<<<<<<<<<<<<
 *     """Per-call state/context."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ServerCallContext {
  struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *(*wrap)( arrow::flight::ServerCallContext const &);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerCallContext *__pyx_vtabptr_7pyarrow_7_flight_ServerCallContext;


/* "pyarrow/_flight.pyx":1294
 * 
 * 
 * cdef class ServerAuthReader:             # <<<<<<<<<<<<<<
 *     """A reader for messages from the client during an auth handshake."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader {
  void (*poison)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *);
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *(*wrap)( arrow::flight::ServerAuthReader *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader *__pyx_vtabptr_7pyarrow_7_flight_ServerAuthReader;


/* "pyarrow/_flight.pyx":1325
 * 
 * 
 * cdef class ServerAuthSender:             # <<<<<<<<<<<<<<
 *     """A writer for messages to the client during an auth handshake."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender {
  void (*poison)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *);
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *(*wrap)( arrow::flight::ServerAuthSender *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender *__pyx_vtabptr_7pyarrow_7_flight_ServerAuthSender;


/* "pyarrow/_flight.pyx":1355
 * 
 * 
 * cdef class ClientAuthReader:             # <<<<<<<<<<<<<<
 *     """A reader for messages from the server during an auth handshake."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader {
  void (*poison)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *);
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *(*wrap)( arrow::flight::ClientAuthReader *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader *__pyx_vtabptr_7pyarrow_7_flight_ClientAuthReader;


/* "pyarrow/_flight.pyx":1386
 * 
 * 
 * cdef class ClientAuthSender:             # <<<<<<<<<<<<<<
 *     """A writer for messages to the server during an auth handshake."""
 *     cdef:
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender {
  void (*poison)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *);
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *(*wrap)( arrow::flight::ClientAuthSender *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender *__pyx_vtabptr_7pyarrow_7_flight_ClientAuthSender;


/* "pyarrow/_flight.pyx":1819
 * 
 * 
 * cdef class ServerAuthHandler:             # <<<<<<<<<<<<<<
 *     """Authentication middleware for a server.
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthHandler {
   arrow::py::flight::PyServerAuthHandler *(*to_handler)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthHandler *__pyx_vtabptr_7pyarrow_7_flight_ServerAuthHandler;


/* "pyarrow/_flight.pyx":1863
 * 
 * 
 * cdef class ClientAuthHandler:             # <<<<<<<<<<<<<<
 *     """Authentication plugin for a client."""
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthHandler {
   arrow::py::flight::PyClientAuthHandler *(*to_handler)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthHandler *__pyx_vtabptr_7pyarrow_7_flight_ClientAuthHandler;


/* "pyarrow/_flight.pyx":1929
 * 
 * 
 * cdef class ClientMiddleware:             # <<<<<<<<<<<<<<
 *     """Client-side middleware for a call, instantiated per RPC.
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ClientMiddleware {
  void (*wrap)(PyObject *, std::unique_ptr< arrow::flight::ClientMiddleware>  *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientMiddleware *__pyx_vtabptr_7pyarrow_7_flight_ClientMiddleware;


/* "pyarrow/_flight.pyx":2024
 * 
 * 
 * cdef class ServerMiddleware:             # <<<<<<<<<<<<<<
 *     """Server-side middleware for a call, instantiated per RPC.
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware {
  void (*wrap)(PyObject *, std::shared_ptr< arrow::flight::ServerMiddleware>  *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware *__pyx_vtabptr_7pyarrow_7_flight_ServerMiddleware;


/* "pyarrow/_flight.pyx":2087
 * 
 * 
 * cdef class _ServerMiddlewareWrapper(ServerMiddleware):             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict middleware
 */

struct __pyx_vtabstruct_7pyarrow_7_flight__ServerMiddlewareWrapper {
  struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware __pyx_base;
};
static struct __pyx_vtabstruct_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_vtabptr_7pyarrow_7_flight__ServerMiddlewareWrapper;


/* "pyarrow/_flight.pyx":2113
 * 
 * 
 * cdef class FlightServerBase:             # <<<<<<<<<<<<<<
 *     """A Flight service definition.
 * 
 */

struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerBase {
  PyObject *(*init)(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *, struct __pyx_obj_7pyarrow_7_flight_Location *, struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerBase *__pyx_vtabptr_7pyarrow_7_flight_FlightServerBase;

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

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

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

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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

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

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

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

/* IncludeCppStringH.proto */
#include <string>

/* 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_cpp_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string(
         std::string cppstring, 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(
        cppstring.data(), cppstring.size(), start, stop, encoding, errors, decode_func);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* PyType_Ready.proto */
static int __Pyx_PyType_Ready(PyTypeObject *t);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

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

/* CythonFunction.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;
    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))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

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

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* ClassMethod.proto */
#include "descrobject.h"
static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);

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

/* None.proto */
#include <new>

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

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

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

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

/* None.proto */
static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); /* proto */

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(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)

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

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

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

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

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

/* 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  arrow::flight::FlightCallOptions *__pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_obj); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_11FlightError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_19FlightInternalError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_19FlightTimedOutError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_20FlightCancelledError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_17FlightServerError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_26FlightUnauthenticatedError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_23FlightUnauthorizedError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v_self); /* proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight_22FlightUnavailableError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v_self); /* proto*/
static  arrow::flight::Action __pyx_f_7pyarrow_7_flight_6Action_unwrap(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_action); /* proto*/
static  arrow::flight::FlightDescriptor __pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_f_7pyarrow_7_flight_8Location_wrap( arrow::flight::Location __pyx_v_location); /* proto*/
static  arrow::flight::Location __pyx_f_7pyarrow_7_flight_8Location_unwrap(PyObject *__pyx_v_location); /* proto*/
static PyObject *__pyx_f_7pyarrow_7_flight_12FlightClient_init(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware); /* proto*/
static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_16FlightDataStream_to_stream(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v_self); /* proto*/
static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_17RecordBatchStream_to_stream(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self); /* proto*/
static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_15GeneratorStream_to_stream(struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap( arrow::flight::ServerCallContext const &__pyx_v_context); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ServerAuthReader_poison(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_f_7pyarrow_7_flight_16ServerAuthReader_wrap( arrow::flight::ServerAuthReader *__pyx_v_reader); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ServerAuthSender_poison(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_f_7pyarrow_7_flight_16ServerAuthSender_wrap( arrow::flight::ServerAuthSender *__pyx_v_sender); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ClientAuthReader_poison(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_f_7pyarrow_7_flight_16ClientAuthReader_wrap( arrow::flight::ClientAuthReader *__pyx_v_reader); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ClientAuthSender_poison(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self); /* proto*/
static struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_f_7pyarrow_7_flight_16ClientAuthSender_wrap( arrow::flight::ClientAuthSender *__pyx_v_sender); /* proto*/
static  arrow::py::flight::PyServerAuthHandler *__pyx_f_7pyarrow_7_flight_17ServerAuthHandler_to_handler(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self); /* proto*/
static  arrow::py::flight::PyClientAuthHandler *__pyx_f_7pyarrow_7_flight_17ClientAuthHandler_to_handler(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ClientMiddleware_wrap(PyObject *__pyx_v_py_middleware, std::unique_ptr< arrow::flight::ClientMiddleware>  *__pyx_v_c_instance); /* proto*/
static void __pyx_f_7pyarrow_7_flight_16ServerMiddleware_wrap(PyObject *__pyx_v_py_middleware, std::shared_ptr< arrow::flight::ServerMiddleware>  *__pyx_v_c_instance); /* proto*/
static PyObject *__pyx_f_7pyarrow_7_flight_16FlightServerBase_init(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_location, struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_auth_handler, PyObject *__pyx_v_tls_certificates, PyObject *__pyx_v_middleware); /* proto*/

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

/* Module declarations from 'libcpp.cast' */

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

/* Module declarations from 'libcpp.memory' */

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

/* Module declarations from 'libcpp.utility' */

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'libcpp.unordered_map' */

/* Module declarations from 'libcpp.unordered_set' */

/* Module declarations from 'datetime' */

/* Module declarations from 'cpython.datetime' */
static PyTypeObject *__pyx_ptype_7cpython_8datetime_date = 0;
static PyTypeObject *__pyx_ptype_7cpython_8datetime_time = 0;
static PyTypeObject *__pyx_ptype_7cpython_8datetime_datetime = 0;
static PyTypeObject *__pyx_ptype_7cpython_8datetime_timedelta = 0;
static PyTypeObject *__pyx_ptype_7cpython_8datetime_tzinfo = 0;

/* Module declarations from 'pyarrow.includes.common' */

/* Module declarations from 'pyarrow.includes.libarrow' */

/* Module declarations from 'pyarrow.lib' */
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Message = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_MemoryPool = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DataType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ListType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_LargeListType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_MapType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeListType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_StructType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DictionaryMemo = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DictionaryType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_TimestampType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Time32Type = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Time64Type = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DurationType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Decimal128Type = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_BaseExtensionType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ExtensionType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_PyExtensionType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Field = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Schema = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Scalar = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_NAType = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ArrayValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ScalarValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int8Value = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int64Value = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ListValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_LargeListValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_MapValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeListValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_StructValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UnionValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_StringValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryValue = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib__PandasConvertible = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Tensor = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_SparseCSRMatrix = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_SparseCOOTensor = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_NullArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_BooleanArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_NumericArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_IntegerArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FloatingPointArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int8Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UInt8Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int16Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UInt16Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int32Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UInt32Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Int64Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UInt64Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_HalfFloatArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FloatArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DoubleArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Decimal128Array = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_StructArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ListArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_LargeListArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_MapArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_FixedSizeListArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_UnionArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_StringArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_BinaryArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_DictionaryArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ExtensionArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ChunkedArray = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Table = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_RecordBatch = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_Buffer = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_ResizableBuffer = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_NativeFile = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_BufferedInputStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_BufferedOutputStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_CompressedInputStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_CompressedOutputStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib__CRecordBatchWriter = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib__CRecordBatchReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_3lib_CastOptions = 0;
static int (*__pyx_f_7pyarrow_3lib_check_status)(arrow::Status const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_scalar)(std::shared_ptr< arrow::Scalar>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_array)(std::shared_ptr< arrow::Array>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_chunked_array)(std::shared_ptr< arrow::ChunkedArray>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_batch)(std::shared_ptr< arrow::RecordBatch>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer)(std::shared_ptr< arrow::Buffer>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_data_type)(std::shared_ptr< arrow::DataType>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_field)(std::shared_ptr< arrow::Field>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_resizable_buffer)(std::shared_ptr< arrow::ResizableBuffer>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_schema)(std::shared_ptr< arrow::Schema>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_table)(std::shared_ptr< arrow::Table>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_tensor)(std::shared_ptr< arrow::Tensor>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_sparse_coo_tensor)(std::shared_ptr< arrow::SparseCOOTensor>  const &); /*proto*/
static PyObject *(*__pyx_f_7pyarrow_3lib_pyarrow_wrap_sparse_csr_matrix)(std::shared_ptr< arrow::SparseCSRMatrix>  const &); /*proto*/
static std::shared_ptr< arrow::Scalar>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_scalar)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Array>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_array)(PyObject *); /*proto*/
static std::shared_ptr< arrow::RecordBatch>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_batch)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Buffer>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer)(PyObject *); /*proto*/
static std::shared_ptr< arrow::DataType>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_data_type)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Field>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_field)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Schema>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Table>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_table)(PyObject *); /*proto*/
static std::shared_ptr< arrow::Tensor>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_tensor)(PyObject *); /*proto*/
static std::shared_ptr< arrow::SparseCOOTensor>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_sparse_coo_tensor)(PyObject *); /*proto*/
static std::shared_ptr< arrow::SparseCSRMatrix>  (*__pyx_f_7pyarrow_3lib_pyarrow_unwrap_sparse_csr_matrix)(PyObject *); /*proto*/

/* Module declarations from 'libcpp.functional' */

/* Module declarations from 'pyarrow.includes.libarrow_flight' */

/* Module declarations from 'pyarrow._flight' */
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightCallOptions = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightInternalError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightTimedOutError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightCancelledError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightServerError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightUnauthenticatedError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightUnauthorizedError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightUnavailableError = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_Action = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_Result = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_BasicAuth = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightDescriptor = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_Ticket = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_Location = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightEndpoint = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_SchemaResult = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightInfo = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightStreamChunk = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_MetadataRecordBatchReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightStreamReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightStreamWriter = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightMetadataReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightMetadataWriter = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightClient = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightDataStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_RecordBatchStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_GeneratorStream = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerCallContext = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerAuthReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerAuthSender = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ClientAuthReader = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ClientAuthSender = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerAuthHandler = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ClientAuthHandler = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ClientMiddlewareFactory = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ClientMiddleware = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_ServerMiddleware = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareWrapper = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight_FlightServerBase = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_1_do_action = 0;
static PyTypeObject *__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_2_list_flights = 0;
static  arrow::flight::FlightCallOptions __pyx_v_7pyarrow_7_flight_DEFAULT_CALL_OPTIONS;
static int __pyx_f_7pyarrow_7_flight_check_flight_status(arrow::Status const &); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight_wrap_flight_method( arrow::flight::FlightMethod); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__data_stream_next(void *,  arrow::flight::FlightPayload *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__list_flights(void *,  arrow::flight::ServerCallContext const &,  arrow::flight::Criteria const *, std::unique_ptr< arrow::flight::FlightListing>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__get_flight_info(void *,  arrow::flight::ServerCallContext const &,  arrow::flight::FlightDescriptor, std::unique_ptr< arrow::flight::FlightInfo>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__get_schema(void *,  arrow::flight::ServerCallContext const &,  arrow::flight::FlightDescriptor, std::unique_ptr< arrow::flight::SchemaResult>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__do_put(void *,  arrow::flight::ServerCallContext const &, std::unique_ptr< arrow::flight::FlightMessageReader> , std::unique_ptr< arrow::flight::FlightMetadataWriter> ); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__do_get(void *,  arrow::flight::ServerCallContext const &,  arrow::flight::Ticket, std::unique_ptr< arrow::flight::FlightDataStream>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__do_action_result_next(void *, std::unique_ptr< arrow::flight::Result>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__do_action(void *,  arrow::flight::ServerCallContext const &,  arrow::flight::Action const &, std::unique_ptr< arrow::flight::ResultStream>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__list_actions(void *,  arrow::flight::ServerCallContext const &, std::vector< arrow::flight::ActionType>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__server_authenticate(void *,  arrow::flight::ServerAuthSender *,  arrow::flight::ServerAuthReader *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__is_valid(void *, std::string const &, std::string *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__client_authenticate(void *,  arrow::flight::ClientAuthSender *,  arrow::flight::ClientAuthReader *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__get_token(void *, std::string *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_sending_headers(void *,  arrow::flight::AddCallHeaders *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_call_completed(void *, arrow::Status const &); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_received_headers(void *,  arrow::flight::CallHeaders const &); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight_convert_headers( arrow::flight::CallHeaders const &); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__server_middleware_start_call(void *,  arrow::flight::CallInfo const &,  arrow::flight::CallHeaders const &, std::shared_ptr< arrow::flight::ServerMiddleware>  *); /*proto*/
static arrow::Status __pyx_f_7pyarrow_7_flight__client_middleware_start_call(void *,  arrow::flight::CallInfo const &, std::unique_ptr< arrow::flight::ClientMiddleware>  *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight_wrap_call_info( arrow::flight::CallInfo const &); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightInternalError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightTimedOutError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightCancelledError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightServerError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthenticatedError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthorizedError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnavailableError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightDataStream__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_RecordBatchStream__set_state(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerAuthHandler__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientAuthHandler__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddlewareFactory__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddleware__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddlewareFactory__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddleware__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *, PyObject *); /*proto*/
static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareWrapper__set_state(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &); /*proto*/
#define __Pyx_MODULE_NAME "pyarrow._flight"
extern int __pyx_module_is_main_pyarrow___flight;
int __pyx_module_is_main_pyarrow___flight = 0;

/* Implementation of 'pyarrow._flight' */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static const char __pyx_k_m[] = "m";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_CMD[] = "CMD";
static const char __pyx_k__37[] = "";
static const char __pyx_k__66[] = "*";
static const char __pyx_k_bin[] = "-bin";
static const char __pyx_k_buf[] = "buf";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_lib[] = "lib";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_six[] = "six";
static const char __pyx_k_uri[] = "uri";
static const char __pyx_k_Enum[] = "Enum";
static const char __pyx_k_PATH[] = "PATH";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_auth[] = "auth";
static const char __pyx_k_cert[] = "cert";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_enum[] = "enum";
static const char __pyx_k_host[] = "host";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_port[] = "port";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_wait[] = "wait";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_Table[] = "Table";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_batch[] = "batch";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_match[] = "match";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_serve[] = "serve";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_Action[] = "Action";
static const char __pyx_k_DOTALL[] = "DOTALL";
static const char __pyx_k_DO_GET[] = "DO_GET";
static const char __pyx_k_DO_PUT[] = "DO_PUT";
static const char __pyx_k_Result[] = "Result";
static const char __pyx_k_Ticket[] = "<Ticket {}>";
static const char __pyx_k_action[] = "action";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_c_host[] = "c_host";
static const char __pyx_k_c_path[] = "c_path";
static const char __pyx_k_c_port[] = "c_port";
static const char __pyx_k_do_get[] = "do_get";
static const char __pyx_k_do_put[] = "do_put";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_reader[] = "reader";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_schema[] = "schema";
static const char __pyx_k_socket[] = "socket";
static const char __pyx_k_string[] = "string";
static const char __pyx_k_ticket[] = "ticket";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_writer[] = "writer";
static const char __pyx_k_INVALID[] = "INVALID";
static const char __pyx_k_UNKNOWN[] = "UNKNOWN";
static const char __pyx_k_command[] = "command";
static const char __pyx_k_compile[] = "compile";
static const char __pyx_k_connect[] = "connect";
static const char __pyx_k_context[] = "context";
static const char __pyx_k_headers[] = "headers";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_timeout[] = "timeout";
static const char __pyx_k_tobytes[] = "tobytes";
static const char __pyx_k_CallInfo[] = "CallInfo";
static const char __pyx_k_Location[] = "<Location {}>";
static const char __pyx_k_Ticket_2[] = "Ticket";
static const char __pyx_k_criteria[] = "criteria";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_exc_type[] = "exc_type";
static const char __pyx_k_for_path[] = "for_path";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_incoming[] = "incoming";
static const char __pyx_k_is_valid[] = "is_valid";
static const char __pyx_k_location[] = "location";
static const char __pyx_k_outgoing[] = "outgoing";
static const char __pyx_k_password[] = "password";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_shutdown[] = "shutdown";
static const char __pyx_k_username[] = "username";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_BasicAuth[] = "BasicAuth";
static const char __pyx_k_DO_ACTION[] = "DO_ACTION";
static const char __pyx_k_HANDSHAKE[] = "HANDSHAKE";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_as_buffer[] = "as_buffer";
static const char __pyx_k_do_action[] = "do_action";
static const char __pyx_k_endpoints[] = "endpoints";
static const char __pyx_k_exc_value[] = "exc_value";
static const char __pyx_k_factories[] = "factories";
static const char __pyx_k_frombytes[] = "frombytes";
static const char __pyx_k_generator[] = "generator";
static const char __pyx_k_get_token[] = "get_token";
static const char __pyx_k_localhost[] = "localhost";
static const char __pyx_k_locations[] = "locations";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_text_type[] = "text_type";
static const char __pyx_k_threading[] = "threading";
static const char __pyx_k_traceback[] = "traceback";
static const char __pyx_k_ActionType[] = "ActionType";
static const char __pyx_k_CallInfo_2[] = "_CallInfo";
static const char __pyx_k_FlightInfo[] = "FlightInfo";
static const char __pyx_k_GET_SCHEMA[] = "GET_SCHEMA";
static const char __pyx_k_Location_2[] = "Location";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_contextlib[] = "contextlib";
static const char __pyx_k_descriptor[] = "descriptor";
static const char __pyx_k_get_schema[] = "get_schema";
static const char __pyx_k_middleware[] = "middleware";
static const char __pyx_k_namedtuple[] = "namedtuple";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_read_chunk[] = "read_chunk";
static const char __pyx_k_start_call[] = "start_call";
static const char __pyx_k_CertKeyPair[] = "_CertKeyPair";
static const char __pyx_k_FlightError[] = "FlightError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_action_type[] = "action_type";
static const char __pyx_k_binary_type[] = "binary_type";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_data_source[] = "data_source";
static const char __pyx_k_defaultdict[] = "defaultdict";
static const char __pyx_k_description[] = "description";
static const char __pyx_k_deserialize[] = "deserialize";
static const char __pyx_k_for_command[] = "for_command";
static const char __pyx_k_make_action[] = "make_action";
static const char __pyx_k_pyarrow_ipc[] = "pyarrow.ipc";
static const char __pyx_k_pyarrow_lib[] = "pyarrow.lib";
static const char __pyx_k_total_bytes[] = "total_bytes";
static const char __pyx_k_ActionType_2[] = "_ActionType";
static const char __pyx_k_FlightClient[] = "FlightClient";
static const char __pyx_k_FlightMethod[] = "FlightMethod";
static const char __pyx_k_Flight_error[] = "Flight error: {}";
static const char __pyx_k_LIST_ACTIONS[] = "LIST_ACTIONS";
static const char __pyx_k_LIST_FLIGHTS[] = "LIST_FLIGHTS";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_SchemaResult[] = "SchemaResult";
static const char __pyx_k_app_metadata[] = "app_metadata";
static const char __pyx_k_auth_handler[] = "auth_handler";
static const char __pyx_k_authenticate[] = "authenticate";
static const char __pyx_k_for_grpc_tcp[] = "for_grpc_tcp";
static const char __pyx_k_for_grpc_tls[] = "for_grpc_tls";
static const char __pyx_k_list_actions[] = "list_actions";
static const char __pyx_k_list_flights[] = "list_flights";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_string_types[] = "string_types";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_CertKeyPair_2[] = "CertKeyPair";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_for_grpc_unix[] = "for_grpc_unix";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_total_records[] = "total_records";
static const char __pyx_k_ArrowException[] = "ArrowException";
static const char __pyx_k_DescriptorType[] = "DescriptorType";
static const char __pyx_k_FlightEndpoint[] = "FlightEndpoint";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_call_completed[] = "call_completed";
static const char __pyx_k_pyarrow_compat[] = "pyarrow.compat";
static const char __pyx_k_tls_root_certs[] = "tls_root_certs";
static const char __pyx_k_GET_FLIGHT_INFO[] = "GET_FLIGHT_INFO";
static const char __pyx_k_GeneratorStream[] = "GeneratorStream";
static const char __pyx_k_descriptor_type[] = "descriptor_type";
static const char __pyx_k_get_flight_info[] = "get_flight_info";
static const char __pyx_k_pyarrow__flight[] = "pyarrow._flight";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_sending_headers[] = "sending_headers";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_ClientAuthReader[] = "ClientAuthReader";
static const char __pyx_k_ClientAuthSender[] = "ClientAuthSender";
static const char __pyx_k_ClientMiddleware[] = "ClientMiddleware";
static const char __pyx_k_FlightDataStream[] = "FlightDataStream";
static const char __pyx_k_FlightDescriptor[] = "FlightDescriptor";
static const char __pyx_k_FlightServerBase[] = "FlightServerBase";
static const char __pyx_k_ReadPandasOption[] = "_ReadPandasOption";
static const char __pyx_k_ServerAuthReader[] = "ServerAuthReader";
static const char __pyx_k_ServerAuthSender[] = "ServerAuthSender";
static const char __pyx_k_ServerMiddleware[] = "ServerMiddleware";
static const char __pyx_k_received_headers[] = "received_headers";
static const char __pyx_k_tls_certificates[] = "tls_certificates";
static const char __pyx_k_ClientAuthHandler[] = "ClientAuthHandler";
static const char __pyx_k_FlightCallOptions[] = "FlightCallOptions";
static const char __pyx_k_FlightServerError[] = "FlightServerError";
static const char __pyx_k_FlightStreamChunk[] = "FlightStreamChunk";
static const char __pyx_k_RecordBatchStream[] = "RecordBatchStream";
static const char __pyx_k_ServerAuthHandler[] = "ServerAuthHandler";
static const char __pyx_k_ServerCallContext[] = "ServerCallContext";
static const char __pyx_k_override_hostname[] = "override_hostname";
static const char __pyx_k_FlightStreamReader[] = "FlightStreamReader";
static const char __pyx_k_FlightStreamWriter[] = "FlightStreamWriter";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_FlightInternalError[] = "FlightInternalError";
static const char __pyx_k_FlightTimedOutError[] = "FlightTimedOutError";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_pyarrow__flight_pyx[] = "pyarrow\\_flight.pyx";
static const char __pyx_k_FlightCancelledError[] = "FlightCancelledError";
static const char __pyx_k_FlightMetadataReader[] = "FlightMetadataReader";
static const char __pyx_k_FlightMetadataWriter[] = "FlightMetadataWriter";
static const char __pyx_k_ActionType_make_action[] = "ActionType.make_action";
static const char __pyx_k_FlightClient_do_action[] = "FlightClient.do_action";
static const char __pyx_k_FlightUnavailableError[] = "FlightUnavailableError";
static const char __pyx_k_ClientMiddlewareFactory[] = "ClientMiddlewareFactory";
static const char __pyx_k_FlightDescriptor_path_r[] = "<FlightDescriptor path: {!r}>";
static const char __pyx_k_FlightDescriptor_type_r[] = "<FlightDescriptor type: {!r}>";
static const char __pyx_k_FlightUnauthorizedError[] = "FlightUnauthorizedError";
static const char __pyx_k_Invalid_descriptor_type[] = "Invalid descriptor type!";
static const char __pyx_k_Must_provide_Action_not[] = "Must provide Action, not '{}'";
static const char __pyx_k_ServerMiddlewareFactory[] = "ServerMiddlewareFactory";
static const char __pyx_k_ServerMiddlewareWrapper[] = "_ServerMiddlewareWrapper";
static const char __pyx_k_munge_grpc_python_error[] = "_munge_grpc_python_error";
static const char __pyx_k_pyx_unpickle_FlightError[] = "__pyx_unpickle_FlightError";
static const char __pyx_k_FLIGHT_SERVER_ERROR_REGEX[] = "_FLIGHT_SERVER_ERROR_REGEX";
static const char __pyx_k_FlightClient_list_flights[] = "FlightClient.list_flights";
static const char __pyx_k_MetadataRecordBatchReader[] = "_MetadataRecordBatchReader";
static const char __pyx_k_FlightDescriptor_command_r[] = "<FlightDescriptor command: {!r}>";
static const char __pyx_k_FlightUnauthenticatedError[] = "FlightUnauthenticatedError";
static const char __pyx_k_MetadataRecordBatchReader_2[] = "MetadataRecordBatchReader";
static const char __pyx_k_Must_provide_a_Location_not[] = "Must provide a Location, not '{}'";
static const char __pyx_k_pyx_unpickle_ClientMiddleware[] = "__pyx_unpickle_ClientMiddleware";
static const char __pyx_k_pyx_unpickle_FlightDataStream[] = "__pyx_unpickle_FlightDataStream";
static const char __pyx_k_pyx_unpickle_ServerMiddleware[] = "__pyx_unpickle_ServerMiddleware";
static const char __pyx_k_ServerMiddlewareFactoryWrapper[] = "_ServerMiddlewareFactoryWrapper";
static const char __pyx_k_The_type_of_a_FlightDescriptor[] = "\n    The type of a FlightDescriptor.\n\n    Attributes\n    ----------\n\n    UNKNOWN\n        An unknown descriptor type.\n\n    PATH\n        A Flight stream represented by a path.\n\n    CMD\n        A Flight stream represented by an application-defined command.\n\n    ";
static const char __pyx_k_pyx_unpickle_ClientAuthHandler[] = "__pyx_unpickle_ClientAuthHandler";
static const char __pyx_k_pyx_unpickle_ClientMiddlewareF[] = "__pyx_unpickle_ClientMiddlewareFactory";
static const char __pyx_k_pyx_unpickle_FlightCancelledEr[] = "__pyx_unpickle_FlightCancelledError";
static const char __pyx_k_pyx_unpickle_FlightInternalErr[] = "__pyx_unpickle_FlightInternalError";
static const char __pyx_k_pyx_unpickle_FlightServerError[] = "__pyx_unpickle_FlightServerError";
static const char __pyx_k_pyx_unpickle_FlightTimedOutErr[] = "__pyx_unpickle_FlightTimedOutError";
static const char __pyx_k_pyx_unpickle_FlightUnauthentic[] = "__pyx_unpickle_FlightUnauthenticatedError";
static const char __pyx_k_pyx_unpickle_FlightUnauthorize[] = "__pyx_unpickle_FlightUnauthorizedError";
static const char __pyx_k_pyx_unpickle_FlightUnavailable[] = "__pyx_unpickle_FlightUnavailableError";
static const char __pyx_k_pyx_unpickle_RecordBatchStream[] = "__pyx_unpickle_RecordBatchStream";
static const char __pyx_k_pyx_unpickle_ServerAuthHandler[] = "__pyx_unpickle_ServerAuthHandler";
static const char __pyx_k_pyx_unpickle_ServerMiddlewareF[] = "__pyx_unpickle_ServerMiddlewareFactory";
static const char __pyx_k_pyx_unpickle__ServerMiddleware[] = "__pyx_unpickle__ServerMiddlewareFactoryWrapper";
static const char __pyx_k_FlightClient_authenticate_takes[] = "FlightClient.authenticate takes a ClientAuthHandler, not '{}'";
static const char __pyx_k_FlightEndpoint_ticket_r_locatio[] = "<FlightEndpoint ticket: {!r} locations: {!r}>";
static const char __pyx_k_Must_provide_a_FlightDescriptor[] = "Must provide a FlightDescriptor, not '{}'";
static const char __pyx_k_Results_of_list_actions_must_be[] = "Results of list_actions must be ActionType or tuple";
static const char __pyx_k_The_FlightClient_connect_method[] = "The 'FlightClient.connect' method is deprecated, use FlightClient constructor or pyarrow.flight.connect function instead";
static const char __pyx_k_location_argument_must_be_a_str[] = "`location` argument must be a string, tuple or a Location instance";
static const char __pyx_k_self_action_cannot_be_converted[] = "self.action cannot be converted to a Python object for pickling";
static const char __pyx_k_self_client_cannot_be_converted[] = "self.client cannot be converted to a Python object for pickling";
static const char __pyx_k_self_current_stream_self_schema[] = "self.current_stream,self.schema cannot be converted to a Python object for pickling";
static const char __pyx_k_self_reader_cannot_be_converted[] = "self.reader cannot be converted to a Python object for pickling";
static const char __pyx_k_self_result_cannot_be_converted[] = "self.result cannot be converted to a Python object for pickling";
static const char __pyx_k_self_sender_cannot_be_converted[] = "self.sender cannot be converted to a Python object for pickling";
static const char __pyx_k_self_server_cannot_be_converted[] = "self.server cannot be converted to a Python object for pickling";
static const char __pyx_k_self_ticket_cannot_be_converted[] = "self.ticket cannot be converted to a Python object for pickling";
static const char __pyx_k_self_writer_cannot_be_converted[] = "self.writer cannot be converted to a Python object for pickling";
static const char __pyx_k_A_TLS_certificate_and_key_for_us[] = "A TLS certificate and key for use in Flight.";
static const char __pyx_k_A_type_of_action_that_is_executa[] = "A type of action that is executable on a Flight service.";
static const char __pyx_k_Action_must_be_Action_instance_s[] = "Action must be Action instance, string, or tuple";
static const char __pyx_k_Can_only_return_metadata_alongsi[] = "Can only return metadata alongside a RecordBatch.";
static const char __pyx_k_Can_t_construct_RecordBatchStrea[] = "Can't construct RecordBatchStream from type {}";
static const char __pyx_k_Cannot_use_ClientAuthReader_outs[] = "Cannot use ClientAuthReader outside ClientAuthHandler.authenticate";
static const char __pyx_k_Cannot_use_ClientAuthSender_outs[] = "Cannot use ClientAuthSender outside ClientAuthHandler.authenticate";
static const char __pyx_k_Cannot_use_ServerAuthReader_outs[] = "Cannot use ServerAuthReader outside ServerAuthHandler.authenticate";
static const char __pyx_k_Cannot_use_ServerAuthSender_outs[] = "Cannot use ServerAuthSender outside ServerAuthHandler.authenticate";
static const char __pyx_k_Do_not_call_s_constructor_direct[] = "Do not call {}'s constructor directly, use `pyarrow.flight.FlightDescriptor.for_{path,command}` function instead.";
static const char __pyx_k_Endpoint_is_not_instance_of_Flig[] = "Endpoint {} is not instance of FlightEndpoint";
static const char __pyx_k_Expected_RecordBatchReader_or_Ta[] = "Expected RecordBatchReader or Table, but got: {}";
static const char __pyx_k_Expected_a_FlightCallOptions_obj[] = "Expected a FlightCallOptions object, not '{}'";
static const char __pyx_k_FlightServerBase_do_get_must_ret[] = "FlightServerBase.do_get must return a FlightDataStream";
static const char __pyx_k_FlightServerBase_get_flight_info[] = "FlightServerBase.get_flight_info must return a FlightInfo instance, but got {}";
static const char __pyx_k_FlightServerBase_get_schema_info[] = "FlightServerBase.get_schema_info must return a SchemaResult instance, but got {}";
static const char __pyx_k_FlightServerBase_list_flights_mu[] = "FlightServerBase.list_flights must return FlightInfo instances, but got {}";
static const char __pyx_k_Flight_RPC_failed_with_Python_ex[] = "Flight RPC failed with Python exception \"{}: {}\"";
static const char __pyx_k_Flight_RPC_failed_with_message_D[] = "Flight RPC failed with message: (.*). Detail: Python exception: (.*)";
static const char __pyx_k_GeneratorStream_must_be_initiali[] = "GeneratorStream must be initialized with an iterator of FlightDataStream, Table, RecordBatch, or RecordBatchStreamReader objects, not {}.";
static const char __pyx_k_Got_a_FlightDataStream_whose_sch[] = "Got a FlightDataStream whose schema does not match the declared schema of this GeneratorStream. Got: {}\nExpected: {}";
static const char __pyx_k_Got_a_RecordBatch_whose_schema_d[] = "Got a RecordBatch whose schema does not match the declared schema of this GeneratorStream. Got: {}\nExpected: {}";
static const char __pyx_k_Incompatible_checksums_s_vs_0x06[] = "Incompatible checksums (%s vs 0x060e9a6 = (data_source))";
static const char __pyx_k_Incompatible_checksums_s_vs_0x0f[] = "Incompatible checksums (%s vs 0x0f695c4 = (factories))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xb2[] = "Incompatible checksums (%s vs 0xb200f06 = (middleware))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
static const char __pyx_k_Information_about_a_particular_R[] = "Information about a particular RPC for Flight middleware.";
static const char __pyx_k_MetadataRecordBatchReader___iter[] = "MetadataRecordBatchReader.__iter__";
static const char __pyx_k_The_FlightServer_run_method_is_d[] = "The 'FlightServer.run' method is deprecated, use FlightServer.serve method instead";
static const char __pyx_k_The_implemented_methods_in_Fligh[] = "The implemented methods in Flight.";
static const char __pyx_k_auth_handler_must_be_a_ServerAut[] = "auth_handler must be a ServerAuthHandler, not a '{}'";
static const char __pyx_k_pyx_unpickle__ServerMiddleware_2[] = "__pyx_unpickle__ServerMiddlewareWrapper";
static const char __pyx_k_run_on_uninitialized_FlightServe[] = "run() on uninitialized FlightServerBase";
static const char __pyx_k_self_basic_auth_cannot_be_conver[] = "self.basic_auth cannot be converted to a Python object for pickling";
static const char __pyx_k_self_chunk_cannot_be_converted_t[] = "self.chunk cannot be converted to a Python object for pickling";
static const char __pyx_k_self_context_cannot_be_converted[] = "self.context cannot be converted to a Python object for pickling";
static const char __pyx_k_self_descriptor_cannot_be_conver[] = "self.descriptor cannot be converted to a Python object for pickling";
static const char __pyx_k_self_endpoint_cannot_be_converte[] = "self.endpoint cannot be converted to a Python object for pickling";
static const char __pyx_k_self_info_cannot_be_converted_to[] = "self.info cannot be converted to a Python object for pickling";
static const char __pyx_k_self_location_cannot_be_converte[] = "self.location cannot be converted to a Python object for pickling";
static const char __pyx_k_self_object_in_callback_is_not_G[] = "self object in callback is not GeneratorStream";
static const char __pyx_k_self_options_cannot_be_converted[] = "self.options cannot be converted to a Python object for pickling";
static const char __pyx_k_shutdown_on_uninitialized_Flight[] = "shutdown() on uninitialized FlightServerBase";
static PyObject *__pyx_kp_s_A_TLS_certificate_and_key_for_us;
static PyObject *__pyx_kp_s_A_type_of_action_that_is_executa;
static PyObject *__pyx_n_s_Action;
static PyObject *__pyx_n_s_ActionType;
static PyObject *__pyx_n_s_ActionType_2;
static PyObject *__pyx_n_u_ActionType_2;
static PyObject *__pyx_n_s_ActionType_make_action;
static PyObject *__pyx_kp_u_Action_must_be_Action_instance_s;
static PyObject *__pyx_n_s_ArrowException;
static PyObject *__pyx_n_s_BasicAuth;
static PyObject *__pyx_n_s_CMD;
static PyObject *__pyx_n_s_CallInfo;
static PyObject *__pyx_n_s_CallInfo_2;
static PyObject *__pyx_n_u_CallInfo_2;
static PyObject *__pyx_kp_u_Can_only_return_metadata_alongsi;
static PyObject *__pyx_kp_u_Can_t_construct_RecordBatchStrea;
static PyObject *__pyx_kp_u_Cannot_use_ClientAuthReader_outs;
static PyObject *__pyx_kp_u_Cannot_use_ClientAuthSender_outs;
static PyObject *__pyx_kp_u_Cannot_use_ServerAuthReader_outs;
static PyObject *__pyx_kp_u_Cannot_use_ServerAuthSender_outs;
static PyObject *__pyx_n_s_CertKeyPair;
static PyObject *__pyx_n_u_CertKeyPair;
static PyObject *__pyx_n_s_CertKeyPair_2;
static PyObject *__pyx_n_s_ClientAuthHandler;
static PyObject *__pyx_n_s_ClientAuthReader;
static PyObject *__pyx_n_s_ClientAuthSender;
static PyObject *__pyx_n_s_ClientMiddleware;
static PyObject *__pyx_n_s_ClientMiddlewareFactory;
static PyObject *__pyx_n_s_DOTALL;
static PyObject *__pyx_n_s_DO_ACTION;
static PyObject *__pyx_n_s_DO_GET;
static PyObject *__pyx_n_s_DO_PUT;
static PyObject *__pyx_n_s_DescriptorType;
static PyObject *__pyx_kp_u_Do_not_call_s_constructor_direct;
static PyObject *__pyx_kp_u_Endpoint_is_not_instance_of_Flig;
static PyObject *__pyx_n_s_Enum;
static PyObject *__pyx_kp_u_Expected_RecordBatchReader_or_Ta;
static PyObject *__pyx_kp_u_Expected_a_FlightCallOptions_obj;
static PyObject *__pyx_n_s_FLIGHT_SERVER_ERROR_REGEX;
static PyObject *__pyx_n_s_FlightCallOptions;
static PyObject *__pyx_n_s_FlightCancelledError;
static PyObject *__pyx_n_s_FlightClient;
static PyObject *__pyx_kp_u_FlightClient_authenticate_takes;
static PyObject *__pyx_n_s_FlightClient_do_action;
static PyObject *__pyx_n_s_FlightClient_list_flights;
static PyObject *__pyx_n_s_FlightDataStream;
static PyObject *__pyx_n_s_FlightDescriptor;
static PyObject *__pyx_kp_u_FlightDescriptor_command_r;
static PyObject *__pyx_kp_u_FlightDescriptor_path_r;
static PyObject *__pyx_kp_u_FlightDescriptor_type_r;
static PyObject *__pyx_n_s_FlightEndpoint;
static PyObject *__pyx_kp_u_FlightEndpoint_ticket_r_locatio;
static PyObject *__pyx_n_s_FlightError;
static PyObject *__pyx_n_s_FlightInfo;
static PyObject *__pyx_n_s_FlightInternalError;
static PyObject *__pyx_n_s_FlightMetadataReader;
static PyObject *__pyx_n_s_FlightMetadataWriter;
static PyObject *__pyx_n_s_FlightMethod;
static PyObject *__pyx_n_s_FlightServerBase;
static PyObject *__pyx_kp_u_FlightServerBase_do_get_must_ret;
static PyObject *__pyx_kp_u_FlightServerBase_get_flight_info;
static PyObject *__pyx_kp_u_FlightServerBase_get_schema_info;
static PyObject *__pyx_kp_u_FlightServerBase_list_flights_mu;
static PyObject *__pyx_n_s_FlightServerError;
static PyObject *__pyx_n_s_FlightStreamChunk;
static PyObject *__pyx_n_s_FlightStreamReader;
static PyObject *__pyx_n_s_FlightStreamWriter;
static PyObject *__pyx_n_s_FlightTimedOutError;
static PyObject *__pyx_n_s_FlightUnauthenticatedError;
static PyObject *__pyx_n_s_FlightUnauthorizedError;
static PyObject *__pyx_n_s_FlightUnavailableError;
static PyObject *__pyx_kp_u_Flight_RPC_failed_with_Python_ex;
static PyObject *__pyx_kp_u_Flight_RPC_failed_with_message_D;
static PyObject *__pyx_kp_u_Flight_error;
static PyObject *__pyx_n_s_GET_FLIGHT_INFO;
static PyObject *__pyx_n_s_GET_SCHEMA;
static PyObject *__pyx_n_s_GeneratorStream;
static PyObject *__pyx_kp_u_GeneratorStream_must_be_initiali;
static PyObject *__pyx_kp_u_Got_a_FlightDataStream_whose_sch;
static PyObject *__pyx_kp_u_Got_a_RecordBatch_whose_schema_d;
static PyObject *__pyx_n_s_HANDSHAKE;
static PyObject *__pyx_n_s_INVALID;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x06;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x0f;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb2;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
static PyObject *__pyx_kp_s_Information_about_a_particular_R;
static PyObject *__pyx_kp_u_Invalid_descriptor_type;
static PyObject *__pyx_n_s_LIST_ACTIONS;
static PyObject *__pyx_n_s_LIST_FLIGHTS;
static PyObject *__pyx_kp_u_Location;
static PyObject *__pyx_n_s_Location_2;
static PyObject *__pyx_n_s_MetadataRecordBatchReader;
static PyObject *__pyx_n_s_MetadataRecordBatchReader_2;
static PyObject *__pyx_n_s_MetadataRecordBatchReader___iter;
static PyObject *__pyx_kp_u_Must_provide_Action_not;
static PyObject *__pyx_kp_u_Must_provide_a_FlightDescriptor;
static PyObject *__pyx_kp_u_Must_provide_a_Location_not;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_PATH;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_ReadPandasOption;
static PyObject *__pyx_n_s_RecordBatchStream;
static PyObject *__pyx_n_s_Result;
static PyObject *__pyx_kp_u_Results_of_list_actions_must_be;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_SchemaResult;
static PyObject *__pyx_n_s_ServerAuthHandler;
static PyObject *__pyx_n_s_ServerAuthReader;
static PyObject *__pyx_n_s_ServerAuthSender;
static PyObject *__pyx_n_s_ServerCallContext;
static PyObject *__pyx_n_s_ServerMiddleware;
static PyObject *__pyx_n_s_ServerMiddlewareFactory;
static PyObject *__pyx_n_s_ServerMiddlewareFactoryWrapper;
static PyObject *__pyx_n_s_ServerMiddlewareWrapper;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_Table;
static PyObject *__pyx_kp_u_The_FlightClient_connect_method;
static PyObject *__pyx_kp_u_The_FlightServer_run_method_is_d;
static PyObject *__pyx_kp_s_The_implemented_methods_in_Fligh;
static PyObject *__pyx_kp_s_The_type_of_a_FlightDescriptor;
static PyObject *__pyx_kp_u_Ticket;
static PyObject *__pyx_n_s_Ticket_2;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UNKNOWN;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_b__37;
static PyObject *__pyx_n_s__66;
static PyObject *__pyx_n_s_action;
static PyObject *__pyx_n_s_action_type;
static PyObject *__pyx_n_s_app_metadata;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_as_buffer;
static PyObject *__pyx_n_u_ascii;
static PyObject *__pyx_n_s_auth;
static PyObject *__pyx_n_s_auth_handler;
static PyObject *__pyx_kp_u_auth_handler_must_be_a_ServerAut;
static PyObject *__pyx_n_s_authenticate;
static PyObject *__pyx_n_s_batch;
static PyObject *__pyx_kp_u_bin;
static PyObject *__pyx_n_s_binary_type;
static PyObject *__pyx_n_s_buf;
static PyObject *__pyx_n_s_c_host;
static PyObject *__pyx_n_s_c_path;
static PyObject *__pyx_n_s_c_port;
static PyObject *__pyx_n_s_call_completed;
static PyObject *__pyx_n_u_cert;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_command;
static PyObject *__pyx_n_s_compile;
static PyObject *__pyx_n_s_connect;
static PyObject *__pyx_n_s_context;
static PyObject *__pyx_n_s_contextlib;
static PyObject *__pyx_n_s_criteria;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_source;
static PyObject *__pyx_n_s_defaultdict;
static PyObject *__pyx_n_u_description;
static PyObject *__pyx_n_s_descriptor;
static PyObject *__pyx_n_s_descriptor_type;
static PyObject *__pyx_n_s_deserialize;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_do_action;
static PyObject *__pyx_n_s_do_get;
static PyObject *__pyx_n_s_do_put;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_endpoints;
static PyObject *__pyx_n_s_endswith;
static PyObject *__pyx_n_s_enum;
static PyObject *__pyx_n_s_exc_type;
static PyObject *__pyx_n_s_exc_value;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_n_s_factories;
static PyObject *__pyx_n_s_for_command;
static PyObject *__pyx_n_s_for_grpc_tcp;
static PyObject *__pyx_n_s_for_grpc_tls;
static PyObject *__pyx_n_s_for_grpc_unix;
static PyObject *__pyx_n_s_for_path;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_frombytes;
static PyObject *__pyx_n_s_generator;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_flight_info;
static PyObject *__pyx_n_s_get_schema;
static PyObject *__pyx_n_s_get_token;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_headers;
static PyObject *__pyx_n_s_host;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_incoming;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_is_valid;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_u_key;
static PyObject *__pyx_n_s_lib;
static PyObject *__pyx_n_s_list_actions;
static PyObject *__pyx_n_s_list_flights;
static PyObject *__pyx_n_u_localhost;
static PyObject *__pyx_n_s_location;
static PyObject *__pyx_kp_u_location_argument_must_be_a_str;
static PyObject *__pyx_n_s_locations;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_action;
static PyObject *__pyx_n_s_match;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_n_u_method;
static PyObject *__pyx_n_s_middleware;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_munge_grpc_python_error;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_namedtuple;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_outgoing;
static PyObject *__pyx_n_s_override_hostname;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_password;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pyarrow__flight;
static PyObject *__pyx_kp_s_pyarrow__flight_pyx;
static PyObject *__pyx_n_s_pyarrow_compat;
static PyObject *__pyx_n_s_pyarrow_ipc;
static PyObject *__pyx_n_s_pyarrow_lib;
static PyObject *__pyx_n_s_pyx_PickleError;
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_ClientAuthHandler;
static PyObject *__pyx_n_s_pyx_unpickle_ClientMiddleware;
static PyObject *__pyx_n_s_pyx_unpickle_ClientMiddlewareF;
static PyObject *__pyx_n_s_pyx_unpickle_FlightCancelledEr;
static PyObject *__pyx_n_s_pyx_unpickle_FlightDataStream;
static PyObject *__pyx_n_s_pyx_unpickle_FlightError;
static PyObject *__pyx_n_s_pyx_unpickle_FlightInternalErr;
static PyObject *__pyx_n_s_pyx_unpickle_FlightServerError;
static PyObject *__pyx_n_s_pyx_unpickle_FlightTimedOutErr;
static PyObject *__pyx_n_s_pyx_unpickle_FlightUnauthentic;
static PyObject *__pyx_n_s_pyx_unpickle_FlightUnauthorize;
static PyObject *__pyx_n_s_pyx_unpickle_FlightUnavailable;
static PyObject *__pyx_n_s_pyx_unpickle_RecordBatchStream;
static PyObject *__pyx_n_s_pyx_unpickle_ServerAuthHandler;
static PyObject *__pyx_n_s_pyx_unpickle_ServerMiddleware;
static PyObject *__pyx_n_s_pyx_unpickle_ServerMiddlewareF;
static PyObject *__pyx_n_s_pyx_unpickle__ServerMiddleware;
static PyObject *__pyx_n_s_pyx_unpickle__ServerMiddleware_2;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_read_chunk;
static PyObject *__pyx_n_s_reader;
static PyObject *__pyx_n_s_received_headers;
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_result;
static PyObject *__pyx_kp_u_run_on_uninitialized_FlightServe;
static PyObject *__pyx_n_s_schema;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_kp_s_self_action_cannot_be_converted;
static PyObject *__pyx_kp_s_self_basic_auth_cannot_be_conver;
static PyObject *__pyx_kp_s_self_chunk_cannot_be_converted_t;
static PyObject *__pyx_kp_s_self_client_cannot_be_converted;
static PyObject *__pyx_kp_s_self_context_cannot_be_converted;
static PyObject *__pyx_kp_s_self_current_stream_self_schema;
static PyObject *__pyx_kp_s_self_descriptor_cannot_be_conver;
static PyObject *__pyx_kp_s_self_endpoint_cannot_be_converte;
static PyObject *__pyx_kp_s_self_info_cannot_be_converted_to;
static PyObject *__pyx_kp_s_self_location_cannot_be_converte;
static PyObject *__pyx_kp_u_self_object_in_callback_is_not_G;
static PyObject *__pyx_kp_s_self_options_cannot_be_converted;
static PyObject *__pyx_kp_s_self_reader_cannot_be_converted;
static PyObject *__pyx_kp_s_self_result_cannot_be_converted;
static PyObject *__pyx_kp_s_self_sender_cannot_be_converted;
static PyObject *__pyx_kp_s_self_server_cannot_be_converted;
static PyObject *__pyx_kp_s_self_ticket_cannot_be_converted;
static PyObject *__pyx_kp_s_self_writer_cannot_be_converted;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_sending_headers;
static PyObject *__pyx_n_s_serve;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shutdown;
static PyObject *__pyx_kp_u_shutdown_on_uninitialized_Flight;
static PyObject *__pyx_n_s_six;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_s_start_call;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_string;
static PyObject *__pyx_n_s_string_types;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_text_type;
static PyObject *__pyx_n_s_threading;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_ticket;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_timeout;
static PyObject *__pyx_n_s_tls_certificates;
static PyObject *__pyx_n_s_tls_root_certs;
static PyObject *__pyx_n_s_tobytes;
static PyObject *__pyx_n_s_total_bytes;
static PyObject *__pyx_n_s_total_records;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_u_type;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_uri;
static PyObject *__pyx_n_s_username;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_wait;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_writer;
static PyObject *__pyx_pf_7pyarrow_7_flight__munge_grpc_python_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message); /* proto */
static int __pyx_pf_7pyarrow_7_flight_17FlightCallOptions___init__(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightCallOptions_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightCallOptions_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_11FlightError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_11FlightError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightInternalError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightInternalError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightTimedOutError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightTimedOutError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightCancelledError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightCancelledError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightServerError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightServerError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_26FlightUnauthenticatedError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_26FlightUnauthenticatedError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23FlightUnauthorizedError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23FlightUnauthorizedError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_22FlightUnavailableError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_22FlightUnavailableError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_6Action___init__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self, PyObject *__pyx_v_action_type, PyObject *__pyx_v_buf); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4type___get__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4body___get__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10ActionType_make_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */
static int __pyx_pf_7pyarrow_7_flight_6Result___init__(struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_4body___get__(struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_9BasicAuth___init__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_password); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8username___get__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8password___get__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_2deserialize(PyObject *__pyx_v_string); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_4serialize(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_16FlightDescriptor___init__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_2for_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4for_command(PyObject *__pyx_v_command); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_7command___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4path___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_6__repr__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_8serialize(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_10deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_12__eq__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_6Ticket___init__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, PyObject *__pyx_v_ticket); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_6ticket___get__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_2serialize(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_4deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_6__eq__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_8__repr__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_8Location___init__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, PyObject *__pyx_v_uri); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_2__repr__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_3uri___get__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_4equals(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_6__eq__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_8for_grpc_tcp(PyObject *__pyx_v_host, PyObject *__pyx_v_port); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_10for_grpc_tls(PyObject *__pyx_v_host, PyObject *__pyx_v_port); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_12for_grpc_unix(PyObject *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_14FlightEndpoint___init__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, PyObject *__pyx_v_ticket, PyObject *__pyx_v_locations); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6ticket___get__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_9locations___get__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_2__repr__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_4__eq__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_12SchemaResult___init__(struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_6schema___get__(struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_10FlightInfo___init__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, PyObject *__pyx_v_endpoints, PyObject *__pyx_v_total_records, PyObject *__pyx_v_total_bytes); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_13total_records___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_11total_bytes___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_6schema___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_10descriptor___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_9endpoints___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_2serialize(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_4deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_4data___get__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata___get__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk___iter__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema___get__(struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader___iter__(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_3read_all(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_5read_chunk(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_7__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_9__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_cancel(struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_write_with_metadata(struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_RecordBatch *__pyx_v_batch, PyObject *__pyx_v_buf); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_2done_writing(struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_read(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_write(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_12FlightClient___init__(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_2wait_for_available(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_4connect(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_6authenticate(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_auth_handler, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_8list_actions(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_10do_action(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_action, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_13list_flights(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_16get_flight_info(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_18get_schema(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_20do_get(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_ticket, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_22do_put(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDataStream___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDataStream_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_17RecordBatchStream___init__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self, PyObject *__pyx_v_data_source); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17RecordBatchStream_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17RecordBatchStream_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_15GeneratorStream___init__(struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self, PyObject *__pyx_v_schema, PyObject *__pyx_v_generator); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_15GeneratorStream_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_15GeneratorStream_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_peer_identity(struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_2get_middleware(struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_read(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_write(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_read(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_write(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_authenticate(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_outgoing, CYTHON_UNUSED PyObject *__pyx_v_incoming); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_2is_valid(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_token); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_authenticate(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_outgoing, CYTHON_UNUSED PyObject *__pyx_v_incoming); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_2get_token(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_start_call(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_info); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_sending_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_2received_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_4call_completed(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_6__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_8__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_start_call(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_info, CYTHON_UNUSED PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_sending_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_2call_completed(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper___init__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v_factories); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_2start_call(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v_info, PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper___init__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v_middleware); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_2sending_headers(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_4call_completed(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_6__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_8__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7pyarrow_7_flight_16FlightServerBase___init__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, PyObject *__pyx_v_location, PyObject *__pyx_v_auth_handler, PyObject *__pyx_v_tls_certificates, PyObject *__pyx_v_middleware); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_4port___get__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_2list_flights(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_criteria); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_4get_flight_info(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_6get_schema(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_8do_put(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor, CYTHON_UNUSED PyObject *__pyx_v_reader, CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_writer); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_10do_get(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_ticket); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_12list_actions(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_14do_action(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_action); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_16serve(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_18run(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_20shutdown(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_22wait(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_24__enter__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_26__exit__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_2connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware); /* proto */
static PyObject *__pyx_pf_7pyarrow_7_flight_4__pyx_unpickle_FlightError(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_7pyarrow_7_flight_6__pyx_unpickle_FlightInternalError(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_7pyarrow_7_flight_8__pyx_unpickle_FlightTimedOutError(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_7pyarrow_7_flight_10__pyx_unpickle_FlightCancelledError(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_7pyarrow_7_flight_12__pyx_unpickle_FlightServerError(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_7pyarrow_7_flight_14__pyx_unpickle_FlightUnauthenticatedError(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_7pyarrow_7_flight_16__pyx_unpickle_FlightUnauthorizedError(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_7pyarrow_7_flight_18__pyx_unpickle_FlightUnavailableError(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_7pyarrow_7_flight_20__pyx_unpickle_FlightDataStream(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_7pyarrow_7_flight_22__pyx_unpickle_RecordBatchStream(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_7pyarrow_7_flight_24__pyx_unpickle_ServerAuthHandler(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_7pyarrow_7_flight_26__pyx_unpickle_ClientAuthHandler(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_7pyarrow_7_flight_28__pyx_unpickle_ClientMiddlewareFactory(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_7pyarrow_7_flight_30__pyx_unpickle_ClientMiddleware(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_7pyarrow_7_flight_32__pyx_unpickle_ServerMiddlewareFactory(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_7pyarrow_7_flight_34__pyx_unpickle_ServerMiddleware(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_7pyarrow_7_flight_36__pyx_unpickle__ServerMiddlewareFactoryWrapper(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_7pyarrow_7_flight_38__pyx_unpickle__ServerMiddlewareWrapper(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_7pyarrow_7_flight_FlightCallOptions(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightInternalError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightTimedOutError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightCancelledError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightServerError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnauthenticatedError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnauthorizedError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnavailableError(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_Action(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_Result(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_BasicAuth(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_Ticket(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_Location(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightEndpoint(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_SchemaResult(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamChunk(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight__MetadataRecordBatchReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_MetadataRecordBatchReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightMetadataReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightMetadataWriter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightClient(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightDataStream(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_RecordBatchStream(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_GeneratorStream(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerCallContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthSender(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthReader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthSender(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthHandler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthHandler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientMiddlewareFactory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientMiddleware(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerMiddlewareFactory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerMiddleware(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightServerBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_1_do_action(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_2_list_flights(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static PyObject *__pyx_float_0_025;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_6351270;
static PyObject *__pyx_int_16160196;
static PyObject *__pyx_int_186650374;
static PyObject *__pyx_int_222419149;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__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__26;
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__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_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__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__86;
static PyObject *__pyx_codeobj__88;
static PyObject *__pyx_codeobj__90;
static PyObject *__pyx_codeobj__92;
static PyObject *__pyx_codeobj__94;
static PyObject *__pyx_codeobj__96;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__104;
static PyObject *__pyx_codeobj__106;
static PyObject *__pyx_codeobj__108;
static PyObject *__pyx_codeobj__110;
static PyObject *__pyx_codeobj__112;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__120;
/* Late includes */

/* "pyarrow/_flight.pyx":49
 * 
 * 
 * cdef int check_flight_status(const CStatus& status) nogil except -1:             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[FlightStatusDetail] detail
 * 
 */

static int __pyx_f_7pyarrow_7_flight_check_flight_status(arrow::Status const &__pyx_v_status) {
  std::shared_ptr< arrow::flight::FlightStatusDetail>  __pyx_v_detail;
  PyObject *__pyx_v_message = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bool __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;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save;
  #endif
  __Pyx_RefNannySetupContext("check_flight_status", 1);

  /* "pyarrow/_flight.pyx":50
 * 
 * cdef int check_flight_status(const CStatus& status) nogil except -1:
 *     cdef shared_ptr[FlightStatusDetail] detail             # <<<<<<<<<<<<<<
 * 
 *     if status.ok():
 */
  /*try:*/ {

    /* "pyarrow/_flight.pyx":52
 *     cdef shared_ptr[FlightStatusDetail] detail
 * 
 *     if status.ok():             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_1 = (__pyx_v_status.ok() != 0);
    if (__pyx_t_1) {

      /* "pyarrow/_flight.pyx":53
 * 
 *     if status.ok():
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     detail = FlightStatusDetail.UnwrapStatus(status)
 */
      __pyx_r = 0;
      goto __pyx_L3_return;

      /* "pyarrow/_flight.pyx":52
 *     cdef shared_ptr[FlightStatusDetail] detail
 * 
 *     if status.ok():             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    }

    /* "pyarrow/_flight.pyx":55
 *         return 0
 * 
 *     detail = FlightStatusDetail.UnwrapStatus(status)             # <<<<<<<<<<<<<<
 *     if detail:
 *         with gil:
 */
    __pyx_v_detail =  arrow::flight::FlightStatusDetail::UnwrapStatus(__pyx_v_status);

    /* "pyarrow/_flight.pyx":56
 * 
 *     detail = FlightStatusDetail.UnwrapStatus(status)
 *     if detail:             # <<<<<<<<<<<<<<
 *         with gil:
 *             message = frombytes(status.message())
 */
    __pyx_t_2 = __pyx_v_detail.operator bool();
    if (__pyx_t_2) {

      /* "pyarrow/_flight.pyx":57
 *     detail = FlightStatusDetail.UnwrapStatus(status)
 *     if detail:
 *         with gil:             # <<<<<<<<<<<<<<
 *             message = frombytes(status.message())
 *             if detail.get().code() == CFlightStatusInternal:
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyarrow/_flight.pyx":58
 *     if detail:
 *         with gil:
 *             message = frombytes(status.message())             # <<<<<<<<<<<<<<
 *             if detail.get().code() == CFlightStatusInternal:
 *                 raise FlightInternalError(message)
 */
            __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_status.message()); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_5);
            __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(0, 58, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_v_message = __pyx_t_3;
            __pyx_t_3 = 0;

            /* "pyarrow/_flight.pyx":59
 *         with gil:
 *             message = frombytes(status.message())
 *             if detail.get().code() == CFlightStatusInternal:             # <<<<<<<<<<<<<<
 *                 raise FlightInternalError(message)
 *             elif detail.get().code() == CFlightStatusFailed:
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Internal) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":60
 *             message = frombytes(status.message())
 *             if detail.get().code() == CFlightStatusInternal:
 *                 raise FlightInternalError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusFailed:
 *                 message = _munge_grpc_python_error(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightInternalError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L9_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, 60, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":59
 *         with gil:
 *             message = frombytes(status.message())
 *             if detail.get().code() == CFlightStatusInternal:             # <<<<<<<<<<<<<<
 *                 raise FlightInternalError(message)
 *             elif detail.get().code() == CFlightStatusFailed:
 */
            }

            /* "pyarrow/_flight.pyx":61
 *             if detail.get().code() == CFlightStatusInternal:
 *                 raise FlightInternalError(message)
 *             elif detail.get().code() == CFlightStatusFailed:             # <<<<<<<<<<<<<<
 *                 message = _munge_grpc_python_error(message)
 *                 raise FlightServerError(message)
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Failed) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":62
 *                 raise FlightInternalError(message)
 *             elif detail.get().code() == CFlightStatusFailed:
 *                 message = _munge_grpc_python_error(message)             # <<<<<<<<<<<<<<
 *                 raise FlightServerError(message)
 *             elif detail.get().code() == CFlightStatusTimedOut:
 */
              __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_munge_grpc_python_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_5 = NULL;
              if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
                if (likely(__pyx_t_5)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                  __Pyx_INCREF(__pyx_t_5);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_4, function);
                }
              }
              __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_message);
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_3);
              __pyx_t_3 = 0;

              /* "pyarrow/_flight.pyx":63
 *             elif detail.get().code() == CFlightStatusFailed:
 *                 message = _munge_grpc_python_error(message)
 *                 raise FlightServerError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusTimedOut:
 *                 raise FlightTimedOutError(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightServerError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L9_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, 63, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":61
 *             if detail.get().code() == CFlightStatusInternal:
 *                 raise FlightInternalError(message)
 *             elif detail.get().code() == CFlightStatusFailed:             # <<<<<<<<<<<<<<
 *                 message = _munge_grpc_python_error(message)
 *                 raise FlightServerError(message)
 */
            }

            /* "pyarrow/_flight.pyx":64
 *                 message = _munge_grpc_python_error(message)
 *                 raise FlightServerError(message)
 *             elif detail.get().code() == CFlightStatusTimedOut:             # <<<<<<<<<<<<<<
 *                 raise FlightTimedOutError(message)
 *             elif detail.get().code() == CFlightStatusCancelled:
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::TimedOut) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":65
 *                 raise FlightServerError(message)
 *             elif detail.get().code() == CFlightStatusTimedOut:
 *                 raise FlightTimedOutError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusCancelled:
 *                 raise FlightCancelledError(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightTimedOutError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L9_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, 65, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":64
 *                 message = _munge_grpc_python_error(message)
 *                 raise FlightServerError(message)
 *             elif detail.get().code() == CFlightStatusTimedOut:             # <<<<<<<<<<<<<<
 *                 raise FlightTimedOutError(message)
 *             elif detail.get().code() == CFlightStatusCancelled:
 */
            }

            /* "pyarrow/_flight.pyx":66
 *             elif detail.get().code() == CFlightStatusTimedOut:
 *                 raise FlightTimedOutError(message)
 *             elif detail.get().code() == CFlightStatusCancelled:             # <<<<<<<<<<<<<<
 *                 raise FlightCancelledError(message)
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Cancelled) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":67
 *                 raise FlightTimedOutError(message)
 *             elif detail.get().code() == CFlightStatusCancelled:
 *                 raise FlightCancelledError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 *                 raise FlightUnauthenticatedError(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightCancelledError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L9_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, 67, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":66
 *             elif detail.get().code() == CFlightStatusTimedOut:
 *                 raise FlightTimedOutError(message)
 *             elif detail.get().code() == CFlightStatusCancelled:             # <<<<<<<<<<<<<<
 *                 raise FlightCancelledError(message)
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 */
            }

            /* "pyarrow/_flight.pyx":68
 *             elif detail.get().code() == CFlightStatusCancelled:
 *                 raise FlightCancelledError(message)
 *             elif detail.get().code() == CFlightStatusUnauthenticated:             # <<<<<<<<<<<<<<
 *                 raise FlightUnauthenticatedError(message)
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Unauthenticated) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":69
 *                 raise FlightCancelledError(message)
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 *                 raise FlightUnauthenticatedError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 *                 raise FlightUnauthorizedError(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnauthenticatedError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L9_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, 69, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":68
 *             elif detail.get().code() == CFlightStatusCancelled:
 *                 raise FlightCancelledError(message)
 *             elif detail.get().code() == CFlightStatusUnauthenticated:             # <<<<<<<<<<<<<<
 *                 raise FlightUnauthenticatedError(message)
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 */
            }

            /* "pyarrow/_flight.pyx":70
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 *                 raise FlightUnauthenticatedError(message)
 *             elif detail.get().code() == CFlightStatusUnauthorized:             # <<<<<<<<<<<<<<
 *                 raise FlightUnauthorizedError(message)
 *             elif detail.get().code() == CFlightStatusUnavailable:
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Unauthorized) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":71
 *                 raise FlightUnauthenticatedError(message)
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 *                 raise FlightUnauthorizedError(message)             # <<<<<<<<<<<<<<
 *             elif detail.get().code() == CFlightStatusUnavailable:
 *                 raise FlightUnavailableError(message)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnauthorizedError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L9_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, 71, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":70
 *             elif detail.get().code() == CFlightStatusUnauthenticated:
 *                 raise FlightUnauthenticatedError(message)
 *             elif detail.get().code() == CFlightStatusUnauthorized:             # <<<<<<<<<<<<<<
 *                 raise FlightUnauthorizedError(message)
 *             elif detail.get().code() == CFlightStatusUnavailable:
 */
            }

            /* "pyarrow/_flight.pyx":72
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 *                 raise FlightUnauthorizedError(message)
 *             elif detail.get().code() == CFlightStatusUnavailable:             # <<<<<<<<<<<<<<
 *                 raise FlightUnavailableError(message)
 * 
 */
            __pyx_t_1 = ((__pyx_v_detail.get()->code() ==  arrow::flight::FlightStatusCode::Unavailable) != 0);
            if (unlikely(__pyx_t_1)) {

              /* "pyarrow/_flight.pyx":73
 *                 raise FlightUnauthorizedError(message)
 *             elif detail.get().code() == CFlightStatusUnavailable:
 *                 raise FlightUnavailableError(message)             # <<<<<<<<<<<<<<
 * 
 *     return check_status(status)
 */
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnavailableError), __pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L9_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, 73, __pyx_L9_error)

              /* "pyarrow/_flight.pyx":72
 *             elif detail.get().code() == CFlightStatusUnauthorized:
 *                 raise FlightUnauthorizedError(message)
 *             elif detail.get().code() == CFlightStatusUnavailable:             # <<<<<<<<<<<<<<
 *                 raise FlightUnavailableError(message)
 * 
 */
            }
          }

          /* "pyarrow/_flight.pyx":57
 *     detail = FlightStatusDetail.UnwrapStatus(status)
 *     if detail:
 *         with gil:             # <<<<<<<<<<<<<<
 *             message = frombytes(status.message())
 *             if detail.get().code() == CFlightStatusInternal:
 */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L10;
            }
            __pyx_L9_error: {
              #ifdef WITH_THREAD
              __Pyx_PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
            __pyx_L10:;
          }
      }

      /* "pyarrow/_flight.pyx":56
 * 
 *     detail = FlightStatusDetail.UnwrapStatus(status)
 *     if detail:             # <<<<<<<<<<<<<<
 *         with gil:
 *             message = frombytes(status.message())
 */
    }

    /* "pyarrow/_flight.pyx":75
 *                 raise FlightUnavailableError(message)
 * 
 *     return check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_7 = __pyx_f_7pyarrow_3lib_check_status(__pyx_v_status); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L4_error)
    __pyx_r = __pyx_t_7;
    goto __pyx_L3_return;
  }

  /* "pyarrow/_flight.pyx":50
 * 
 * cdef int check_flight_status(const CStatus& status) nogil except -1:
 *     cdef shared_ptr[FlightStatusDetail] detail             # <<<<<<<<<<<<<<
 * 
 *     if status.ok():
 */
  /*finally:*/ {
    __pyx_L3_return: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
      #endif
      goto __pyx_L0;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
  }

  /* "pyarrow/_flight.pyx":49
 * 
 * 
 * cdef int check_flight_status(const CStatus& status) nogil except -1:             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[FlightStatusDetail] detail
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  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_AddTraceback("pyarrow._flight.check_flight_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":85
 * 
 * 
 * def _munge_grpc_python_error(message):             # <<<<<<<<<<<<<<
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_1_munge_grpc_python_error(PyObject *__pyx_self, PyObject *__pyx_v_message); /*proto*/
static char __pyx_doc_7pyarrow_7_flight__munge_grpc_python_error[] = "_munge_grpc_python_error(message)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_1_munge_grpc_python_error = {"_munge_grpc_python_error", (PyCFunction)__pyx_pw_7pyarrow_7_flight_1_munge_grpc_python_error, METH_O, __pyx_doc_7pyarrow_7_flight__munge_grpc_python_error};
static PyObject *__pyx_pw_7pyarrow_7_flight_1_munge_grpc_python_error(PyObject *__pyx_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_munge_grpc_python_error (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight__munge_grpc_python_error(__pyx_self, ((PyObject *)__pyx_v_message));

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

static PyObject *__pyx_pf_7pyarrow_7_flight__munge_grpc_python_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_v_m = 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;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_munge_grpc_python_error", 0);

  /* "pyarrow/_flight.pyx":86
 * 
 * def _munge_grpc_python_error(message):
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)             # <<<<<<<<<<<<<<
 *     if m:
 *         return ('Flight RPC failed with Python exception \"{}: {}\"'
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FLIGHT_SERVER_ERROR_REGEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __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_message) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_message);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_m = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":87
 * def _munge_grpc_python_error(message):
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:             # <<<<<<<<<<<<<<
 *         return ('Flight RPC failed with Python exception \"{}: {}\"'
 *                 .format(m.group(2), m.group(1)))
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_m); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":88
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:
 *         return ('Flight RPC failed with Python exception \"{}: {}\"'             # <<<<<<<<<<<<<<
 *                 .format(m.group(2), m.group(1)))
 *     else:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "pyarrow/_flight.pyx":89
 *     if m:
 *         return ('Flight RPC failed with Python exception \"{}: {}\"'
 *                 .format(m.group(2), m.group(1)))             # <<<<<<<<<<<<<<
 *     else:
 *         return message
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Flight_RPC_failed_with_Python_ex, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_group); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __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_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_int_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_2);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_group); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_1);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_5);
      __pyx_t_2 = 0;
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":87
 * def _munge_grpc_python_error(message):
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:             # <<<<<<<<<<<<<<
 *         return ('Flight RPC failed with Python exception \"{}: {}\"'
 *                 .format(m.group(2), m.group(1)))
 */
  }

  /* "pyarrow/_flight.pyx":91
 *                 .format(m.group(2), m.group(1)))
 *     else:
 *         return message             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_message);
    __pyx_r = __pyx_v_message;
    goto __pyx_L0;
  }

  /* "pyarrow/_flight.pyx":85
 * 
 * 
 * def _munge_grpc_python_error(message):             # <<<<<<<<<<<<<<
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:
 */

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

/* "pyarrow/_flight.pyx":100
 *         CFlightCallOptions options
 * 
 *     def __init__(self, timeout=None):             # <<<<<<<<<<<<<<
 *         """Create call options.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_17FlightCallOptions_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightCallOptions___init__[] = "Create call options.\n\n        Parameters\n        ----------\n        timeout : float or None\n            A timeout for the call, in seconds. None means that the\n            timeout defaults to an implementation-specific value.\n\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_17FlightCallOptions___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_17FlightCallOptions_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_timeout = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 100, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_timeout = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightCallOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17FlightCallOptions___init__(((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)__pyx_v_self), __pyx_v_timeout);

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

static int __pyx_pf_7pyarrow_7_flight_17FlightCallOptions___init__(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self, PyObject *__pyx_v_timeout) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  double __pyx_t_3;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":110
 * 
 *         """
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             self.options.timeout = CTimeoutDuration(timeout)
 * 
 */
  __pyx_t_1 = (__pyx_v_timeout != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":111
 *         """
 *         if timeout is not None:
 *             self.options.timeout = CTimeoutDuration(timeout)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_timeout); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
    __pyx_v_self->options.timeout =  arrow::flight::TimeoutDuration(__pyx_t_3);

    /* "pyarrow/_flight.pyx":110
 * 
 *         """
 *         if timeout is not None:             # <<<<<<<<<<<<<<
 *             self.options.timeout = CTimeoutDuration(timeout)
 * 
 */
  }

  /* "pyarrow/_flight.pyx":100
 *         CFlightCallOptions options
 * 
 *     def __init__(self, timeout=None):             # <<<<<<<<<<<<<<
 *         """Create call options.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightCallOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":114
 * 
 *     @staticmethod
 *     cdef CFlightCallOptions* unwrap(obj):             # <<<<<<<<<<<<<<
 *         if not obj:
 *             return &DEFAULT_CALL_OPTIONS
 */

static  arrow::flight::FlightCallOptions *__pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_obj) {
   arrow::flight::FlightCallOptions *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("unwrap", 0);

  /* "pyarrow/_flight.pyx":115
 *     @staticmethod
 *     cdef CFlightCallOptions* unwrap(obj):
 *         if not obj:             # <<<<<<<<<<<<<<
 *             return &DEFAULT_CALL_OPTIONS
 *         elif isinstance(obj, FlightCallOptions):
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_obj)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":116
 *     cdef CFlightCallOptions* unwrap(obj):
 *         if not obj:
 *             return &DEFAULT_CALL_OPTIONS             # <<<<<<<<<<<<<<
 *         elif isinstance(obj, FlightCallOptions):
 *             return &((<FlightCallOptions> obj).options)
 */
    __pyx_r = (&__pyx_v_7pyarrow_7_flight_DEFAULT_CALL_OPTIONS);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":115
 *     @staticmethod
 *     cdef CFlightCallOptions* unwrap(obj):
 *         if not obj:             # <<<<<<<<<<<<<<
 *             return &DEFAULT_CALL_OPTIONS
 *         elif isinstance(obj, FlightCallOptions):
 */
  }

  /* "pyarrow/_flight.pyx":117
 *         if not obj:
 *             return &DEFAULT_CALL_OPTIONS
 *         elif isinstance(obj, FlightCallOptions):             # <<<<<<<<<<<<<<
 *             return &((<FlightCallOptions> obj).options)
 *         raise TypeError("Expected a FlightCallOptions object, not "
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_obj), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":118
 *             return &DEFAULT_CALL_OPTIONS
 *         elif isinstance(obj, FlightCallOptions):
 *             return &((<FlightCallOptions> obj).options)             # <<<<<<<<<<<<<<
 *         raise TypeError("Expected a FlightCallOptions object, not "
 *                         "'{}'".format(type(obj)))
 */
    __pyx_r = (&__pyx_v_obj->options);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":117
 *         if not obj:
 *             return &DEFAULT_CALL_OPTIONS
 *         elif isinstance(obj, FlightCallOptions):             # <<<<<<<<<<<<<<
 *             return &((<FlightCallOptions> obj).options)
 *         raise TypeError("Expected a FlightCallOptions object, not "
 */
  }

  /* "pyarrow/_flight.pyx":120
 *             return &((<FlightCallOptions> obj).options)
 *         raise TypeError("Expected a FlightCallOptions object, not "
 *                         "'{}'".format(type(obj)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Expected_a_FlightCallOptions_obj, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __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, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_obj)))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_obj))));
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyarrow/_flight.pyx":119
 *         elif isinstance(obj, FlightCallOptions):
 *             return &((<FlightCallOptions> obj).options)
 *         raise TypeError("Expected a FlightCallOptions object, not "             # <<<<<<<<<<<<<<
 *                         "'{}'".format(type(obj)))
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __PYX_ERR(0, 119, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":114
 * 
 *     @staticmethod
 *     cdef CFlightCallOptions* unwrap(obj):             # <<<<<<<<<<<<<<
 *         if not obj:
 *             return &DEFAULT_CALL_OPTIONS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightCallOptions.unwrap", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightCallOptions_2__reduce_cython__[] = "FlightCallOptions.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_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_7pyarrow_7_flight_17FlightCallOptions_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightCallOptions_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightCallOptions.__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("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightCallOptions_4__setstate_cython__[] = "FlightCallOptions.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_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_7pyarrow_7_flight_17FlightCallOptions_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightCallOptions_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":133
 *     cdef dict __dict__
 * 
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         message = tobytes("Flight error: {}".format(str(self)))
 *         return CStatus_UnknownError(message)
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_11FlightError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v_self) {
  PyObject *__pyx_v_message = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":134
 * 
 *     cdef CStatus to_status(self):
 *         message = tobytes("Flight error: {}".format(str(self)))             # <<<<<<<<<<<<<<
 *         return CStatus_UnknownError(message)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Flight_error, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __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(0, 134, __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(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_message = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":135
 *     cdef CStatus to_status(self):
 *         message = tobytes("Flight error: {}".format(str(self)))
 *         return CStatus_UnknownError(message)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_v_message); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
  __pyx_r = arrow::Status::UnknownError(__pyx_t_7);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":133
 *     cdef dict __dict__
 * 
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         message = tobytes("Flight error: {}".format(str(self)))
 *         return CStatus_UnknownError(message)
 */

  /* 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_WriteUnraisable("pyarrow._flight.FlightError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_11FlightError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_11FlightError___reduce_cython__[] = "FlightError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_11FlightError_1__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_7pyarrow_7_flight_11FlightError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_11FlightError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightError.__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_FlightError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_11FlightError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_11FlightError_2__setstate_cython__[] = "FlightError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_11FlightError_3__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_7pyarrow_7_flight_11FlightError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_11FlightError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightError__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("pyarrow._flight.FlightError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":139
 * 
 * cdef class FlightInternalError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_19FlightInternalError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":140
 * cdef class FlightInternalError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __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, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Internal, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":139
 * 
 * cdef class FlightInternalError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightInternalError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightInternalError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_19FlightInternalError___reduce_cython__[] = "FlightInternalError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightInternalError_1__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_7pyarrow_7_flight_19FlightInternalError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightInternalError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightInternalErr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightInternalError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightInternalErr); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightInternalError.__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_FlightInternalError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightInternalError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightInternalError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_19FlightInternalError_2__setstate_cython__[] = "FlightInternalError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightInternalError_3__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_7pyarrow_7_flight_19FlightInternalError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightInternalError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightInternalError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightInternalError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightInternalError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightInternalError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightInternalError__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("pyarrow._flight.FlightInternalError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":144
 * 
 * cdef class FlightTimedOutError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_19FlightTimedOutError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":145
 * cdef class FlightTimedOutError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __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, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::TimedOut, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":144
 * 
 * cdef class FlightTimedOutError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightTimedOutError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_19FlightTimedOutError___reduce_cython__[] = "FlightTimedOutError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_1__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_7pyarrow_7_flight_19FlightTimedOutError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightTimedOutError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightTimedOutErr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightTimedOutError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightTimedOutErr); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightTimedOutError.__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_FlightTimedOutError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightTimedOutError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_19FlightTimedOutError_2__setstate_cython__[] = "FlightTimedOutError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_3__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_7pyarrow_7_flight_19FlightTimedOutError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_19FlightTimedOutError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightTimedOutError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightTimedOutError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightTimedOutError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightTimedOutError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightTimedOutError__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("pyarrow._flight.FlightTimedOutError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":149
 * 
 * cdef class FlightCancelledError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_20FlightCancelledError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":150
 * cdef class FlightCancelledError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __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, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Cancelled, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":149
 * 
 * cdef class FlightCancelledError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightCancelledError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightCancelledError___reduce_cython__[] = "FlightCancelledError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_1__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_7pyarrow_7_flight_20FlightCancelledError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightCancelledError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightCancelledEr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightCancelledError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightCancelledEr); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightCancelledError.__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_FlightCancelledError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightCancelledError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightCancelledError_2__setstate_cython__[] = "FlightCancelledError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_3__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_7pyarrow_7_flight_20FlightCancelledError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightCancelledError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightCancelledError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightCancelledError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightCancelledError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightCancelledError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightCancelledError__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("pyarrow._flight.FlightCancelledError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":154
 * 
 * cdef class FlightServerError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_17FlightServerError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":155
 * cdef class FlightServerError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __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, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Failed, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":154
 * 
 * cdef class FlightServerError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightServerError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightServerError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightServerError___reduce_cython__[] = "FlightServerError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightServerError_1__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_7pyarrow_7_flight_17FlightServerError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightServerError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightServerError); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightServerError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightServerError); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerError.__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_FlightServerError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightServerError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightServerError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightServerError_2__setstate_cython__[] = "FlightServerError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightServerError_3__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_7pyarrow_7_flight_17FlightServerError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightServerError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightServerError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightServerError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightServerError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightServerError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightServerError__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("pyarrow._flight.FlightServerError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":159
 * 
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(
 *             CFlightStatusUnauthenticated, tobytes(str(self)))
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_26FlightUnauthenticatedError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":161
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(
 *             CFlightStatusUnauthenticated, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __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, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":160
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(             # <<<<<<<<<<<<<<
 *             CFlightStatusUnauthenticated, tobytes(str(self)))
 * 
 */
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Unauthenticated, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":159
 * 
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(
 *             CFlightStatusUnauthenticated, tobytes(str(self)))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightUnauthenticatedError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_26FlightUnauthenticatedError___reduce_cython__[] = "FlightUnauthenticatedError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_1__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_7pyarrow_7_flight_26FlightUnauthenticatedError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_26FlightUnauthenticatedError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightUnauthentic); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnauthenticatedError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightUnauthentic); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightUnauthenticatedError.__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_FlightUnauthenticatedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnauthenticatedError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_26FlightUnauthenticatedError_2__setstate_cython__[] = "FlightUnauthenticatedError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_3__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_7pyarrow_7_flight_26FlightUnauthenticatedError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_26FlightUnauthenticatedError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightUnauthenticatedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnauthenticatedError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthenticatedError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightUnauthenticatedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnauthenticatedError__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("pyarrow._flight.FlightUnauthenticatedError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":165
 * 
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_23FlightUnauthorizedError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":166
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __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, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Unauthorized, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":165
 * 
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightUnauthorizedError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23FlightUnauthorizedError___reduce_cython__[] = "FlightUnauthorizedError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_1__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_7pyarrow_7_flight_23FlightUnauthorizedError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23FlightUnauthorizedError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightUnauthorize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnauthorizedError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightUnauthorize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightUnauthorizedError.__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_FlightUnauthorizedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnauthorizedError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23FlightUnauthorizedError_2__setstate_cython__[] = "FlightUnauthorizedError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_3__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_7pyarrow_7_flight_23FlightUnauthorizedError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23FlightUnauthorizedError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightUnauthorizedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnauthorizedError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthorizedError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightUnauthorizedError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnauthorizedError__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("pyarrow._flight.FlightUnauthorizedError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":170
 * 
 * cdef class FlightUnavailableError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))
 * 
 */

static arrow::Status __pyx_f_7pyarrow_7_flight_22FlightUnavailableError_to_status(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v_self) {
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("to_status", 0);

  /* "pyarrow/_flight.pyx":171
 * cdef class FlightUnavailableError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __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, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r =  arrow::flight::MakeFlightError( arrow::flight::FlightStatusCode::Unavailable, __pyx_t_5);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":170
 * 
 * cdef class FlightUnavailableError(FlightError, ArrowException):
 *     cdef CStatus to_status(self):             # <<<<<<<<<<<<<<
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pyarrow._flight.FlightUnavailableError.to_status", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_22FlightUnavailableError___reduce_cython__[] = "FlightUnavailableError.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_1__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_7pyarrow_7_flight_22FlightUnavailableError___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_22FlightUnavailableError___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightUnavailable); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnavailableError__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightUnavailable); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightUnavailableError.__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_FlightUnavailableError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnavailableError__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_22FlightUnavailableError_2__setstate_cython__[] = "FlightUnavailableError.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_3__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_7pyarrow_7_flight_22FlightUnavailableError_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_22FlightUnavailableError_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightUnavailableError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightUnavailableError__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnavailableError__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightUnavailableError, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightUnavailableError__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("pyarrow._flight.FlightUnavailableError.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":179
 *         CAction action
 * 
 *     def __init__(self, action_type, buf):             # <<<<<<<<<<<<<<
 *         """Create an action from a type and a buffer.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_6Action_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Action___init__[] = "Create an action from a type and a buffer.\n\n        Parameters\n        ----------\n        action_type : bytes or str\n        buf : Buffer or bytes-like object\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_6Action___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_6Action_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_action_type = 0;
  PyObject *__pyx_v_buf = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_action_type,&__pyx_n_s_buf,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_action_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_buf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 179, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 179, __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_action_type = values[0];
    __pyx_v_buf = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Action.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Action___init__(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_v_self), __pyx_v_action_type, __pyx_v_buf);

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

static int __pyx_pf_7pyarrow_7_flight_6Action___init__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self, PyObject *__pyx_v_action_type, PyObject *__pyx_v_buf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":187
 *         buf : Buffer or bytes-like object
 *         """
 *         self.action.type = tobytes(action_type)             # <<<<<<<<<<<<<<
 *         self.action.body = pyarrow_unwrap_buffer(as_buffer(buf))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_action_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_action_type);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->action.type = __pyx_t_4;

  /* "pyarrow/_flight.pyx":188
 *         """
 *         self.action.type = tobytes(action_type)
 *         self.action.body = pyarrow_unwrap_buffer(as_buffer(buf))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_as_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->action.body = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":179
 *         CAction action
 * 
 *     def __init__(self, action_type, buf):             # <<<<<<<<<<<<<<
 *         """Create an action from a type and a buffer.
 * 
 */

  /* 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("pyarrow._flight.Action.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":191
 * 
 *     @property
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """The action type."""
 *         return frombytes(self.action.type)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_4type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Action_4type___get__(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4type___get__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":193
 *     def type(self):
 *         """The action type."""
 *         return frombytes(self.action.type)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->action.type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __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, 193, __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;

  /* "pyarrow/_flight.pyx":191
 * 
 *     @property
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """The action type."""
 *         return frombytes(self.action.type)
 */

  /* 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("pyarrow._flight.Action.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":196
 * 
 *     @property
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """The action body (arguments for the action)."""
 *         return pyarrow_wrap_buffer(self.action.body)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_4body_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_4body_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Action_4body___get__(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4body___get__(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":198
 *     def body(self):
 *         """The action body (arguments for the action)."""
 *         return pyarrow_wrap_buffer(self.action.body)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(__pyx_v_self->action.body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":196
 * 
 *     @property
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """The action body (arguments for the action)."""
 *         return pyarrow_wrap_buffer(self.action.body)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Action.body.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":201
 * 
 *     @staticmethod
 *     cdef CAction unwrap(action) except *:             # <<<<<<<<<<<<<<
 *         if not isinstance(action, Action):
 *             raise TypeError("Must provide Action, not '{}'".format(
 */

static  arrow::flight::Action __pyx_f_7pyarrow_7_flight_6Action_unwrap(struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_action) {
   arrow::flight::Action __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("unwrap", 0);

  /* "pyarrow/_flight.pyx":202
 *     @staticmethod
 *     cdef CAction unwrap(action) except *:
 *         if not isinstance(action, Action):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide Action, not '{}'".format(
 *                 type(action)))
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_action), __pyx_ptype_7pyarrow_7_flight_Action); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pyarrow/_flight.pyx":203
 *     cdef CAction unwrap(action) except *:
 *         if not isinstance(action, Action):
 *             raise TypeError("Must provide Action, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(action)))
 *         return (<Action> action).action
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Must_provide_Action_not, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "pyarrow/_flight.pyx":204
 *         if not isinstance(action, Action):
 *             raise TypeError("Must provide Action, not '{}'".format(
 *                 type(action)))             # <<<<<<<<<<<<<<
 *         return (<Action> action).action
 * 
 */
    __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, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_action)))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_action))));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":203
 *     cdef CAction unwrap(action) except *:
 *         if not isinstance(action, Action):
 *             raise TypeError("Must provide Action, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(action)))
 *         return (<Action> action).action
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 203, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":202
 *     @staticmethod
 *     cdef CAction unwrap(action) except *:
 *         if not isinstance(action, Action):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide Action, not '{}'".format(
 *                 type(action)))
 */
  }

  /* "pyarrow/_flight.pyx":205
 *             raise TypeError("Must provide Action, not '{}'".format(
 *                 type(action)))
 *         return (<Action> action).action             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_action->action;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":201
 * 
 *     @staticmethod
 *     cdef CAction unwrap(action) except *:             # <<<<<<<<<<<<<<
 *         if not isinstance(action, Action):
 *             raise TypeError("Must provide Action, not '{}'".format(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.Action.unwrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Action_2__reduce_cython__[] = "Action.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_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_7pyarrow_7_flight_6Action_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Action.__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("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Action_4__setstate_cython__[] = "Action.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Action_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_7pyarrow_7_flight_6Action_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Action_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":214
 *     """A type of action that is executable on a Flight service."""
 * 
 *     def make_action(self, buf):             # <<<<<<<<<<<<<<
 *         """Create an Action with this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10ActionType_1make_action(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10ActionType_make_action[] = "ActionType.make_action(self, buf)\nCreate an Action with this type.\n\n        Parameters\n        ----------\n        buf : obj\n            An Arrow buffer or Python bytes or bytes-like object.\n        ";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_10ActionType_1make_action = {"make_action", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_10ActionType_1make_action, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_10ActionType_make_action};
static PyObject *__pyx_pw_7pyarrow_7_flight_10ActionType_1make_action(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_buf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_action (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_buf,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_buf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_action", 1, 2, 2, 1); __PYX_ERR(0, 214, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_action") < 0)) __PYX_ERR(0, 214, __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_buf = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_action", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 214, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.ActionType.make_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10ActionType_make_action(__pyx_self, __pyx_v_self, __pyx_v_buf);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10ActionType_make_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("make_action", 0);

  /* "pyarrow/_flight.pyx":222
 *             An Arrow buffer or Python bytes or bytes-like object.
 *         """
 *         return Action(self.type, buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_buf);
  __Pyx_GIVEREF(__pyx_v_buf);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_buf);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Action), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __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;

  /* "pyarrow/_flight.pyx":214
 *     """A type of action that is executable on a Flight service."""
 * 
 *     def make_action(self, buf):             # <<<<<<<<<<<<<<
 *         """Create an Action with this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.ActionType.make_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":230
 *         unique_ptr[CFlightResult] result
 * 
 *     def __init__(self, buf):             # <<<<<<<<<<<<<<
 *         """Create a new result.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_6Result_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Result___init__[] = "Create a new result.\n\n        Parameters\n        ----------\n        buf : Buffer or bytes-like object\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_6Result___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_6Result_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_buf = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,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_buf)) != 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(0, 230, __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_buf = 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(0, 230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Result.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Result___init__(((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_v_self), __pyx_v_buf);

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

static int __pyx_pf_7pyarrow_7_flight_6Result___init__(struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self, PyObject *__pyx_v_buf) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":237
 *         buf : Buffer or bytes-like object
 *         """
 *         self.result.reset(new CFlightResult())             # <<<<<<<<<<<<<<
 *         self.result.get().body = pyarrow_unwrap_buffer(as_buffer(buf))
 * 
 */
  __pyx_v_self->result.reset(new  arrow::flight::Result());

  /* "pyarrow/_flight.pyx":238
 *         """
 *         self.result.reset(new CFlightResult())
 *         self.result.get().body = pyarrow_unwrap_buffer(as_buffer(buf))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_as_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->result.get()->body = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":230
 *         unique_ptr[CFlightResult] result
 * 
 *     def __init__(self, buf):             # <<<<<<<<<<<<<<
 *         """Create a new result.
 * 
 */

  /* 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("pyarrow._flight.Result.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":241
 * 
 *     @property
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """Get the Buffer containing the result."""
 *         return pyarrow_wrap_buffer(self.result.get().body)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_4body_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_4body_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Result_4body___get__(((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_4body___get__(struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":243
 *     def body(self):
 *         """Get the Buffer containing the result."""
 *         return pyarrow_wrap_buffer(self.result.get().body)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(__pyx_v_self->result.get()->body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":241
 * 
 *     @property
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """Get the Buffer containing the result."""
 *         return pyarrow_wrap_buffer(self.result.get().body)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Result.body.__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("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Result_2__reduce_cython__[] = "Result.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_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_7pyarrow_7_flight_6Result_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Result.__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("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Result_4__setstate_cython__[] = "Result.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Result_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_7pyarrow_7_flight_6Result_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Result_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Result *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":251
 *         unique_ptr[CBasicAuth] basic_auth
 * 
 *     def __init__(self, username=None, password=None):             # <<<<<<<<<<<<<<
 *         """Create a new basic auth object.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_9BasicAuth_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_9BasicAuth___init__[] = "Create a new basic auth object.\n\n        Parameters\n        ----------\n        username : string\n        password : string\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_9BasicAuth___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_9BasicAuth_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_username = 0;
  PyObject *__pyx_v_password = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_username,&__pyx_n_s_password,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_username);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_password);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 251, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_username = values[0];
    __pyx_v_password = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth___init__(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self), __pyx_v_username, __pyx_v_password);

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

static int __pyx_pf_7pyarrow_7_flight_9BasicAuth___init__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_password) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":259
 *         password : string
 *         """
 *         self.basic_auth.reset(new CBasicAuth())             # <<<<<<<<<<<<<<
 *         if username:
 *             self.basic_auth.get().username = tobytes(username)
 */
  __pyx_v_self->basic_auth.reset(new  arrow::flight::BasicAuth());

  /* "pyarrow/_flight.pyx":260
 *         """
 *         self.basic_auth.reset(new CBasicAuth())
 *         if username:             # <<<<<<<<<<<<<<
 *             self.basic_auth.get().username = tobytes(username)
 *         if password:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_username); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":261
 *         self.basic_auth.reset(new CBasicAuth())
 *         if username:
 *             self.basic_auth.get().username = tobytes(username)             # <<<<<<<<<<<<<<
 *         if password:
 *             self.basic_auth.get().password = tobytes(password)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_username) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_username);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->basic_auth.get()->username = __pyx_t_5;

    /* "pyarrow/_flight.pyx":260
 *         """
 *         self.basic_auth.reset(new CBasicAuth())
 *         if username:             # <<<<<<<<<<<<<<
 *             self.basic_auth.get().username = tobytes(username)
 *         if password:
 */
  }

  /* "pyarrow/_flight.pyx":262
 *         if username:
 *             self.basic_auth.get().username = tobytes(username)
 *         if password:             # <<<<<<<<<<<<<<
 *             self.basic_auth.get().password = tobytes(password)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_password); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":263
 *             self.basic_auth.get().username = tobytes(username)
 *         if password:
 *             self.basic_auth.get().password = tobytes(password)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_password) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_password);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->basic_auth.get()->password = __pyx_t_5;

    /* "pyarrow/_flight.pyx":262
 *         if username:
 *             self.basic_auth.get().username = tobytes(username)
 *         if password:             # <<<<<<<<<<<<<<
 *             self.basic_auth.get().password = tobytes(password)
 * 
 */
  }

  /* "pyarrow/_flight.pyx":251
 *         unique_ptr[CBasicAuth] basic_auth
 * 
 *     def __init__(self, username=None, password=None):             # <<<<<<<<<<<<<<
 *         """Create a new basic auth object.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":266
 * 
 *     @property
 *     def username(self):             # <<<<<<<<<<<<<<
 *         """Get the username."""
 *         return self.basic_auth.get().username
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_8username_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_8username_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_8username___get__(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8username___get__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":268
 *     def username(self):
 *         """Get the username."""
 *         return self.basic_auth.get().username             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->basic_auth.get()->username); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":266
 * 
 *     @property
 *     def username(self):             # <<<<<<<<<<<<<<
 *         """Get the username."""
 *         return self.basic_auth.get().username
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.username.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":271
 * 
 *     @property
 *     def password(self):             # <<<<<<<<<<<<<<
 *         """Get the password."""
 *         return self.basic_auth.get().password
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_8password_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_8password_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_8password___get__(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8password___get__(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":273
 *     def password(self):
 *         """Get the password."""
 *         return self.basic_auth.get().password             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->basic_auth.get()->password); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":271
 * 
 *     @property
 *     def password(self):             # <<<<<<<<<<<<<<
 *         """Get the password."""
 *         return self.basic_auth.get().password
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.password.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":276
 * 
 *     @staticmethod
 *     def deserialize(string):             # <<<<<<<<<<<<<<
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_3deserialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_9BasicAuth_2deserialize[] = "BasicAuth.deserialize(string)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_9BasicAuth_3deserialize = {"deserialize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_9BasicAuth_3deserialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_9BasicAuth_2deserialize};
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_3deserialize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_string = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deserialize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_string,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_string)) != 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, "deserialize") < 0)) __PYX_ERR(0, 276, __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_string = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("deserialize", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.deserialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_2deserialize(__pyx_v_string);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_2deserialize(PyObject *__pyx_v_string) {
  struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_auth = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::string __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("deserialize", 0);

  /* "pyarrow/_flight.pyx":277
 *     @staticmethod
 *     def deserialize(string):
 *         auth = BasicAuth()             # <<<<<<<<<<<<<<
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 *         return auth
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_BasicAuth)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_auth = ((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":278
 *     def deserialize(string):
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))             # <<<<<<<<<<<<<<
 *         return auth
 * 
 */
  __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_v_string); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error)
  __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::py::flight::DeserializeBasicAuth(__pyx_t_2, (&__pyx_v_auth->basic_auth))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 278, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":279
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 *         return auth             # <<<<<<<<<<<<<<
 * 
 *     def serialize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_auth));
  __pyx_r = ((PyObject *)__pyx_v_auth);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":276
 * 
 *     @staticmethod
 *     def deserialize(string):             # <<<<<<<<<<<<<<
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.deserialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_auth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":281
 *         return auth
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             c_string auth
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_5serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_9BasicAuth_4serialize[] = "BasicAuth.serialize(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_5serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_4serialize(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_4serialize(struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self) {
  std::string __pyx_v_auth;
  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;
  __Pyx_RefNannySetupContext("serialize", 0);

  /* "pyarrow/_flight.pyx":284
 *         cdef:
 *             c_string auth
 *         check_flight_status(SerializeBasicAuth(deref(self.basic_auth), &auth))             # <<<<<<<<<<<<<<
 *         return frombytes(auth)
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::py::flight::SerializeBasicAuth((*__pyx_v_self->basic_auth), (&__pyx_v_auth))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 284, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":285
 *             c_string auth
 *         check_flight_status(SerializeBasicAuth(deref(self.basic_auth), &auth))
 *         return frombytes(auth)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_auth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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(0, 285, __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;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":281
 *         return auth
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             c_string auth
 */

  /* 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("pyarrow._flight.BasicAuth.serialize", __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("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_9BasicAuth_6__reduce_cython__[] = "BasicAuth.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_6__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.BasicAuth.__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("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_9BasicAuth_8__setstate_cython__[] = "BasicAuth.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_9BasicAuth_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_9BasicAuth_8__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_9BasicAuth_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_BasicAuth *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":325
 * 
 * 
 * cdef wrap_flight_method(CFlightMethod method):             # <<<<<<<<<<<<<<
 *     if method == CFlightMethodHandshake:
 *         return FlightMethod.HANDSHAKE
 */

static PyObject *__pyx_f_7pyarrow_7_flight_wrap_flight_method( arrow::flight::FlightMethod __pyx_v_method) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("wrap_flight_method", 0);

  /* "pyarrow/_flight.pyx":326
 * 
 * cdef wrap_flight_method(CFlightMethod method):
 *     if method == CFlightMethodHandshake:             # <<<<<<<<<<<<<<
 *         return FlightMethod.HANDSHAKE
 *     elif method == CFlightMethodListFlights:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::Handshake) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":327
 * cdef wrap_flight_method(CFlightMethod method):
 *     if method == CFlightMethodHandshake:
 *         return FlightMethod.HANDSHAKE             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodListFlights:
 *         return FlightMethod.LIST_FLIGHTS
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HANDSHAKE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":326
 * 
 * cdef wrap_flight_method(CFlightMethod method):
 *     if method == CFlightMethodHandshake:             # <<<<<<<<<<<<<<
 *         return FlightMethod.HANDSHAKE
 *     elif method == CFlightMethodListFlights:
 */
  }

  /* "pyarrow/_flight.pyx":328
 *     if method == CFlightMethodHandshake:
 *         return FlightMethod.HANDSHAKE
 *     elif method == CFlightMethodListFlights:             # <<<<<<<<<<<<<<
 *         return FlightMethod.LIST_FLIGHTS
 *     elif method == CFlightMethodGetFlightInfo:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::ListFlights) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":329
 *         return FlightMethod.HANDSHAKE
 *     elif method == CFlightMethodListFlights:
 *         return FlightMethod.LIST_FLIGHTS             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodGetFlightInfo:
 *         return FlightMethod.GET_FLIGHT_INFO
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LIST_FLIGHTS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":328
 *     if method == CFlightMethodHandshake:
 *         return FlightMethod.HANDSHAKE
 *     elif method == CFlightMethodListFlights:             # <<<<<<<<<<<<<<
 *         return FlightMethod.LIST_FLIGHTS
 *     elif method == CFlightMethodGetFlightInfo:
 */
  }

  /* "pyarrow/_flight.pyx":330
 *     elif method == CFlightMethodListFlights:
 *         return FlightMethod.LIST_FLIGHTS
 *     elif method == CFlightMethodGetFlightInfo:             # <<<<<<<<<<<<<<
 *         return FlightMethod.GET_FLIGHT_INFO
 *     elif method == CFlightMethodGetSchema:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::GetFlightInfo) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":331
 *         return FlightMethod.LIST_FLIGHTS
 *     elif method == CFlightMethodGetFlightInfo:
 *         return FlightMethod.GET_FLIGHT_INFO             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodGetSchema:
 *         return FlightMethod.GET_SCHEMA
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_GET_FLIGHT_INFO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":330
 *     elif method == CFlightMethodListFlights:
 *         return FlightMethod.LIST_FLIGHTS
 *     elif method == CFlightMethodGetFlightInfo:             # <<<<<<<<<<<<<<
 *         return FlightMethod.GET_FLIGHT_INFO
 *     elif method == CFlightMethodGetSchema:
 */
  }

  /* "pyarrow/_flight.pyx":332
 *     elif method == CFlightMethodGetFlightInfo:
 *         return FlightMethod.GET_FLIGHT_INFO
 *     elif method == CFlightMethodGetSchema:             # <<<<<<<<<<<<<<
 *         return FlightMethod.GET_SCHEMA
 *     elif method == CFlightMethodDoGet:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::GetSchema) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":333
 *         return FlightMethod.GET_FLIGHT_INFO
 *     elif method == CFlightMethodGetSchema:
 *         return FlightMethod.GET_SCHEMA             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodDoGet:
 *         return FlightMethod.DO_GET
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_GET_SCHEMA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":332
 *     elif method == CFlightMethodGetFlightInfo:
 *         return FlightMethod.GET_FLIGHT_INFO
 *     elif method == CFlightMethodGetSchema:             # <<<<<<<<<<<<<<
 *         return FlightMethod.GET_SCHEMA
 *     elif method == CFlightMethodDoGet:
 */
  }

  /* "pyarrow/_flight.pyx":334
 *     elif method == CFlightMethodGetSchema:
 *         return FlightMethod.GET_SCHEMA
 *     elif method == CFlightMethodDoGet:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_GET
 *     elif method == CFlightMethodDoPut:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::DoGet) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":335
 *         return FlightMethod.GET_SCHEMA
 *     elif method == CFlightMethodDoGet:
 *         return FlightMethod.DO_GET             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodDoPut:
 *         return FlightMethod.DO_PUT
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DO_GET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":334
 *     elif method == CFlightMethodGetSchema:
 *         return FlightMethod.GET_SCHEMA
 *     elif method == CFlightMethodDoGet:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_GET
 *     elif method == CFlightMethodDoPut:
 */
  }

  /* "pyarrow/_flight.pyx":336
 *     elif method == CFlightMethodDoGet:
 *         return FlightMethod.DO_GET
 *     elif method == CFlightMethodDoPut:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_PUT
 *     elif method == CFlightMethodDoAction:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::DoPut) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":337
 *         return FlightMethod.DO_GET
 *     elif method == CFlightMethodDoPut:
 *         return FlightMethod.DO_PUT             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodDoAction:
 *         return FlightMethod.DO_ACTION
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DO_PUT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":336
 *     elif method == CFlightMethodDoGet:
 *         return FlightMethod.DO_GET
 *     elif method == CFlightMethodDoPut:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_PUT
 *     elif method == CFlightMethodDoAction:
 */
  }

  /* "pyarrow/_flight.pyx":338
 *     elif method == CFlightMethodDoPut:
 *         return FlightMethod.DO_PUT
 *     elif method == CFlightMethodDoAction:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_ACTION
 *     elif method == CFlightMethodListActions:
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::DoAction) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":339
 *         return FlightMethod.DO_PUT
 *     elif method == CFlightMethodDoAction:
 *         return FlightMethod.DO_ACTION             # <<<<<<<<<<<<<<
 *     elif method == CFlightMethodListActions:
 *         return FlightMethod.LIST_ACTIONS
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DO_ACTION); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":338
 *     elif method == CFlightMethodDoPut:
 *         return FlightMethod.DO_PUT
 *     elif method == CFlightMethodDoAction:             # <<<<<<<<<<<<<<
 *         return FlightMethod.DO_ACTION
 *     elif method == CFlightMethodListActions:
 */
  }

  /* "pyarrow/_flight.pyx":340
 *     elif method == CFlightMethodDoAction:
 *         return FlightMethod.DO_ACTION
 *     elif method == CFlightMethodListActions:             # <<<<<<<<<<<<<<
 *         return FlightMethod.LIST_ACTIONS
 *     return FlightMethod.INVALID
 */
  __pyx_t_1 = ((__pyx_v_method ==  arrow::flight::FlightMethod::ListActions) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":341
 *         return FlightMethod.DO_ACTION
 *     elif method == CFlightMethodListActions:
 *         return FlightMethod.LIST_ACTIONS             # <<<<<<<<<<<<<<
 *     return FlightMethod.INVALID
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LIST_ACTIONS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":340
 *     elif method == CFlightMethodDoAction:
 *         return FlightMethod.DO_ACTION
 *     elif method == CFlightMethodListActions:             # <<<<<<<<<<<<<<
 *         return FlightMethod.LIST_ACTIONS
 *     return FlightMethod.INVALID
 */
  }

  /* "pyarrow/_flight.pyx":342
 *     elif method == CFlightMethodListActions:
 *         return FlightMethod.LIST_ACTIONS
 *     return FlightMethod.INVALID             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FlightMethod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_INVALID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":325
 * 
 * 
 * cdef wrap_flight_method(CFlightMethod method):             # <<<<<<<<<<<<<<
 *     if method == CFlightMethodHandshake:
 *         return FlightMethod.HANDSHAKE
 */

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

/* "pyarrow/_flight.pyx":350
 *         CFlightDescriptor descriptor
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError("Do not call {}'s constructor directly, use "
 *                         "`pyarrow.flight.FlightDescriptor.for_{path,command}` "
 */

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

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

static int __pyx_pf_7pyarrow_7_flight_16FlightDescriptor___init__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":354
 *                         "`pyarrow.flight.FlightDescriptor.for_{path,command}` "
 *                         "function instead."
 *                         .format(self.__class__.__name__))             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Do_not_call_s_constructor_direct, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __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(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":351
 * 
 *     def __init__(self):
 *         raise TypeError("Do not call {}'s constructor directly, use "             # <<<<<<<<<<<<<<
 *                         "`pyarrow.flight.FlightDescriptor.for_{path,command}` "
 *                         "function instead."
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 351, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":350
 *         CFlightDescriptor descriptor
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError("Do not call {}'s constructor directly, use "
 *                         "`pyarrow.flight.FlightDescriptor.for_{path,command}` "
 */

  /* 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("pyarrow._flight.FlightDescriptor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":357
 * 
 *     @staticmethod
 *     def for_path(*path):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for a resource path."""
 *         cdef FlightDescriptor result = \
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_3for_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_2for_path[] = "FlightDescriptor.for_path(*path)\nCreate a FlightDescriptor for a resource path.";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_16FlightDescriptor_3for_path = {"for_path", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_3for_path, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_2for_path};
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_3for_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("for_path (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "for_path", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_path = __pyx_args;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_2for_path(__pyx_self, __pyx_v_path);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_2for_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_result = 0;
  PyObject *__pyx_7genexpr__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  std::vector<std::string>  __pyx_t_7;
  __Pyx_RefNannySetupContext("for_path", 0);

  /* "pyarrow/_flight.pyx":360
 *         """Create a FlightDescriptor for a resource path."""
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *         result.descriptor.type = CDescriptorTypePath
 *         result.descriptor.path = [tobytes(p) for p in path]
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":361
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor.type = CDescriptorTypePath             # <<<<<<<<<<<<<<
 *         result.descriptor.path = [tobytes(p) for p in path]
 *         return result
 */
  __pyx_v_result->descriptor.type =  arrow::flight::FlightDescriptor::PATH;

  /* "pyarrow/_flight.pyx":362
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor.type = CDescriptorTypePath
 *         result.descriptor.path = [tobytes(p) for p in path]             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_v_path; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 362, __pyx_L5_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_p, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_7genexpr__pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_7genexpr__pyx_v_p);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 362, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_p); __pyx_7genexpr__pyx_v_p = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_p); __pyx_7genexpr__pyx_v_p = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_7 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result->descriptor.path = __pyx_t_7;

  /* "pyarrow/_flight.pyx":363
 *         result.descriptor.type = CDescriptorTypePath
 *         result.descriptor.path = [tobytes(p) for p in path]
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":357
 * 
 *     @staticmethod
 *     def for_path(*path):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for a resource path."""
 *         cdef FlightDescriptor result = \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.for_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":366
 * 
 *     @staticmethod
 *     def for_command(command):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for an opaque command."""
 *         cdef FlightDescriptor result = \
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_5for_command(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_4for_command[] = "FlightDescriptor.for_command(command)\nCreate a FlightDescriptor for an opaque command.";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_16FlightDescriptor_5for_command = {"for_command", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_5for_command, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_4for_command};
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_5for_command(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_command = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("for_command (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_command,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_command)) != 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, "for_command") < 0)) __PYX_ERR(0, 366, __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_command = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("for_command", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.for_command", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4for_command(__pyx_v_command);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4for_command(PyObject *__pyx_v_command) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  __Pyx_RefNannySetupContext("for_command", 0);

  /* "pyarrow/_flight.pyx":369
 *         """Create a FlightDescriptor for an opaque command."""
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *         result.descriptor.type = CDescriptorTypeCmd
 *         result.descriptor.cmd = tobytes(command)
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":370
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor.type = CDescriptorTypeCmd             # <<<<<<<<<<<<<<
 *         result.descriptor.cmd = tobytes(command)
 *         return result
 */
  __pyx_v_result->descriptor.type =  arrow::flight::FlightDescriptor::CMD;

  /* "pyarrow/_flight.pyx":371
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor.type = CDescriptorTypeCmd
 *         result.descriptor.cmd = tobytes(command)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_command) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_command);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_result->descriptor.cmd = __pyx_t_4;

  /* "pyarrow/_flight.pyx":372
 *         result.descriptor.type = CDescriptorTypeCmd
 *         result.descriptor.cmd = tobytes(command)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":366
 * 
 *     @staticmethod
 *     def for_command(command):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for an opaque command."""
 *         cdef FlightDescriptor result = \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.for_command", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":375
 * 
 *     @property
 *     def descriptor_type(self):             # <<<<<<<<<<<<<<
 *         """Get the type of this descriptor."""
 *         if self.descriptor.type == CDescriptorTypeUnknown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":377
 *     def descriptor_type(self):
 *         """Get the type of this descriptor."""
 *         if self.descriptor.type == CDescriptorTypeUnknown:             # <<<<<<<<<<<<<<
 *             return DescriptorType.UNKNOWN
 *         elif self.descriptor.type == CDescriptorTypePath:
 */
  __pyx_t_1 = ((__pyx_v_self->descriptor.type ==  arrow::flight::FlightDescriptor::UNKNOWN) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":378
 *         """Get the type of this descriptor."""
 *         if self.descriptor.type == CDescriptorTypeUnknown:
 *             return DescriptorType.UNKNOWN             # <<<<<<<<<<<<<<
 *         elif self.descriptor.type == CDescriptorTypePath:
 *             return DescriptorType.PATH
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UNKNOWN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":377
 *     def descriptor_type(self):
 *         """Get the type of this descriptor."""
 *         if self.descriptor.type == CDescriptorTypeUnknown:             # <<<<<<<<<<<<<<
 *             return DescriptorType.UNKNOWN
 *         elif self.descriptor.type == CDescriptorTypePath:
 */
  }

  /* "pyarrow/_flight.pyx":379
 *         if self.descriptor.type == CDescriptorTypeUnknown:
 *             return DescriptorType.UNKNOWN
 *         elif self.descriptor.type == CDescriptorTypePath:             # <<<<<<<<<<<<<<
 *             return DescriptorType.PATH
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 */
  __pyx_t_1 = ((__pyx_v_self->descriptor.type ==  arrow::flight::FlightDescriptor::PATH) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":380
 *             return DescriptorType.UNKNOWN
 *         elif self.descriptor.type == CDescriptorTypePath:
 *             return DescriptorType.PATH             # <<<<<<<<<<<<<<
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 *             return DescriptorType.CMD
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PATH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":379
 *         if self.descriptor.type == CDescriptorTypeUnknown:
 *             return DescriptorType.UNKNOWN
 *         elif self.descriptor.type == CDescriptorTypePath:             # <<<<<<<<<<<<<<
 *             return DescriptorType.PATH
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 */
  }

  /* "pyarrow/_flight.pyx":381
 *         elif self.descriptor.type == CDescriptorTypePath:
 *             return DescriptorType.PATH
 *         elif self.descriptor.type == CDescriptorTypeCmd:             # <<<<<<<<<<<<<<
 *             return DescriptorType.CMD
 *         raise RuntimeError("Invalid descriptor type!")
 */
  __pyx_t_1 = ((__pyx_v_self->descriptor.type ==  arrow::flight::FlightDescriptor::CMD) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":382
 *             return DescriptorType.PATH
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 *             return DescriptorType.CMD             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Invalid descriptor type!")
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CMD); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":381
 *         elif self.descriptor.type == CDescriptorTypePath:
 *             return DescriptorType.PATH
 *         elif self.descriptor.type == CDescriptorTypeCmd:             # <<<<<<<<<<<<<<
 *             return DescriptorType.CMD
 *         raise RuntimeError("Invalid descriptor type!")
 */
  }

  /* "pyarrow/_flight.pyx":383
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 *             return DescriptorType.CMD
 *         raise RuntimeError("Invalid descriptor type!")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __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, 383, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":375
 * 
 *     @property
 *     def descriptor_type(self):             # <<<<<<<<<<<<<<
 *         """Get the type of this descriptor."""
 *         if self.descriptor.type == CDescriptorTypeUnknown:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.descriptor_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":386
 * 
 *     @property
 *     def command(self):             # <<<<<<<<<<<<<<
 *         """Get the command for this descriptor."""
 *         if self.descriptor_type != DescriptorType.CMD:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_7command_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_7command_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_7command___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_7command___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":388
 *     def command(self):
 *         """Get the command for this descriptor."""
 *         if self.descriptor_type != DescriptorType.CMD:             # <<<<<<<<<<<<<<
 *             return None
 *         return self.descriptor.cmd
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_descriptor_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CMD); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __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(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":389
 *         """Get the command for this descriptor."""
 *         if self.descriptor_type != DescriptorType.CMD:
 *             return None             # <<<<<<<<<<<<<<
 *         return self.descriptor.cmd
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":388
 *     def command(self):
 *         """Get the command for this descriptor."""
 *         if self.descriptor_type != DescriptorType.CMD:             # <<<<<<<<<<<<<<
 *             return None
 *         return self.descriptor.cmd
 */
  }

  /* "pyarrow/_flight.pyx":390
 *         if self.descriptor_type != DescriptorType.CMD:
 *             return None
 *         return self.descriptor.cmd             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->descriptor.cmd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":386
 * 
 *     @property
 *     def command(self):             # <<<<<<<<<<<<<<
 *         """Get the command for this descriptor."""
 *         if self.descriptor_type != DescriptorType.CMD:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.command.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":393
 * 
 *     @property
 *     def path(self):             # <<<<<<<<<<<<<<
 *         """Get the path for this descriptor."""
 *         if self.descriptor_type != DescriptorType.PATH:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_4path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_4path_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4path___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_4path___get__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":395
 *     def path(self):
 *         """Get the path for this descriptor."""
 *         if self.descriptor_type != DescriptorType.PATH:             # <<<<<<<<<<<<<<
 *             return None
 *         return self.descriptor.path
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_descriptor_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PATH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __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(0, 395, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":396
 *         """Get the path for this descriptor."""
 *         if self.descriptor_type != DescriptorType.PATH:
 *             return None             # <<<<<<<<<<<<<<
 *         return self.descriptor.path
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":395
 *     def path(self):
 *         """Get the path for this descriptor."""
 *         if self.descriptor_type != DescriptorType.PATH:             # <<<<<<<<<<<<<<
 *             return None
 *         return self.descriptor.path
 */
  }

  /* "pyarrow/_flight.pyx":397
 *         if self.descriptor_type != DescriptorType.PATH:
 *             return None
 *         return self.descriptor.path             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_self->descriptor.path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":393
 * 
 *     @property
 *     def path(self):             # <<<<<<<<<<<<<<
 *         """Get the path for this descriptor."""
 *         if self.descriptor_type != DescriptorType.PATH:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":399
 *         return self.descriptor.path
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if self.descriptor_type == DescriptorType.PATH:
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_7__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_6__repr__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_6__repr__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pyarrow/_flight.pyx":400
 * 
 *     def __repr__(self):
 *         if self.descriptor_type == DescriptorType.PATH:             # <<<<<<<<<<<<<<
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 *         elif self.descriptor_type == DescriptorType.CMD:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_descriptor_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PATH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __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_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":401
 *     def __repr__(self):
 *         if self.descriptor_type == DescriptorType.PATH:
 *             return "<FlightDescriptor path: {!r}>".format(self.path)             # <<<<<<<<<<<<<<
 *         elif self.descriptor_type == DescriptorType.CMD:
 *             return "<FlightDescriptor command: {!r}>".format(self.command)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightDescriptor_path_r, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __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;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":400
 * 
 *     def __repr__(self):
 *         if self.descriptor_type == DescriptorType.PATH:             # <<<<<<<<<<<<<<
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 *         elif self.descriptor_type == DescriptorType.CMD:
 */
  }

  /* "pyarrow/_flight.pyx":402
 *         if self.descriptor_type == DescriptorType.PATH:
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 *         elif self.descriptor_type == DescriptorType.CMD:             # <<<<<<<<<<<<<<
 *             return "<FlightDescriptor command: {!r}>".format(self.command)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_descriptor_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DescriptorType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_CMD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":403
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 *         elif self.descriptor_type == DescriptorType.CMD:
 *             return "<FlightDescriptor command: {!r}>".format(self.command)             # <<<<<<<<<<<<<<
 *         else:
 *             return "<FlightDescriptor type: {!r}>".format(self.descriptor_type)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightDescriptor_command_r, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_command); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":402
 *         if self.descriptor_type == DescriptorType.PATH:
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 *         elif self.descriptor_type == DescriptorType.CMD:             # <<<<<<<<<<<<<<
 *             return "<FlightDescriptor command: {!r}>".format(self.command)
 *         else:
 */
  }

  /* "pyarrow/_flight.pyx":405
 *             return "<FlightDescriptor command: {!r}>".format(self.command)
 *         else:
 *             return "<FlightDescriptor type: {!r}>".format(self.descriptor_type)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightDescriptor_type_r, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_descriptor_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "pyarrow/_flight.pyx":399
 *         return self.descriptor.path
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if self.descriptor_type == DescriptorType.PATH:
 *             return "<FlightDescriptor path: {!r}>".format(self.path)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":408
 * 
 *     @staticmethod
 *     cdef CFlightDescriptor unwrap(descriptor) except *:             # <<<<<<<<<<<<<<
 *         if not isinstance(descriptor, FlightDescriptor):
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 */

static  arrow::flight::FlightDescriptor __pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor) {
   arrow::flight::FlightDescriptor __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("unwrap", 0);

  /* "pyarrow/_flight.pyx":409
 *     @staticmethod
 *     cdef CFlightDescriptor unwrap(descriptor) except *:
 *         if not isinstance(descriptor, FlightDescriptor):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 *                 type(descriptor)))
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_descriptor), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pyarrow/_flight.pyx":410
 *     cdef CFlightDescriptor unwrap(descriptor) except *:
 *         if not isinstance(descriptor, FlightDescriptor):
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(descriptor)))
 *         return (<FlightDescriptor> descriptor).descriptor
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Must_provide_a_FlightDescriptor, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "pyarrow/_flight.pyx":411
 *         if not isinstance(descriptor, FlightDescriptor):
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 *                 type(descriptor)))             # <<<<<<<<<<<<<<
 *         return (<FlightDescriptor> descriptor).descriptor
 * 
 */
    __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, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_descriptor)))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_descriptor))));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":410
 *     cdef CFlightDescriptor unwrap(descriptor) except *:
 *         if not isinstance(descriptor, FlightDescriptor):
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(descriptor)))
 *         return (<FlightDescriptor> descriptor).descriptor
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 410, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":409
 *     @staticmethod
 *     cdef CFlightDescriptor unwrap(descriptor) except *:
 *         if not isinstance(descriptor, FlightDescriptor):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 *                 type(descriptor)))
 */
  }

  /* "pyarrow/_flight.pyx":412
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 *                 type(descriptor)))
 *         return (<FlightDescriptor> descriptor).descriptor             # <<<<<<<<<<<<<<
 * 
 *     def serialize(self):
 */
  __pyx_r = __pyx_v_descriptor->descriptor;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":408
 * 
 *     @staticmethod
 *     cdef CFlightDescriptor unwrap(descriptor) except *:             # <<<<<<<<<<<<<<
 *         if not isinstance(descriptor, FlightDescriptor):
 *             raise TypeError("Must provide a FlightDescriptor, not '{}'".format(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.unwrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":414
 *         return (<FlightDescriptor> descriptor).descriptor
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_9serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_8serialize[] = "FlightDescriptor.serialize(self)\nGet the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_9serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_8serialize(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_8serialize(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  std::string __pyx_v_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("serialize", 0);

  /* "pyarrow/_flight.pyx":422
 *         """
 *         cdef c_string out
 *         check_flight_status(self.descriptor.SerializeToString(&out))             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->descriptor.SerializeToString((&__pyx_v_out))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 422, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":423
 *         cdef c_string out
 *         check_flight_status(self.descriptor.SerializeToString(&out))
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":414
 *         return (<FlightDescriptor> descriptor).descriptor
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.serialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":426
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_11deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_10deserialize[] = "FlightDescriptor.deserialize(type cls, serialized)\nParse the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_11deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deserialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_10deserialize(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_serialized));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_10deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("deserialize", 0);

  /* "pyarrow/_flight.pyx":434
 *         """
 *         cdef FlightDescriptor descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *         check_flight_status(CFlightDescriptor.Deserialize(
 *             tobytes(serialized), &descriptor.descriptor))
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":436
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         check_flight_status(CFlightDescriptor.Deserialize(
 *             tobytes(serialized), &descriptor.descriptor))             # <<<<<<<<<<<<<<
 *         return descriptor
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_serialized) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_serialized);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":435
 *         cdef FlightDescriptor descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         check_flight_status(CFlightDescriptor.Deserialize(             # <<<<<<<<<<<<<<
 *             tobytes(serialized), &descriptor.descriptor))
 *         return descriptor
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::FlightDescriptor::Deserialize(__pyx_t_4, (&__pyx_v_descriptor->descriptor))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 435, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":437
 *         check_flight_status(CFlightDescriptor.Deserialize(
 *             tobytes(serialized), &descriptor.descriptor))
 *         return descriptor             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, FlightDescriptor other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_descriptor));
  __pyx_r = ((PyObject *)__pyx_v_descriptor);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":426
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.deserialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descriptor);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":439
 *         return descriptor
 * 
 *     def __eq__(self, FlightDescriptor other):             # <<<<<<<<<<<<<<
 *         return self.descriptor == other.descriptor
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_13__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_13__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor, 1, "other", 0))) __PYX_ERR(0, 439, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightDescriptor_12__eq__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self), ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_12__eq__(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "pyarrow/_flight.pyx":440
 * 
 *     def __eq__(self, FlightDescriptor other):
 *         return self.descriptor == other.descriptor             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->descriptor == __pyx_v_other->descriptor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":439
 *         return descriptor
 * 
 *     def __eq__(self, FlightDescriptor other):             # <<<<<<<<<<<<<<
 *         return self.descriptor == other.descriptor
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.__eq__", __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("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_14__reduce_cython__[] = "FlightDescriptor.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15__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_7pyarrow_7_flight_16FlightDescriptor_14__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightDescriptor.__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("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_16__setstate_cython__[] = "FlightDescriptor.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_17__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_7pyarrow_7_flight_16FlightDescriptor_16__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDescriptor_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":449
 *         CTicket ticket
 * 
 *     def __init__(self, ticket):             # <<<<<<<<<<<<<<
 *         self.ticket.ticket = tobytes(ticket)
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_6Ticket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_6Ticket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ticket = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ticket,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_ticket)) != 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(0, 449, __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_ticket = 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(0, 449, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Ticket.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket___init__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self), __pyx_v_ticket);

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

static int __pyx_pf_7pyarrow_7_flight_6Ticket___init__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, PyObject *__pyx_v_ticket) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":450
 * 
 *     def __init__(self, ticket):
 *         self.ticket.ticket = tobytes(ticket)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_ticket) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ticket);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->ticket.ticket = __pyx_t_4;

  /* "pyarrow/_flight.pyx":449
 *         CTicket ticket
 * 
 *     def __init__(self, ticket):             # <<<<<<<<<<<<<<
 *         self.ticket.ticket = tobytes(ticket)
 * 
 */

  /* 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("pyarrow._flight.Ticket.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":453
 * 
 *     @property
 *     def ticket(self):             # <<<<<<<<<<<<<<
 *         return self.ticket.ticket
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_6ticket_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_6ticket_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_6ticket___get__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_6ticket___get__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":454
 *     @property
 *     def ticket(self):
 *         return self.ticket.ticket             # <<<<<<<<<<<<<<
 * 
 *     def serialize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->ticket.ticket); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":453
 * 
 *     @property
 *     def ticket(self):             # <<<<<<<<<<<<<<
 *         return self.ticket.ticket
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Ticket.ticket.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":456
 *         return self.ticket.ticket
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_3serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Ticket_2serialize[] = "Ticket.serialize(self)\nGet the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_3serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_2serialize(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_2serialize(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self) {
  std::string __pyx_v_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("serialize", 0);

  /* "pyarrow/_flight.pyx":464
 *         """
 *         cdef c_string out
 *         check_flight_status(self.ticket.SerializeToString(&out))             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->ticket.SerializeToString((&__pyx_v_out))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 464, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":465
 *         cdef c_string out
 *         check_flight_status(self.ticket.SerializeToString(&out))
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":456
 *         return self.ticket.ticket
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.Ticket.serialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":468
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_5deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Ticket_4deserialize[] = "Ticket.deserialize(type cls, serialized)\nParse the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_5deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deserialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_4deserialize(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_serialized));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_4deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
   arrow::flight::Ticket __pyx_v_c_ticket;
  struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_ticket = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("deserialize", 0);

  /* "pyarrow/_flight.pyx":479
 *             Ticket ticket
 *         check_flight_status(
 *             CTicket.Deserialize(tobytes(serialized), &c_ticket))             # <<<<<<<<<<<<<<
 *         ticket = Ticket.__new__(Ticket)
 *         ticket.ticket = c_ticket
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_serialized) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_serialized);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":478
 *             CTicket c_ticket
 *             Ticket ticket
 *         check_flight_status(             # <<<<<<<<<<<<<<
 *             CTicket.Deserialize(tobytes(serialized), &c_ticket))
 *         ticket = Ticket.__new__(Ticket)
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Ticket::Deserialize(__pyx_t_4, (&__pyx_v_c_ticket))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 478, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":480
 *         check_flight_status(
 *             CTicket.Deserialize(tobytes(serialized), &c_ticket))
 *         ticket = Ticket.__new__(Ticket)             # <<<<<<<<<<<<<<
 *         ticket.ticket = c_ticket
 *         return ticket
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Ticket(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Ticket), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_ticket = ((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":481
 *             CTicket.Deserialize(tobytes(serialized), &c_ticket))
 *         ticket = Ticket.__new__(Ticket)
 *         ticket.ticket = c_ticket             # <<<<<<<<<<<<<<
 *         return ticket
 * 
 */
  __pyx_v_ticket->ticket = __pyx_v_c_ticket;

  /* "pyarrow/_flight.pyx":482
 *         ticket = Ticket.__new__(Ticket)
 *         ticket.ticket = c_ticket
 *         return ticket             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, Ticket other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ticket));
  __pyx_r = ((PyObject *)__pyx_v_ticket);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":468
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.Ticket.deserialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ticket);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":484
 *         return ticket
 * 
 *     def __eq__(self, Ticket other):             # <<<<<<<<<<<<<<
 *         return self.ticket == other.ticket
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7pyarrow_7_flight_Ticket, 1, "other", 0))) __PYX_ERR(0, 484, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_6__eq__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self), ((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_6__eq__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "pyarrow/_flight.pyx":485
 * 
 *     def __eq__(self, Ticket other):
 *         return self.ticket == other.ticket             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->ticket == __pyx_v_other->ticket)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":484
 *         return ticket
 * 
 *     def __eq__(self, Ticket other):             # <<<<<<<<<<<<<<
 *         return self.ticket == other.ticket
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Ticket.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":487
 *         return self.ticket == other.ticket
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Ticket {}>'.format(self.ticket.ticket)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_9__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_8__repr__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_8__repr__(struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pyarrow/_flight.pyx":488
 * 
 *     def __repr__(self):
 *         return '<Ticket {}>'.format(self.ticket.ticket)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Ticket, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->ticket.ticket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __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;

  /* "pyarrow/_flight.pyx":487
 *         return self.ticket == other.ticket
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Ticket {}>'.format(self.ticket.ticket)
 * 
 */

  /* 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("pyarrow._flight.Ticket.__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("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Ticket_10__reduce_cython__[] = "Ticket.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_10__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Ticket.__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("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6Ticket_12__setstate_cython__[] = "Ticket.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_6Ticket_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6Ticket_12__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_6Ticket_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":496
 *         CLocation location
 * 
 *     def __init__(self, uri):             # <<<<<<<<<<<<<<
 *         check_flight_status(CLocation.Parse(tobytes(uri), &self.location))
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_8Location_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_8Location_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_uri = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_uri,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_uri)) != 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(0, 496, __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_uri = 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(0, 496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Location.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location___init__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self), __pyx_v_uri);

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

static int __pyx_pf_7pyarrow_7_flight_8Location___init__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, PyObject *__pyx_v_uri) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":497
 * 
 *     def __init__(self, uri):
 *         check_flight_status(CLocation.Parse(tobytes(uri), &self.location))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_uri) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_uri);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::Parse(__pyx_t_4, (&__pyx_v_self->location))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 497, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":496
 *         CLocation location
 * 
 *     def __init__(self, uri):             # <<<<<<<<<<<<<<
 *         check_flight_status(CLocation.Parse(tobytes(uri), &self.location))
 * 
 */

  /* 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("pyarrow._flight.Location.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":499
 *         check_flight_status(CLocation.Parse(tobytes(uri), &self.location))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Location {}>'.format(self.location.ToString())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_2__repr__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_2__repr__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pyarrow/_flight.pyx":500
 * 
 *     def __repr__(self):
 *         return '<Location {}>'.format(self.location.ToString())             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Location, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->location.ToString()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __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;

  /* "pyarrow/_flight.pyx":499
 *         check_flight_status(CLocation.Parse(tobytes(uri), &self.location))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Location {}>'.format(self.location.ToString())
 * 
 */

  /* 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("pyarrow._flight.Location.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":503
 * 
 *     @property
 *     def uri(self):             # <<<<<<<<<<<<<<
 *         return self.location.ToString()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_3uri_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_3uri_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_3uri___get__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_3uri___get__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":504
 *     @property
 *     def uri(self):
 *         return self.location.ToString()             # <<<<<<<<<<<<<<
 * 
 *     def equals(self, Location other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->location.ToString()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":503
 * 
 *     @property
 *     def uri(self):             # <<<<<<<<<<<<<<
 *         return self.location.ToString()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Location.uri.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":506
 *         return self.location.ToString()
 * 
 *     def equals(self, Location other):             # <<<<<<<<<<<<<<
 *         return self == other
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_5equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_4equals[] = "Location.equals(self, Location other)";
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_5equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equals (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7pyarrow_7_flight_Location, 1, "other", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_4equals(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self), ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_4equals(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("equals", 0);

  /* "pyarrow/_flight.pyx":507
 * 
 *     def equals(self, Location other):
 *         return self == other             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":506
 *         return self.location.ToString()
 * 
 *     def equals(self, Location other):             # <<<<<<<<<<<<<<
 *         return self == other
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Location.equals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":509
 *         return self == other
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, Location):
 *             return NotImplemented
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_6__eq__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_6__eq__(struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "pyarrow/_flight.pyx":510
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, Location):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return self.location.Equals((<Location> other).location)
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_7pyarrow_7_flight_Location); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":511
 *     def __eq__(self, other):
 *         if not isinstance(other, Location):
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return self.location.Equals((<Location> other).location)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":510
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, Location):             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         return self.location.Equals((<Location> other).location)
 */
  }

  /* "pyarrow/_flight.pyx":512
 *         if not isinstance(other, Location):
 *             return NotImplemented
 *         return self.location.Equals((<Location> other).location)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->location.Equals(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_other)->location)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":509
 *         return self == other
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, Location):
 *             return NotImplemented
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.Location.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":515
 * 
 *     @staticmethod
 *     def for_grpc_tcp(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TCP-based gRPC service."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_9for_grpc_tcp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_8for_grpc_tcp[] = "Location.for_grpc_tcp(host, port)\nCreate a Location for a TCP-based gRPC service.";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_8Location_9for_grpc_tcp = {"for_grpc_tcp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_9for_grpc_tcp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_8for_grpc_tcp};
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_9for_grpc_tcp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_port = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("for_grpc_tcp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,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_host)) != 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_port)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("for_grpc_tcp", 1, 2, 2, 1); __PYX_ERR(0, 515, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "for_grpc_tcp") < 0)) __PYX_ERR(0, 515, __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_host = values[0];
    __pyx_v_port = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("for_grpc_tcp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 515, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_tcp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_8for_grpc_tcp(__pyx_v_host, __pyx_v_port);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_8for_grpc_tcp(PyObject *__pyx_v_host, PyObject *__pyx_v_port) {
  std::string __pyx_v_c_host;
  int __pyx_v_c_port;
  struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("for_grpc_tcp", 0);

  /* "pyarrow/_flight.pyx":518
 *         """Create a Location for a TCP-based gRPC service."""
 *         cdef:
 *             c_string c_host = tobytes(host)             # <<<<<<<<<<<<<<
 *             int c_port = port
 *             Location result = Location.__new__(Location)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_host) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_c_host = __pyx_t_4;

  /* "pyarrow/_flight.pyx":519
 *         cdef:
 *             c_string c_host = tobytes(host)
 *             int c_port = port             # <<<<<<<<<<<<<<
 *             Location result = Location.__new__(Location)
 *         check_flight_status(
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_port); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 519, __pyx_L1_error)
  __pyx_v_c_port = __pyx_t_5;

  /* "pyarrow/_flight.pyx":520
 *             c_string c_host = tobytes(host)
 *             int c_port = port
 *             Location result = Location.__new__(Location)             # <<<<<<<<<<<<<<
 *         check_flight_status(
 *             CLocation.ForGrpcTcp(c_host, c_port, &result.location))
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Location(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":521
 *             int c_port = port
 *             Location result = Location.__new__(Location)
 *         check_flight_status(             # <<<<<<<<<<<<<<
 *             CLocation.ForGrpcTcp(c_host, c_port, &result.location))
 *         return result
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::ForGrpcTcp(__pyx_v_c_host, __pyx_v_c_port, (&__pyx_v_result->location))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 521, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":523
 *         check_flight_status(
 *             CLocation.ForGrpcTcp(c_host, c_port, &result.location))
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":515
 * 
 *     @staticmethod
 *     def for_grpc_tcp(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TCP-based gRPC service."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_tcp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":526
 * 
 *     @staticmethod
 *     def for_grpc_tls(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TLS-based gRPC service."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_11for_grpc_tls(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_10for_grpc_tls[] = "Location.for_grpc_tls(host, port)\nCreate a Location for a TLS-based gRPC service.";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_8Location_11for_grpc_tls = {"for_grpc_tls", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_11for_grpc_tls, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_10for_grpc_tls};
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_11for_grpc_tls(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_port = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("for_grpc_tls (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,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_host)) != 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_port)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("for_grpc_tls", 1, 2, 2, 1); __PYX_ERR(0, 526, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "for_grpc_tls") < 0)) __PYX_ERR(0, 526, __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_host = values[0];
    __pyx_v_port = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("for_grpc_tls", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 526, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_tls", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_10for_grpc_tls(__pyx_v_host, __pyx_v_port);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_10for_grpc_tls(PyObject *__pyx_v_host, PyObject *__pyx_v_port) {
  std::string __pyx_v_c_host;
  int __pyx_v_c_port;
  struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("for_grpc_tls", 0);

  /* "pyarrow/_flight.pyx":529
 *         """Create a Location for a TLS-based gRPC service."""
 *         cdef:
 *             c_string c_host = tobytes(host)             # <<<<<<<<<<<<<<
 *             int c_port = port
 *             Location result = Location.__new__(Location)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_host) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_c_host = __pyx_t_4;

  /* "pyarrow/_flight.pyx":530
 *         cdef:
 *             c_string c_host = tobytes(host)
 *             int c_port = port             # <<<<<<<<<<<<<<
 *             Location result = Location.__new__(Location)
 *         check_flight_status(
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_port); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L1_error)
  __pyx_v_c_port = __pyx_t_5;

  /* "pyarrow/_flight.pyx":531
 *             c_string c_host = tobytes(host)
 *             int c_port = port
 *             Location result = Location.__new__(Location)             # <<<<<<<<<<<<<<
 *         check_flight_status(
 *             CLocation.ForGrpcTls(c_host, c_port, &result.location))
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Location(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":532
 *             int c_port = port
 *             Location result = Location.__new__(Location)
 *         check_flight_status(             # <<<<<<<<<<<<<<
 *             CLocation.ForGrpcTls(c_host, c_port, &result.location))
 *         return result
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::ForGrpcTls(__pyx_v_c_host, __pyx_v_c_port, (&__pyx_v_result->location))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 532, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":534
 *         check_flight_status(
 *             CLocation.ForGrpcTls(c_host, c_port, &result.location))
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":526
 * 
 *     @staticmethod
 *     def for_grpc_tls(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TLS-based gRPC service."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_tls", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":537
 * 
 *     @staticmethod
 *     def for_grpc_unix(path):             # <<<<<<<<<<<<<<
 *         """Create a Location for a domain socket-based gRPC service."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_13for_grpc_unix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_12for_grpc_unix[] = "Location.for_grpc_unix(path)\nCreate a Location for a domain socket-based gRPC service.";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_8Location_13for_grpc_unix = {"for_grpc_unix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_13for_grpc_unix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_12for_grpc_unix};
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_13for_grpc_unix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("for_grpc_unix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,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_path)) != 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, "for_grpc_unix") < 0)) __PYX_ERR(0, 537, __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_path = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("for_grpc_unix", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 537, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_unix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8Location_12for_grpc_unix(__pyx_v_path);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_12for_grpc_unix(PyObject *__pyx_v_path) {
  std::string __pyx_v_c_path;
  struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("for_grpc_unix", 0);

  /* "pyarrow/_flight.pyx":540
 *         """Create a Location for a domain socket-based gRPC service."""
 *         cdef:
 *             c_string c_path = tobytes(path)             # <<<<<<<<<<<<<<
 *             Location result = Location.__new__(Location)
 *         check_flight_status(CLocation.ForGrpcUnix(c_path, &result.location))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_path) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_path);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_c_path = __pyx_t_4;

  /* "pyarrow/_flight.pyx":541
 *         cdef:
 *             c_string c_path = tobytes(path)
 *             Location result = Location.__new__(Location)             # <<<<<<<<<<<<<<
 *         check_flight_status(CLocation.ForGrpcUnix(c_path, &result.location))
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Location(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":542
 *             c_string c_path = tobytes(path)
 *             Location result = Location.__new__(Location)
 *         check_flight_status(CLocation.ForGrpcUnix(c_path, &result.location))             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::ForGrpcUnix(__pyx_v_c_path, (&__pyx_v_result->location))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 542, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":543
 *             Location result = Location.__new__(Location)
 *         check_flight_status(CLocation.ForGrpcUnix(c_path, &result.location))
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":537
 * 
 *     @staticmethod
 *     def for_grpc_unix(path):             # <<<<<<<<<<<<<<
 *         """Create a Location for a domain socket-based gRPC service."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.Location.for_grpc_unix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":546
 * 
 *     @staticmethod
 *     cdef Location wrap(CLocation location):             # <<<<<<<<<<<<<<
 *         cdef Location result = Location.__new__(Location)
 *         result.location = location
 */

static struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_f_7pyarrow_7_flight_8Location_wrap( arrow::flight::Location __pyx_v_location) {
  struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":547
 *     @staticmethod
 *     cdef Location wrap(CLocation location):
 *         cdef Location result = Location.__new__(Location)             # <<<<<<<<<<<<<<
 *         result.location = location
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Location(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":548
 *     cdef Location wrap(CLocation location):
 *         cdef Location result = Location.__new__(Location)
 *         result.location = location             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->location = __pyx_v_location;

  /* "pyarrow/_flight.pyx":549
 *         cdef Location result = Location.__new__(Location)
 *         result.location = location
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":546
 * 
 *     @staticmethod
 *     cdef Location wrap(CLocation location):             # <<<<<<<<<<<<<<
 *         cdef Location result = Location.__new__(Location)
 *         result.location = location
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Location.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":552
 * 
 *     @staticmethod
 *     cdef CLocation unwrap(object location) except *:             # <<<<<<<<<<<<<<
 *         cdef CLocation c_location
 *         if isinstance(location, six.text_type):
 */

static  arrow::flight::Location __pyx_f_7pyarrow_7_flight_8Location_unwrap(PyObject *__pyx_v_location) {
   arrow::flight::Location __pyx_v_c_location;
   arrow::flight::Location __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  std::string __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("unwrap", 0);

  /* "pyarrow/_flight.pyx":554
 *     cdef CLocation unwrap(object location) except *:
 *         cdef CLocation c_location
 *         if isinstance(location, six.text_type):             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 CLocation.Parse(tobytes(location), &c_location))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_location, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":556
 *         if isinstance(location, six.text_type):
 *             check_flight_status(
 *                 CLocation.Parse(tobytes(location), &c_location))             # <<<<<<<<<<<<<<
 *             return c_location
 *         elif not isinstance(location, Location):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_location) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_location);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":555
 *         cdef CLocation c_location
 *         if isinstance(location, six.text_type):
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 CLocation.Parse(tobytes(location), &c_location))
 *             return c_location
 */
    __pyx_t_7 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::Parse(__pyx_t_6, (&__pyx_v_c_location))); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 555, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":557
 *             check_flight_status(
 *                 CLocation.Parse(tobytes(location), &c_location))
 *             return c_location             # <<<<<<<<<<<<<<
 *         elif not isinstance(location, Location):
 *             raise TypeError("Must provide a Location, not '{}'".format(
 */
    __pyx_r = __pyx_v_c_location;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":554
 *     cdef CLocation unwrap(object location) except *:
 *         cdef CLocation c_location
 *         if isinstance(location, six.text_type):             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 CLocation.Parse(tobytes(location), &c_location))
 */
  }

  /* "pyarrow/_flight.pyx":558
 *                 CLocation.Parse(tobytes(location), &c_location))
 *             return c_location
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide a Location, not '{}'".format(
 *                 type(location)))
 */
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location); 
  __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyarrow/_flight.pyx":559
 *             return c_location
 *         elif not isinstance(location, Location):
 *             raise TypeError("Must provide a Location, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(location)))
 *         return (<Location> location).location
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Must_provide_a_Location_not, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "pyarrow/_flight.pyx":560
 *         elif not isinstance(location, Location):
 *             raise TypeError("Must provide a Location, not '{}'".format(
 *                 type(location)))             # <<<<<<<<<<<<<<
 *         return (<Location> location).location
 * 
 */
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_location))) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)Py_TYPE(__pyx_v_location)));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":559
 *             return c_location
 *         elif not isinstance(location, Location):
 *             raise TypeError("Must provide a Location, not '{}'".format(             # <<<<<<<<<<<<<<
 *                 type(location)))
 *         return (<Location> location).location
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __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(0, 559, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":558
 *                 CLocation.Parse(tobytes(location), &c_location))
 *             return c_location
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError("Must provide a Location, not '{}'".format(
 *                 type(location)))
 */
  }

  /* "pyarrow/_flight.pyx":561
 *             raise TypeError("Must provide a Location, not '{}'".format(
 *                 type(location)))
 *         return (<Location> location).location             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_location)->location;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":552
 * 
 *     @staticmethod
 *     cdef CLocation unwrap(object location) except *:             # <<<<<<<<<<<<<<
 *         cdef CLocation c_location
 *         if isinstance(location, six.text_type):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.Location.unwrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_14__reduce_cython__[] = "Location.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_15__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_7pyarrow_7_flight_8Location_14__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.Location.__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("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8Location_16__setstate_cython__[] = "Location.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_8Location_17__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_7pyarrow_7_flight_8Location_16__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_8Location_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":569
 *         CFlightEndpoint endpoint
 * 
 *     def __init__(self, ticket, locations):             # <<<<<<<<<<<<<<
 *         """Create a FlightEndpoint from a ticket and list of locations.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_14FlightEndpoint___init__[] = "Create a FlightEndpoint from a ticket and list of locations.\n\n        Parameters\n        ----------\n        ticket : Ticket or bytes\n            the ticket needed to access this flight\n        locations : list of string URIs\n            locations where this flight is available\n\n        Raises\n        ------\n        ArrowException\n            If one of the location URIs is not a valid URI.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_14FlightEndpoint___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ticket = 0;
  PyObject *__pyx_v_locations = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ticket,&__pyx_n_s_locations,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_ticket)) != 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_locations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 569, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 569, __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_ticket = values[0];
    __pyx_v_locations = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 569, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightEndpoint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint___init__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self), __pyx_v_ticket, __pyx_v_locations);

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

static int __pyx_pf_7pyarrow_7_flight_14FlightEndpoint___init__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, PyObject *__pyx_v_ticket, PyObject *__pyx_v_locations) {
   arrow::flight::Location __pyx_v_c_location;
  PyObject *__pyx_v_location = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  std::string __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
   arrow::flight::Location __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":587
 *             CLocation c_location
 * 
 *         if isinstance(ticket, Ticket):             # <<<<<<<<<<<<<<
 *             self.endpoint.ticket.ticket = tobytes(ticket.ticket)
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ticket, __pyx_ptype_7pyarrow_7_flight_Ticket); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":588
 * 
 *         if isinstance(ticket, Ticket):
 *             self.endpoint.ticket.ticket = tobytes(ticket.ticket)             # <<<<<<<<<<<<<<
 *         else:
 *             self.endpoint.ticket.ticket = tobytes(ticket)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ticket, __pyx_n_s_ticket); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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(0, 588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 588, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_self->endpoint.ticket.ticket = __pyx_t_7;

    /* "pyarrow/_flight.pyx":587
 *             CLocation c_location
 * 
 *         if isinstance(ticket, Ticket):             # <<<<<<<<<<<<<<
 *             self.endpoint.ticket.ticket = tobytes(ticket.ticket)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":590
 *             self.endpoint.ticket.ticket = tobytes(ticket.ticket)
 *         else:
 *             self.endpoint.ticket.ticket = tobytes(ticket)             # <<<<<<<<<<<<<<
 * 
 *         for location in locations:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_ticket) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ticket);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_self->endpoint.ticket.ticket = __pyx_t_7;
  }
  __pyx_L3:;

  /* "pyarrow/_flight.pyx":592
 *             self.endpoint.ticket.ticket = tobytes(ticket)
 * 
 *         for location in locations:             # <<<<<<<<<<<<<<
 *             if isinstance(location, Location):
 *                 c_location = (<Location> location).location
 */
  if (likely(PyList_CheckExact(__pyx_v_locations)) || PyTuple_CheckExact(__pyx_v_locations)) {
    __pyx_t_3 = __pyx_v_locations; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_locations); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 592, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 592, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_location, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":593
 * 
 *         for location in locations:
 *             if isinstance(location, Location):             # <<<<<<<<<<<<<<
 *                 c_location = (<Location> location).location
 *             else:
 */
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pyarrow/_flight.pyx":594
 *         for location in locations:
 *             if isinstance(location, Location):
 *                 c_location = (<Location> location).location             # <<<<<<<<<<<<<<
 *             else:
 *                 c_location = CLocation()
 */
      __pyx_t_10 = ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_location)->location;
      __pyx_v_c_location = __pyx_t_10;

      /* "pyarrow/_flight.pyx":593
 * 
 *         for location in locations:
 *             if isinstance(location, Location):             # <<<<<<<<<<<<<<
 *                 c_location = (<Location> location).location
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyarrow/_flight.pyx":596
 *                 c_location = (<Location> location).location
 *             else:
 *                 c_location = CLocation()             # <<<<<<<<<<<<<<
 *                 check_flight_status(
 *                     CLocation.Parse(tobytes(location), &c_location))
 */
    /*else*/ {
      __pyx_v_c_location =  arrow::flight::Location();

      /* "pyarrow/_flight.pyx":598
 *                 c_location = CLocation()
 *                 check_flight_status(
 *                     CLocation.Parse(tobytes(location), &c_location))             # <<<<<<<<<<<<<<
 *             self.endpoint.locations.push_back(c_location)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_v_location) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_location);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":597
 *             else:
 *                 c_location = CLocation()
 *                 check_flight_status(             # <<<<<<<<<<<<<<
 *                     CLocation.Parse(tobytes(location), &c_location))
 *             self.endpoint.locations.push_back(c_location)
 */
      __pyx_t_11 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::Location::Parse(__pyx_t_7, (&__pyx_v_c_location))); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 597, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "pyarrow/_flight.pyx":599
 *                 check_flight_status(
 *                     CLocation.Parse(tobytes(location), &c_location))
 *             self.endpoint.locations.push_back(c_location)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    try {
      __pyx_v_self->endpoint.locations.push_back(__pyx_v_c_location);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 599, __pyx_L1_error)
    }

    /* "pyarrow/_flight.pyx":592
 *             self.endpoint.ticket.ticket = tobytes(ticket)
 * 
 *         for location in locations:             # <<<<<<<<<<<<<<
 *             if isinstance(location, Location):
 *                 c_location = (<Location> location).location
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":569
 *         CFlightEndpoint endpoint
 * 
 *     def __init__(self, ticket, locations):             # <<<<<<<<<<<<<<
 *         """Create a FlightEndpoint from a ticket and list of locations.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  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_AddTraceback("pyarrow._flight.FlightEndpoint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_location);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":602
 * 
 *     @property
 *     def ticket(self):             # <<<<<<<<<<<<<<
 *         """Get the ticket in this endpoint."""
 *         return Ticket(self.endpoint.ticket.ticket)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_6ticket_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_6ticket_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6ticket___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6ticket___get__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":604
 *     def ticket(self):
 *         """Get the ticket in this endpoint."""
 *         return Ticket(self.endpoint.ticket.ticket)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->endpoint.ticket.ticket); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Ticket), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __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;

  /* "pyarrow/_flight.pyx":602
 * 
 *     @property
 *     def ticket(self):             # <<<<<<<<<<<<<<
 *         """Get the ticket in this endpoint."""
 *         return Ticket(self.endpoint.ticket.ticket)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightEndpoint.ticket.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":607
 * 
 *     @property
 *     def locations(self):             # <<<<<<<<<<<<<<
 *         return [Location.wrap(location)
 *                 for location in self.endpoint.locations]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9locations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9locations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_9locations___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_9locations___get__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self) {
   arrow::flight::Location __pyx_8genexpr1__pyx_v_location;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector< arrow::flight::Location> ::iterator __pyx_t_2;
  std::vector< arrow::flight::Location>  *__pyx_t_3;
   arrow::flight::Location __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":608
 *     @property
 *     def locations(self):
 *         return [Location.wrap(location)             # <<<<<<<<<<<<<<
 *                 for location in self.endpoint.locations]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "pyarrow/_flight.pyx":609
 *     def locations(self):
 *         return [Location.wrap(location)
 *                 for location in self.endpoint.locations]             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    __pyx_t_3 = &__pyx_v_self->endpoint.locations;
    __pyx_t_2 = __pyx_t_3->begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_t_3->end())) break;
      __pyx_t_4 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr1__pyx_v_location = __pyx_t_4;

      /* "pyarrow/_flight.pyx":608
 *     @property
 *     def locations(self):
 *         return [Location.wrap(location)             # <<<<<<<<<<<<<<
 *                 for location in self.endpoint.locations]
 * 
 */
      __pyx_t_5 = ((PyObject *)__pyx_f_7pyarrow_7_flight_8Location_wrap(__pyx_8genexpr1__pyx_v_location)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pyarrow/_flight.pyx":609
 *     def locations(self):
 *         return [Location.wrap(location)
 *                 for location in self.endpoint.locations]             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    }
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":607
 * 
 *     @property
 *     def locations(self):             # <<<<<<<<<<<<<<
 *         return [Location.wrap(location)
 *                 for location in self.endpoint.locations]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightEndpoint.locations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":611
 *                 for location in self.endpoint.locations]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<FlightEndpoint ticket: {!r} locations: {!r}>".format(
 *             self.ticket, self.locations)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_2__repr__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_2__repr__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pyarrow/_flight.pyx":612
 * 
 *     def __repr__(self):
 *         return "<FlightEndpoint ticket: {!r} locations: {!r}>".format(             # <<<<<<<<<<<<<<
 *             self.ticket, self.locations)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightEndpoint_ticket_r_locatio, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pyarrow/_flight.pyx":613
 *     def __repr__(self):
 *         return "<FlightEndpoint ticket: {!r} locations: {!r}>".format(
 *             self.ticket, self.locations)             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, FlightEndpoint other):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ticket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_locations); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 613, __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(0, 612, __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(0, 612, __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(0, 612, __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(0, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":611
 *                 for location in self.endpoint.locations]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<FlightEndpoint ticket: {!r} locations: {!r}>".format(
 *             self.ticket, self.locations)
 */

  /* 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("pyarrow._flight.FlightEndpoint.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":615
 *             self.ticket, self.locations)
 * 
 *     def __eq__(self, FlightEndpoint other):             # <<<<<<<<<<<<<<
 *         return self.endpoint == other.endpoint
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7pyarrow_7_flight_FlightEndpoint, 1, "other", 0))) __PYX_ERR(0, 615, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_4__eq__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self), ((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_4__eq__(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "pyarrow/_flight.pyx":616
 * 
 *     def __eq__(self, FlightEndpoint other):
 *         return self.endpoint == other.endpoint             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->endpoint == __pyx_v_other->endpoint)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":615
 *             self.ticket, self.locations)
 * 
 *     def __eq__(self, FlightEndpoint other):             # <<<<<<<<<<<<<<
 *         return self.endpoint == other.endpoint
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightEndpoint.__eq__", __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("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_14FlightEndpoint_6__reduce_cython__[] = "FlightEndpoint.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightEndpoint.__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("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_14FlightEndpoint_8__setstate_cython__[] = "FlightEndpoint.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14FlightEndpoint_8__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_14FlightEndpoint_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":624
 *         unique_ptr[CSchemaResult] result
 * 
 *     def __init__(self, Schema schema):             # <<<<<<<<<<<<<<
 *         """Create a SchemaResult from a schema.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_12SchemaResult_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12SchemaResult___init__[] = "Create a SchemaResult from a schema.\n\n        Parameters\n        ----------\n        schema: Schema\n            the schema of the data in this flight.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_12SchemaResult___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_12SchemaResult_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_schema,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_schema)) != 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(0, 624, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)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(0, 624, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.SchemaResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_7pyarrow_3lib_Schema, 1, "schema", 0))) __PYX_ERR(0, 624, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12SchemaResult___init__(((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_v_self), __pyx_v_schema);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7pyarrow_7_flight_12SchemaResult___init__(struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema) {
  std::shared_ptr< arrow::Schema>  __pyx_v_c_schema;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":633
 *         """
 *         cdef:
 *             shared_ptr[CSchema] c_schema = pyarrow_unwrap_schema(schema)             # <<<<<<<<<<<<<<
 *         check_status(CreateSchemaResult(c_schema, &self.result))
 * 
 */
  __pyx_v_c_schema = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema(((PyObject *)__pyx_v_schema));

  /* "pyarrow/_flight.pyx":634
 *         cdef:
 *             shared_ptr[CSchema] c_schema = pyarrow_unwrap_schema(schema)
 *         check_status(CreateSchemaResult(c_schema, &self.result))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __pyx_f_7pyarrow_3lib_check_status( arrow::py::flight::CreateSchemaResult(__pyx_v_c_schema, (&__pyx_v_self->result))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 634, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":624
 *         unique_ptr[CSchemaResult] result
 * 
 *     def __init__(self, Schema schema):             # <<<<<<<<<<<<<<
 *         """Create a SchemaResult from a schema.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.SchemaResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":637
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         """The schema of the data in this flight."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_6schema_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_6schema_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12SchemaResult_6schema___get__(((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_6schema___get__(struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self) {
  std::shared_ptr< arrow::Schema>  __pyx_v_schema;
   arrow::ipc::DictionaryMemo __pyx_v_dummy_memo;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":643
 *             CDictionaryMemo dummy_memo
 * 
 *         check_status(self.result.get().GetSchema(&dummy_memo, &schema))             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_schema(schema)
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_3lib_check_status(__pyx_v_self->result.get()->GetSchema((&__pyx_v_dummy_memo), (&__pyx_v_schema))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 643, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":644
 * 
 *         check_status(self.result.get().GetSchema(&dummy_memo, &schema))
 *         return pyarrow_wrap_schema(schema)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":637
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         """The schema of the data in this flight."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.SchemaResult.schema.__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("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12SchemaResult_2__reduce_cython__[] = "SchemaResult.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_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_7pyarrow_7_flight_12SchemaResult_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.SchemaResult.__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("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12SchemaResult_4__setstate_cython__[] = "SchemaResult.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_12SchemaResult_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_7pyarrow_7_flight_12SchemaResult_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12SchemaResult_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":652
 *         unique_ptr[CFlightInfo] info
 * 
 *     def __init__(self, Schema schema, FlightDescriptor descriptor, endpoints,             # <<<<<<<<<<<<<<
 *                  total_records, total_bytes):
 *         """Create a FlightInfo object from a schema, descriptor, and endpoints.
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_10FlightInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10FlightInfo___init__[] = "Create a FlightInfo object from a schema, descriptor, and endpoints.\n\n        Parameters\n        ----------\n        schema : Schema\n            the schema of the data in this flight.\n        descriptor : FlightDescriptor\n            the descriptor for this flight.\n        endpoints : list of FlightEndpoint\n            a list of endpoints where this flight is available.\n        total_records : int\n            the total records in this flight, or -1 if unknown\n        total_bytes : int\n            the total bytes in this flight, or -1 if unknown\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_10FlightInfo___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_10FlightInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  PyObject *__pyx_v_endpoints = 0;
  PyObject *__pyx_v_total_records = 0;
  PyObject *__pyx_v_total_bytes = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_schema,&__pyx_n_s_descriptor,&__pyx_n_s_endpoints,&__pyx_n_s_total_records,&__pyx_n_s_total_bytes,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_schema)) != 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_descriptor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(0, 652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endpoints)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(0, 652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_total_records)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(0, 652, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_total_bytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(0, 652, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 652, __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_schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)values[0]);
    __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)values[1]);
    __pyx_v_endpoints = values[2];
    __pyx_v_total_records = values[3];
    __pyx_v_total_bytes = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 652, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_7pyarrow_3lib_Schema, 1, "schema", 0))) __PYX_ERR(0, 652, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_descriptor), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor, 1, "descriptor", 0))) __PYX_ERR(0, 652, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo___init__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self), __pyx_v_schema, __pyx_v_descriptor, __pyx_v_endpoints, __pyx_v_total_records, __pyx_v_total_bytes);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7pyarrow_7_flight_10FlightInfo___init__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, PyObject *__pyx_v_endpoints, PyObject *__pyx_v_total_records, PyObject *__pyx_v_total_bytes) {
  std::shared_ptr< arrow::Schema>  __pyx_v_c_schema;
  std::vector< arrow::flight::FlightEndpoint>  __pyx_v_c_endpoints;
  PyObject *__pyx_v_endpoint = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int64_t __pyx_t_9;
  int64_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":670
 *         """
 *         cdef:
 *             shared_ptr[CSchema] c_schema = pyarrow_unwrap_schema(schema)             # <<<<<<<<<<<<<<
 *             vector[CFlightEndpoint] c_endpoints
 * 
 */
  __pyx_v_c_schema = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema(((PyObject *)__pyx_v_schema));

  /* "pyarrow/_flight.pyx":673
 *             vector[CFlightEndpoint] c_endpoints
 * 
 *         for endpoint in endpoints:             # <<<<<<<<<<<<<<
 *             if isinstance(endpoint, FlightEndpoint):
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 */
  if (likely(PyList_CheckExact(__pyx_v_endpoints)) || PyTuple_CheckExact(__pyx_v_endpoints)) {
    __pyx_t_1 = __pyx_v_endpoints; __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_endpoints); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 673, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 673, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 673, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 673, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_endpoint, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":674
 * 
 *         for endpoint in endpoints:
 *             if isinstance(endpoint, FlightEndpoint):             # <<<<<<<<<<<<<<
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 *             else:
 */
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_endpoint, __pyx_ptype_7pyarrow_7_flight_FlightEndpoint); 
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (likely(__pyx_t_6)) {

      /* "pyarrow/_flight.pyx":675
 *         for endpoint in endpoints:
 *             if isinstance(endpoint, FlightEndpoint):
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError('Endpoint {} is not instance of'
 */
      try {
        __pyx_v_c_endpoints.push_back(((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_v_endpoint)->endpoint);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 675, __pyx_L1_error)
      }

      /* "pyarrow/_flight.pyx":674
 * 
 *         for endpoint in endpoints:
 *             if isinstance(endpoint, FlightEndpoint):             # <<<<<<<<<<<<<<
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "pyarrow/_flight.pyx":677
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 *             else:
 *                 raise TypeError('Endpoint {} is not instance of'             # <<<<<<<<<<<<<<
 *                                 ' FlightEndpoint'.format(endpoint))
 * 
 */
    /*else*/ {

      /* "pyarrow/_flight.pyx":678
 *             else:
 *                 raise TypeError('Endpoint {} is not instance of'
 *                                 ' FlightEndpoint'.format(endpoint))             # <<<<<<<<<<<<<<
 * 
 *         check_flight_status(CreateFlightInfo(c_schema,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Endpoint_is_not_instance_of_Flig, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_endpoint) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_endpoint);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyarrow/_flight.pyx":677
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 *             else:
 *                 raise TypeError('Endpoint {} is not instance of'             # <<<<<<<<<<<<<<
 *                                 ' FlightEndpoint'.format(endpoint))
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 677, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "pyarrow/_flight.pyx":673
 *             vector[CFlightEndpoint] c_endpoints
 * 
 *         for endpoint in endpoints:             # <<<<<<<<<<<<<<
 *             if isinstance(endpoint, FlightEndpoint):
 *                 c_endpoints.push_back((<FlightEndpoint> endpoint).endpoint)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":683
 *                                              descriptor.descriptor,
 *                                              c_endpoints,
 *                                              total_records,             # <<<<<<<<<<<<<<
 *                                              total_bytes, &self.info))
 * 
 */
  __pyx_t_9 = __Pyx_PyInt_As_int64_t(__pyx_v_total_records); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 683, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":684
 *                                              c_endpoints,
 *                                              total_records,
 *                                              total_bytes, &self.info))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_total_bytes); if (unlikely((__pyx_t_10 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":680
 *                                 ' FlightEndpoint'.format(endpoint))
 * 
 *         check_flight_status(CreateFlightInfo(c_schema,             # <<<<<<<<<<<<<<
 *                                              descriptor.descriptor,
 *                                              c_endpoints,
 */
  __pyx_t_11 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::py::flight::CreateFlightInfo(__pyx_v_c_schema, __pyx_v_descriptor->descriptor, __pyx_v_c_endpoints, __pyx_t_9, __pyx_t_10, (&__pyx_v_self->info))); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 680, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":652
 *         unique_ptr[CFlightInfo] info
 * 
 *     def __init__(self, Schema schema, FlightDescriptor descriptor, endpoints,             # <<<<<<<<<<<<<<
 *                  total_records, total_bytes):
 *         """Create a FlightInfo object from a schema, descriptor, and endpoints.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_endpoint);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":687
 * 
 *     @property
 *     def total_records(self):             # <<<<<<<<<<<<<<
 *         """The total record count of this flight, or -1 if unknown."""
 *         return self.info.get().total_records()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_13total_records_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_13total_records_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_13total_records___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_13total_records___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":689
 *     def total_records(self):
 *         """The total record count of this flight, or -1 if unknown."""
 *         return self.info.get().total_records()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->info.get()->total_records()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":687
 * 
 *     @property
 *     def total_records(self):             # <<<<<<<<<<<<<<
 *         """The total record count of this flight, or -1 if unknown."""
 *         return self.info.get().total_records()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.total_records.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":692
 * 
 *     @property
 *     def total_bytes(self):             # <<<<<<<<<<<<<<
 *         """The size in bytes of the data in this flight, or -1 if unknown."""
 *         return self.info.get().total_bytes()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_11total_bytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_11total_bytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_11total_bytes___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_11total_bytes___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":694
 *     def total_bytes(self):
 *         """The size in bytes of the data in this flight, or -1 if unknown."""
 *         return self.info.get().total_bytes()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->info.get()->total_bytes()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":692
 * 
 *     @property
 *     def total_bytes(self):             # <<<<<<<<<<<<<<
 *         """The size in bytes of the data in this flight, or -1 if unknown."""
 *         return self.info.get().total_bytes()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.total_bytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":697
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         """The schema of the data in this flight."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_6schema_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_6schema_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_6schema___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_6schema___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  std::shared_ptr< arrow::Schema>  __pyx_v_schema;
   arrow::ipc::DictionaryMemo __pyx_v_dummy_memo;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":703
 *             CDictionaryMemo dummy_memo
 * 
 *         check_flight_status(self.info.get().GetSchema(&dummy_memo, &schema))             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_schema(schema)
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->info.get()->GetSchema((&__pyx_v_dummy_memo), (&__pyx_v_schema))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 703, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":704
 * 
 *         check_flight_status(self.info.get().GetSchema(&dummy_memo, &schema))
 *         return pyarrow_wrap_schema(schema)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":697
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         """The schema of the data in this flight."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.schema.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":707
 * 
 *     @property
 *     def descriptor(self):             # <<<<<<<<<<<<<<
 *         """The descriptor of the data in this flight."""
 *         cdef FlightDescriptor result = \
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_10descriptor_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_10descriptor_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_10descriptor___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_10descriptor___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":710
 *         """The descriptor of the data in this flight."""
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *         result.descriptor = self.info.get().descriptor()
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":711
 *         cdef FlightDescriptor result = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor = self.info.get().descriptor()             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->descriptor = __pyx_v_self->info.get()->descriptor();

  /* "pyarrow/_flight.pyx":712
 *             FlightDescriptor.__new__(FlightDescriptor)
 *         result.descriptor = self.info.get().descriptor()
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":707
 * 
 *     @property
 *     def descriptor(self):             # <<<<<<<<<<<<<<
 *         """The descriptor of the data in this flight."""
 *         cdef FlightDescriptor result = \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.descriptor.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":715
 * 
 *     @property
 *     def endpoints(self):             # <<<<<<<<<<<<<<
 *         """The endpoints where this flight is available."""
 *         # TODO: get Cython to iterate over reference directly
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_9endpoints_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_9endpoints_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_9endpoints___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_9endpoints___get__(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  std::vector< arrow::flight::FlightEndpoint>  __pyx_v_endpoints;
  struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *__pyx_v_py_endpoint = 0;
  PyObject *__pyx_v_result = NULL;
   arrow::flight::FlightEndpoint __pyx_v_endpoint;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector< arrow::flight::FlightEndpoint> ::iterator __pyx_t_2;
   arrow::flight::FlightEndpoint __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":719
 *         # TODO: get Cython to iterate over reference directly
 *         cdef:
 *             vector[CFlightEndpoint] endpoints = self.info.get().endpoints()             # <<<<<<<<<<<<<<
 *             FlightEndpoint py_endpoint
 * 
 */
  __pyx_v_endpoints = __pyx_v_self->info.get()->endpoints();

  /* "pyarrow/_flight.pyx":722
 *             FlightEndpoint py_endpoint
 * 
 *         result = []             # <<<<<<<<<<<<<<
 *         for endpoint in endpoints:
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":723
 * 
 *         result = []
 *         for endpoint in endpoints:             # <<<<<<<<<<<<<<
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)
 *             py_endpoint.endpoint = endpoint
 */
  __pyx_t_2 = __pyx_v_endpoints.begin();
  for (;;) {
    if (!(__pyx_t_2 != __pyx_v_endpoints.end())) break;
    __pyx_t_3 = *__pyx_t_2;
    ++__pyx_t_2;
    __pyx_v_endpoint = __pyx_t_3;

    /* "pyarrow/_flight.pyx":724
 *         result = []
 *         for endpoint in endpoints:
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)             # <<<<<<<<<<<<<<
 *             py_endpoint.endpoint = endpoint
 *             result.append(py_endpoint)
 */
    __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightEndpoint(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightEndpoint), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_XDECREF_SET(__pyx_v_py_endpoint, ((struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":725
 *         for endpoint in endpoints:
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)
 *             py_endpoint.endpoint = endpoint             # <<<<<<<<<<<<<<
 *             result.append(py_endpoint)
 *         return result
 */
    __pyx_v_py_endpoint->endpoint = __pyx_v_endpoint;

    /* "pyarrow/_flight.pyx":726
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)
 *             py_endpoint.endpoint = endpoint
 *             result.append(py_endpoint)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, ((PyObject *)__pyx_v_py_endpoint)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 726, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":723
 * 
 *         result = []
 *         for endpoint in endpoints:             # <<<<<<<<<<<<<<
 *             py_endpoint = FlightEndpoint.__new__(FlightEndpoint)
 *             py_endpoint.endpoint = endpoint
 */
  }

  /* "pyarrow/_flight.pyx":727
 *             py_endpoint.endpoint = endpoint
 *             result.append(py_endpoint)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def serialize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":715
 * 
 *     @property
 *     def endpoints(self):             # <<<<<<<<<<<<<<
 *         """The endpoints where this flight is available."""
 *         # TODO: get Cython to iterate over reference directly
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.endpoints.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_endpoint);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":729
 *         return result
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_3serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10FlightInfo_2serialize[] = "FlightInfo.serialize(self)\nGet the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_3serialize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_2serialize(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_2serialize(struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  std::string __pyx_v_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("serialize", 0);

  /* "pyarrow/_flight.pyx":737
 *         """
 *         cdef c_string out
 *         check_flight_status(self.info.get().SerializeToString(&out))             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->info.get()->SerializeToString((&__pyx_v_out))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 737, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":738
 *         cdef c_string out
 *         check_flight_status(self.info.get().SerializeToString(&out))
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":729
 *         return result
 * 
 *     def serialize(self):             # <<<<<<<<<<<<<<
 *         """Get the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.serialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":741
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_5deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10FlightInfo_4deserialize[] = "FlightInfo.deserialize(type cls, serialized)\nParse the wire-format representation of this type.\n\n        Useful when interoperating with non-Flight systems (e.g. REST\n        services) that may want to return Flight types.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_5deserialize(PyObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deserialize (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_4deserialize(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_serialized));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_4deserialize(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_serialized) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_info = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("deserialize", 0);

  /* "pyarrow/_flight.pyx":748
 * 
 *         """
 *         cdef FlightInfo info = FlightInfo.__new__(FlightInfo)             # <<<<<<<<<<<<<<
 *         check_flight_status(CFlightInfo.Deserialize(
 *             tobytes(serialized), &info.info))
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightInfo(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightInfo), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_info = ((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":750
 *         cdef FlightInfo info = FlightInfo.__new__(FlightInfo)
 *         check_flight_status(CFlightInfo.Deserialize(
 *             tobytes(serialized), &info.info))             # <<<<<<<<<<<<<<
 *         return info
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_serialized) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_serialized);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":749
 *         """
 *         cdef FlightInfo info = FlightInfo.__new__(FlightInfo)
 *         check_flight_status(CFlightInfo.Deserialize(             # <<<<<<<<<<<<<<
 *             tobytes(serialized), &info.info))
 *         return info
 */
  __pyx_t_5 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::FlightInfo::Deserialize(__pyx_t_4, (&__pyx_v_info->info))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 749, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":751
 *         check_flight_status(CFlightInfo.Deserialize(
 *             tobytes(serialized), &info.info))
 *         return info             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_info));
  __pyx_r = ((PyObject *)__pyx_v_info);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":741
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.deserialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_info);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10FlightInfo_6__reduce_cython__[] = "FlightInfo.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_6__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightInfo.__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("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10FlightInfo_8__setstate_cython__[] = "FlightInfo.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_10FlightInfo_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10FlightInfo_8__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_10FlightInfo_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":760
 * 
 *     @property
 *     def data(self):             # <<<<<<<<<<<<<<
 *         if self.chunk.data == NULL:
 *             return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_4data_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_4data_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_4data___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_4data___get__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":761
 *     @property
 *     def data(self):
 *         if self.chunk.data == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_batch(self.chunk.data)
 */
  __pyx_t_1 = ((__pyx_v_self->chunk.data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":762
 *     def data(self):
 *         if self.chunk.data == NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_batch(self.chunk.data)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":761
 *     @property
 *     def data(self):
 *         if self.chunk.data == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_batch(self.chunk.data)
 */
  }

  /* "pyarrow/_flight.pyx":763
 *         if self.chunk.data == NULL:
 *             return None
 *         return pyarrow_wrap_batch(self.chunk.data)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_batch(__pyx_v_self->chunk.data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":760
 * 
 *     @property
 *     def data(self):             # <<<<<<<<<<<<<<
 *         if self.chunk.data == NULL:
 *             return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamChunk.data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":766
 * 
 *     @property
 *     def app_metadata(self):             # <<<<<<<<<<<<<<
 *         if self.chunk.app_metadata == NULL:
 *             return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata___get__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":767
 *     @property
 *     def app_metadata(self):
 *         if self.chunk.app_metadata == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)
 */
  __pyx_t_1 = ((__pyx_v_self->chunk.app_metadata == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":768
 *     def app_metadata(self):
 *         if self.chunk.app_metadata == NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":767
 *     @property
 *     def app_metadata(self):
 *         if self.chunk.app_metadata == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)
 */
  }

  /* "pyarrow/_flight.pyx":769
 *         if self.chunk.app_metadata == NULL:
 *             return None
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(__pyx_v_self->chunk.app_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":766
 * 
 *     @property
 *     def app_metadata(self):             # <<<<<<<<<<<<<<
 *         if self.chunk.app_metadata == NULL:
 *             return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamChunk.app_metadata.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":771
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter((self.data, self.app_metadata))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17FlightStreamChunk___iter__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk___iter__(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "pyarrow/_flight.pyx":772
 * 
 *     def __iter__(self):
 *         return iter((self.data, self.app_metadata))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_app_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __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 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __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;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":771
 *         return pyarrow_wrap_buffer(self.chunk.app_metadata)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter((self.data, self.app_metadata))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamChunk.__iter__", __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("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightStreamChunk_2__reduce_cython__[] = "FlightStreamChunk.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_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_7pyarrow_7_flight_17FlightStreamChunk_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamChunk.__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("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17FlightStreamChunk_4__setstate_cython__[] = "FlightStreamChunk.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_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_7pyarrow_7_flight_17FlightStreamChunk_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17FlightStreamChunk_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":785
 * 
 *     cdef readonly:
 *         Schema schema             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema___get__(((struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema___get__(struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->schema));
  __pyx_r = ((PyObject *)__pyx_v_self->schema);
  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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_26_MetadataRecordBatchReader___reduce_cython__[] = "_MetadataRecordBatchReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_1__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_7pyarrow_7_flight_26_MetadataRecordBatchReader___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight._MetadataRecordBatchReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_26_MetadataRecordBatchReader_2__setstate_cython__[] = "_MetadataRecordBatchReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_3__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_7pyarrow_7_flight_26_MetadataRecordBatchReader_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_26_MetadataRecordBatchReader_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight._MetadataRecordBatchReader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7pyarrow_7_flight_25MetadataRecordBatchReader_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pyarrow/_flight.pyx":792
 *     """A reader for Flight streams."""
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             yield self.read_chunk()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_1__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader___iter__(((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader___iter__(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct____iter__(__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 792, __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_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pyarrow_7_flight_25MetadataRecordBatchReader_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_MetadataRecordBatchReader___iter, __pyx_n_s_pyarrow__flight); if (unlikely(!gen)) __PYX_ERR(0, 792, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.MetadataRecordBatchReader.__iter__", __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_7pyarrow_7_flight_25MetadataRecordBatchReader_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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(0, 792, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":793
 * 
 *     def __iter__(self):
 *         while True:             # <<<<<<<<<<<<<<
 *             yield self.read_chunk()
 * 
 */
  while (1) {

    /* "pyarrow/_flight.pyx":794
 *     def __iter__(self):
 *         while True:
 *             yield self.read_chunk()             # <<<<<<<<<<<<<<
 * 
 *     def read_all(self):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_read_chunk); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 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_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __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;
    __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:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 794, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pyarrow/_flight.pyx":792
 *     """A reader for Flight streams."""
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             yield self.read_chunk()
 */

  /* 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_3);
  __Pyx_AddTraceback("__iter__", __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;
}

/* "pyarrow/_flight.pyx":796
 *             yield self.read_chunk()
 * 
 *     def read_all(self):             # <<<<<<<<<<<<<<
 *         """Read the entire contents of the stream as a Table."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_4read_all(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_3read_all[] = "MetadataRecordBatchReader.read_all(self)\nRead the entire contents of the stream as a Table.";
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_4read_all(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_all (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_3read_all(((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_3read_all(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self) {
  std::shared_ptr< arrow::Table>  __pyx_v_c_table;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("read_all", 0);

  /* "pyarrow/_flight.pyx":800
 *         cdef:
 *             shared_ptr[CTable] c_table
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().ReadAll(&c_table))
 *         return pyarrow_wrap_table(c_table)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":801
 *             shared_ptr[CTable] c_table
 *         with nogil:
 *             check_flight_status(self.reader.get().ReadAll(&c_table))             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_table(c_table)
 * 
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->__pyx_base.reader.get()->ReadAll((&__pyx_v_c_table))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 801, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":800
 *         cdef:
 *             shared_ptr[CTable] c_table
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().ReadAll(&c_table))
 *         return pyarrow_wrap_table(c_table)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":802
 *         with nogil:
 *             check_flight_status(self.reader.get().ReadAll(&c_table))
 *         return pyarrow_wrap_table(c_table)             # <<<<<<<<<<<<<<
 * 
 *     def read_chunk(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_table(__pyx_v_c_table); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":796
 *             yield self.read_chunk()
 * 
 *     def read_all(self):             # <<<<<<<<<<<<<<
 *         """Read the entire contents of the stream as a Table."""
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.MetadataRecordBatchReader.read_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":804
 *         return pyarrow_wrap_table(c_table)
 * 
 *     def read_chunk(self):             # <<<<<<<<<<<<<<
 *         """Read the next RecordBatch along with any metadata.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_6read_chunk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_5read_chunk[] = "MetadataRecordBatchReader.read_chunk(self)\nRead the next RecordBatch along with any metadata.\n\n        Returns\n        -------\n        data : RecordBatch\n            The next RecordBatch in the stream.\n        app_metadata : Buffer or None\n            Application-specific metadata for the batch as defined by\n            Flight.\n\n        Raises\n        ------\n        StopIteration\n            when the stream is finished\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_6read_chunk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_chunk (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_5read_chunk(((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_5read_chunk(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self) {
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *__pyx_v_chunk = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("read_chunk", 0);

  /* "pyarrow/_flight.pyx":821
 *         """
 *         cdef:
 *             FlightStreamChunk chunk = FlightStreamChunk()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightStreamChunk)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_chunk = ((struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":823
 *             FlightStreamChunk chunk = FlightStreamChunk()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().Next(&chunk.chunk))
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":824
 * 
 *         with nogil:
 *             check_flight_status(self.reader.get().Next(&chunk.chunk))             # <<<<<<<<<<<<<<
 * 
 *         if chunk.chunk.data == NULL:
 */
        __pyx_t_2 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->__pyx_base.reader.get()->Next((&__pyx_v_chunk->chunk))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 824, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":823
 *             FlightStreamChunk chunk = FlightStreamChunk()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().Next(&chunk.chunk))
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":826
 *             check_flight_status(self.reader.get().Next(&chunk.chunk))
 * 
 *         if chunk.chunk.data == NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  __pyx_t_3 = ((__pyx_v_chunk->chunk.data == NULL) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyarrow/_flight.pyx":827
 * 
 *         if chunk.chunk.data == NULL:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         return chunk
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    __PYX_ERR(0, 827, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":826
 *             check_flight_status(self.reader.get().Next(&chunk.chunk))
 * 
 *         if chunk.chunk.data == NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  }

  /* "pyarrow/_flight.pyx":829
 *             raise StopIteration
 * 
 *         return chunk             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_chunk));
  __pyx_r = ((PyObject *)__pyx_v_chunk);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":804
 *         return pyarrow_wrap_table(c_table)
 * 
 *     def read_chunk(self):             # <<<<<<<<<<<<<<
 *         """Read the next RecordBatch along with any metadata.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.MetadataRecordBatchReader.read_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_chunk);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_8__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_7__reduce_cython__[] = "MetadataRecordBatchReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_8__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_7pyarrow_7_flight_25MetadataRecordBatchReader_7__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_7__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.MetadataRecordBatchReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_10__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_9__setstate_cython__[] = "MetadataRecordBatchReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_10__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_7pyarrow_7_flight_25MetadataRecordBatchReader_9__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_25MetadataRecordBatchReader_9__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":835
 *     """A reader that can also be canceled."""
 * 
 *     def cancel(self):             # <<<<<<<<<<<<<<
 *         """Cancel the read operation."""
 *         with nogil:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_1cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_cancel[] = "FlightStreamReader.cancel(self)\nCancel the read operation.";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_1cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancel (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_18FlightStreamReader_cancel(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_cancel(struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cancel", 0);

  /* "pyarrow/_flight.pyx":837
 *     def cancel(self):
 *         """Cancel the read operation."""
 *         with nogil:             # <<<<<<<<<<<<<<
 *             (<CFlightStreamReader*> self.reader.get()).Cancel()
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":838
 *         """Cancel the read operation."""
 *         with nogil:
 *             (<CFlightStreamReader*> self.reader.get()).Cancel()             # <<<<<<<<<<<<<<
 * 
 * 
 */
        (( arrow::flight::FlightStreamReader *)__pyx_v_self->__pyx_base.__pyx_base.reader.get())->Cancel();
      }

      /* "pyarrow/_flight.pyx":837
 *     def cancel(self):
 *         """Cancel the read operation."""
 *         with nogil:             # <<<<<<<<<<<<<<
 *             (<CFlightStreamReader*> self.reader.get()).Cancel()
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":835
 *     """A reader that can also be canceled."""
 * 
 *     def cancel(self):             # <<<<<<<<<<<<<<
 *         """Cancel the read operation."""
 *         with nogil:
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_2__reduce_cython__[] = "FlightStreamReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_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_7pyarrow_7_flight_18FlightStreamReader_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_4__setstate_cython__[] = "FlightStreamReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_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_7pyarrow_7_flight_18FlightStreamReader_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":844
 *     """A RecordBatchWriter that also allows writing application metadata."""
 * 
 *     def write_with_metadata(self, RecordBatch batch, buf):             # <<<<<<<<<<<<<<
 *         """Write a RecordBatch along with Flight metadata.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_1write_with_metadata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_write_with_metadata[] = "FlightStreamWriter.write_with_metadata(self, RecordBatch batch, buf)\nWrite a RecordBatch along with Flight metadata.\n\n        Parameters\n        ----------\n        batch : RecordBatch\n            The next RecordBatch in the stream.\n        buf : Buffer\n            Application-specific metadata for the batch as defined by\n            Flight.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_1write_with_metadata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_3lib_RecordBatch *__pyx_v_batch = 0;
  PyObject *__pyx_v_buf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_with_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_batch,&__pyx_n_s_buf,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_batch)) != 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_buf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("write_with_metadata", 1, 2, 2, 1); __PYX_ERR(0, 844, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_with_metadata") < 0)) __PYX_ERR(0, 844, __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_batch = ((struct __pyx_obj_7pyarrow_3lib_RecordBatch *)values[0]);
    __pyx_v_buf = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_with_metadata", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 844, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamWriter.write_with_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_batch), __pyx_ptype_7pyarrow_3lib_RecordBatch, 1, "batch", 0))) __PYX_ERR(0, 844, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_write_with_metadata(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *)__pyx_v_self), __pyx_v_batch, __pyx_v_buf);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_write_with_metadata(struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self, struct __pyx_obj_7pyarrow_3lib_RecordBatch *__pyx_v_batch, PyObject *__pyx_v_buf) {
  std::shared_ptr< arrow::Buffer>  __pyx_v_c_buf;
  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;
  __Pyx_RefNannySetupContext("write_with_metadata", 0);

  /* "pyarrow/_flight.pyx":855
 *             Flight.
 *         """
 *         cdef shared_ptr[CBuffer] c_buf = pyarrow_unwrap_buffer(as_buffer(buf))             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_as_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_buf) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_buf);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_c_buf = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":856
 *         """
 *         cdef shared_ptr[CBuffer] c_buf = pyarrow_unwrap_buffer(as_buffer(buf))
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 (<CFlightStreamWriter*> self.writer.get())
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":857
 *         cdef shared_ptr[CBuffer] c_buf = pyarrow_unwrap_buffer(as_buffer(buf))
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 (<CFlightStreamWriter*> self.writer.get())
 *                 .WriteWithMetadata(deref(batch.batch),
 */
        __pyx_t_4 = __pyx_f_7pyarrow_7_flight_check_flight_status((( arrow::flight::FlightStreamWriter *)__pyx_v_self->__pyx_base.writer.get())->WriteWithMetadata((*__pyx_v_batch->batch), __pyx_v_c_buf)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 857, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":856
 *         """
 *         cdef shared_ptr[CBuffer] c_buf = pyarrow_unwrap_buffer(as_buffer(buf))
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 (<CFlightStreamWriter*> self.writer.get())
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":844
 *     """A RecordBatchWriter that also allows writing application metadata."""
 * 
 *     def write_with_metadata(self, RecordBatch batch, buf):             # <<<<<<<<<<<<<<
 *         """Write a RecordBatch along with Flight metadata.
 * 
 */

  /* 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("pyarrow._flight.FlightStreamWriter.write_with_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":862
 *                                    c_buf))
 * 
 *     def done_writing(self):             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_3done_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_2done_writing[] = "FlightStreamWriter.done_writing(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_3done_writing(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("done_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_2done_writing(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_2done_writing(struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("done_writing", 0);

  /* "pyarrow/_flight.pyx":863
 * 
 *     def done_writing(self):
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 (<CFlightStreamWriter*> self.writer.get())
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":864
 *     def done_writing(self):
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 (<CFlightStreamWriter*> self.writer.get())
 *                 .DoneWriting())
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status((( arrow::flight::FlightStreamWriter *)__pyx_v_self->__pyx_base.writer.get())->DoneWriting()); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 864, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":863
 * 
 *     def done_writing(self):
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 (<CFlightStreamWriter*> self.writer.get())
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":862
 *                                    c_buf))
 * 
 *     def done_writing(self):             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamWriter.done_writing", __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("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_4__reduce_cython__[] = "FlightStreamWriter.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_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_7pyarrow_7_flight_18FlightStreamWriter_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightStreamWriter.__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("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_6__setstate_cython__[] = "FlightStreamWriter.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_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_7pyarrow_7_flight_18FlightStreamWriter_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_18FlightStreamWriter_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":875
 *         unique_ptr[CFlightMetadataReader] reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         """Read the next metadata message."""
 *         cdef shared_ptr[CBuffer] buf
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_read[] = "FlightMetadataReader.read(self)\nRead the next metadata message.";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_read(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_read(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self) {
  std::shared_ptr< arrow::Buffer>  __pyx_v_buf;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("read", 0);

  /* "pyarrow/_flight.pyx":878
 *         """Read the next metadata message."""
 *         cdef shared_ptr[CBuffer] buf
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))
 *         if buf == NULL:
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":879
 *         cdef shared_ptr[CBuffer] buf
 *         with nogil:
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))             # <<<<<<<<<<<<<<
 *         if buf == NULL:
 *             return None
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->reader.get()->ReadMetadata((&__pyx_v_buf))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 879, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":878
 *         """Read the next metadata message."""
 *         cdef shared_ptr[CBuffer] buf
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))
 *         if buf == NULL:
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":880
 *         with nogil:
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))
 *         if buf == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_buffer(buf)
 */
  __pyx_t_2 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":881
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))
 *         if buf == NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         return pyarrow_wrap_buffer(buf)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":880
 *         with nogil:
 *             check_flight_status(self.reader.get().ReadMetadata(&buf))
 *         if buf == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         return pyarrow_wrap_buffer(buf)
 */
  }

  /* "pyarrow/_flight.pyx":882
 *         if buf == NULL:
 *             return None
 *         return pyarrow_wrap_buffer(buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(__pyx_v_buf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":875
 *         unique_ptr[CFlightMetadataReader] reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         """Read the next metadata message."""
 *         cdef shared_ptr[CBuffer] buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.FlightMetadataReader.read", __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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_2__reduce_cython__[] = "FlightMetadataReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_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_7pyarrow_7_flight_20FlightMetadataReader_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightMetadataReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_4__setstate_cython__[] = "FlightMetadataReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_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_7pyarrow_7_flight_20FlightMetadataReader_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":891
 *         unique_ptr[CFlightMetadataWriter] writer
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         """Write the next metadata message.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_write[] = "FlightMetadataWriter.write(self, message)\nWrite the next metadata message.\n\n        Parameters\n        ----------\n        message : Buffer\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_write(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)__pyx_v_self), ((PyObject *)__pyx_v_message));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_write(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self, PyObject *__pyx_v_message) {
  std::shared_ptr< arrow::Buffer>  __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_t_4;
  __Pyx_RefNannySetupContext("write", 0);

  /* "pyarrow/_flight.pyx":899
 *         """
 *         cdef shared_ptr[CBuffer] buf = \
 *             pyarrow_unwrap_buffer(as_buffer(message))             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(self.writer.get().WriteMetadata(deref(buf)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_as_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_message);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_buf = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":900
 *         cdef shared_ptr[CBuffer] buf = \
 *             pyarrow_unwrap_buffer(as_buffer(message))
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.writer.get().WriteMetadata(deref(buf)))
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":901
 *             pyarrow_unwrap_buffer(as_buffer(message))
 *         with nogil:
 *             check_flight_status(self.writer.get().WriteMetadata(deref(buf)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_4 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->writer.get()->WriteMetadata((*__pyx_v_buf))); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 901, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":900
 *         cdef shared_ptr[CBuffer] buf = \
 *             pyarrow_unwrap_buffer(as_buffer(message))
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.writer.get().WriteMetadata(deref(buf)))
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":891
 *         unique_ptr[CFlightMetadataWriter] writer
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         """Write the next metadata message.
 * 
 */

  /* 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("pyarrow._flight.FlightMetadataWriter.write", __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("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_2__reduce_cython__[] = "FlightMetadataWriter.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_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_7pyarrow_7_flight_20FlightMetadataWriter_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightMetadataWriter.__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("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_4__setstate_cython__[] = "FlightMetadataWriter.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_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_7pyarrow_7_flight_20FlightMetadataWriter_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_20FlightMetadataWriter_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":924
 *         unique_ptr[CFlightClient] client
 * 
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *                  middleware=None):
 *         if isinstance(location, six.string_types):
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_12FlightClient_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_12FlightClient_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_location = 0;
  PyObject *__pyx_v_tls_root_certs = 0;
  PyObject *__pyx_v_override_hostname = 0;
  PyObject *__pyx_v_middleware = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_location,&__pyx_n_s_tls_root_certs,&__pyx_n_s_override_hostname,&__pyx_n_s_middleware,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "pyarrow/_flight.pyx":925
 * 
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,
 *                  middleware=None):             # <<<<<<<<<<<<<<
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 */
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_location)) != 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_tls_root_certs);
          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_override_hostname);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_middleware);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_location = values[0];
    __pyx_v_tls_root_certs = values[1];
    __pyx_v_override_hostname = values[2];
    __pyx_v_middleware = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient___init__(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_location, __pyx_v_tls_root_certs, __pyx_v_override_hostname, __pyx_v_middleware);

  /* "pyarrow/_flight.pyx":924
 *         unique_ptr[CFlightClient] client
 * 
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *                  middleware=None):
 *         if isinstance(location, six.string_types):
 */

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

static int __pyx_pf_7pyarrow_7_flight_12FlightClient___init__(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_port = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_location);

  /* "pyarrow/_flight.pyx":926
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,
 *                  middleware=None):
 *         if isinstance(location, six.string_types):             # <<<<<<<<<<<<<<
 *             location = Location(location)
 *         elif isinstance(location, tuple):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_location, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":927
 *                  middleware=None):
 *         if isinstance(location, six.string_types):
 *             location = Location(location)             # <<<<<<<<<<<<<<
 *         elif isinstance(location, tuple):
 *             host, port = location
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_v_location); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_location, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":926
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,
 *                  middleware=None):
 *         if isinstance(location, six.string_types):             # <<<<<<<<<<<<<<
 *             location = Location(location)
 *         elif isinstance(location, tuple):
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":928
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 *         elif isinstance(location, tuple):             # <<<<<<<<<<<<<<
 *             host, port = location
 *             if tls_root_certs:
 */
  __pyx_t_4 = PyTuple_Check(__pyx_v_location); 
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":929
 *             location = Location(location)
 *         elif isinstance(location, tuple):
 *             host, port = location             # <<<<<<<<<<<<<<
 *             if tls_root_certs:
 *                 location = Location.for_grpc_tls(host, port)
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_location))) || (PyList_CheckExact(__pyx_v_location))) {
      PyObject* sequence = __pyx_v_location;
      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, 929, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_v_location); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 929, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 929, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_host = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_port = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":930
 *         elif isinstance(location, tuple):
 *             host, port = location
 *             if tls_root_certs:             # <<<<<<<<<<<<<<
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tls_root_certs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 930, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "pyarrow/_flight.pyx":931
 *             host, port = location
 *             if tls_root_certs:
 *                 location = Location.for_grpc_tls(host, port)             # <<<<<<<<<<<<<<
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_n_s_for_grpc_tls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      __pyx_t_7 = 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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __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_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 931, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_port);
        __Pyx_GIVEREF(__pyx_v_port);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_port);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_location, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":930
 *         elif isinstance(location, tuple):
 *             host, port = location
 *             if tls_root_certs:             # <<<<<<<<<<<<<<
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 */
      goto __pyx_L6;
    }

    /* "pyarrow/_flight.pyx":933
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)             # <<<<<<<<<<<<<<
 *         elif not isinstance(location, Location):
 *             raise TypeError('`location` argument must be a string, tuple or a '
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_n_s_for_grpc_tcp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 933, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_8, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 933, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_port);
        __Pyx_GIVEREF(__pyx_v_port);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_port);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __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_SET(__pyx_v_location, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "pyarrow/_flight.pyx":928
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 *         elif isinstance(location, tuple):             # <<<<<<<<<<<<<<
 *             host, port = location
 *             if tls_root_certs:
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":934
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location); 
  __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "pyarrow/_flight.pyx":935
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):
 *             raise TypeError('`location` argument must be a string, tuple or a '             # <<<<<<<<<<<<<<
 *                             'Location instance')
 *         self.init(location, tls_root_certs, override_hostname, middleware)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 935, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":934
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 */
  }
  __pyx_L3:;

  /* "pyarrow/_flight.pyx":937
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 *         self.init(location, tls_root_certs, override_hostname, middleware)             # <<<<<<<<<<<<<<
 * 
 *     cdef init(self, Location location, tls_root_certs, override_hostname,
 */
  if (!(likely(((__pyx_v_location) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location))))) __PYX_ERR(0, 937, __pyx_L1_error)
  __pyx_t_1 = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightClient *)__pyx_v_self->__pyx_vtab)->init(__pyx_v_self, ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_location), __pyx_v_tls_root_certs, __pyx_v_override_hostname, __pyx_v_middleware); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":924
 *         unique_ptr[CFlightClient] client
 * 
 *     def __init__(self, location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *                  middleware=None):
 *         if isinstance(location, six.string_types):
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_port);
  __Pyx_XDECREF(__pyx_v_location);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":939
 *         self.init(location, tls_root_certs, override_hostname, middleware)
 * 
 *     cdef init(self, Location location, tls_root_certs, override_hostname,             # <<<<<<<<<<<<<<
 *               middleware):
 *         cdef:
 */

static PyObject *__pyx_f_7pyarrow_7_flight_12FlightClient_init(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware) {
  CYTHON_UNUSED int __pyx_v_c_port;
   arrow::flight::Location __pyx_v_c_location;
   arrow::flight::FlightClientOptions __pyx_v_c_options;
  std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_middleware_start_call>  __pyx_v_start_call;
  PyObject *__pyx_v_factory = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
   arrow::flight::Location __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  std::string __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  std::shared_ptr< arrow::py::flight::PyClientMiddlewareFactory>  __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("init", 0);

  /* "pyarrow/_flight.pyx":942
 *               middleware):
 *         cdef:
 *             int c_port = 0             # <<<<<<<<<<<<<<
 *             CLocation c_location = Location.unwrap(location)
 *             CFlightClientOptions c_options
 */
  __pyx_v_c_port = 0;

  /* "pyarrow/_flight.pyx":943
 *         cdef:
 *             int c_port = 0
 *             CLocation c_location = Location.unwrap(location)             # <<<<<<<<<<<<<<
 *             CFlightClientOptions c_options
 *             function[cb_client_middleware_start_call] start_call = \
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_8Location_unwrap(((PyObject *)__pyx_v_location)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L1_error)
  __pyx_v_c_location = __pyx_t_1;

  /* "pyarrow/_flight.pyx":946
 *             CFlightClientOptions c_options
 *             function[cb_client_middleware_start_call] start_call = \
 *                 &_client_middleware_start_call             # <<<<<<<<<<<<<<
 * 
 *         if tls_root_certs:
 */
  __pyx_v_start_call = (&__pyx_f_7pyarrow_7_flight__client_middleware_start_call);

  /* "pyarrow/_flight.pyx":948
 *                 &_client_middleware_start_call
 * 
 *         if tls_root_certs:             # <<<<<<<<<<<<<<
 *             c_options.tls_root_certs = tobytes(tls_root_certs)
 *         if override_hostname:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tls_root_certs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 948, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":949
 * 
 *         if tls_root_certs:
 *             c_options.tls_root_certs = tobytes(tls_root_certs)             # <<<<<<<<<<<<<<
 *         if override_hostname:
 *             c_options.override_hostname = tobytes(override_hostname)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_tls_root_certs) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_tls_root_certs);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_c_options.tls_root_certs = __pyx_t_6;

    /* "pyarrow/_flight.pyx":948
 *                 &_client_middleware_start_call
 * 
 *         if tls_root_certs:             # <<<<<<<<<<<<<<
 *             c_options.tls_root_certs = tobytes(tls_root_certs)
 *         if override_hostname:
 */
  }

  /* "pyarrow/_flight.pyx":950
 *         if tls_root_certs:
 *             c_options.tls_root_certs = tobytes(tls_root_certs)
 *         if override_hostname:             # <<<<<<<<<<<<<<
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_override_hostname); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":951
 *             c_options.tls_root_certs = tobytes(tls_root_certs)
 *         if override_hostname:
 *             c_options.override_hostname = tobytes(override_hostname)             # <<<<<<<<<<<<<<
 *         if middleware:
 *             for factory in middleware:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_override_hostname) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_override_hostname);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_c_options.override_hostname = __pyx_t_6;

    /* "pyarrow/_flight.pyx":950
 *         if tls_root_certs:
 *             c_options.tls_root_certs = tobytes(tls_root_certs)
 *         if override_hostname:             # <<<<<<<<<<<<<<
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:
 */
  }

  /* "pyarrow/_flight.pyx":952
 *         if override_hostname:
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:             # <<<<<<<<<<<<<<
 *             for factory in middleware:
 *                 c_options.middleware.push_back(
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_middleware); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 952, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":953
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:
 *             for factory in middleware:             # <<<<<<<<<<<<<<
 *                 c_options.middleware.push_back(
 *                     <shared_ptr[CClientMiddlewareFactory]>
 */
    if (likely(PyList_CheckExact(__pyx_v_middleware)) || PyTuple_CheckExact(__pyx_v_middleware)) {
      __pyx_t_3 = __pyx_v_middleware; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_middleware); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 953, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 953, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 953, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_8(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 953, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_factory, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":956
 *                 c_options.middleware.push_back(
 *                     <shared_ptr[CClientMiddlewareFactory]>
 *                     make_shared[CPyClientMiddlewareFactory](             # <<<<<<<<<<<<<<
 *                         <PyObject*> factory, start_call))
 * 
 */
      try {
        __pyx_t_9 = std::make_shared< arrow::py::flight::PyClientMiddlewareFactory>(((PyObject *)__pyx_v_factory), __pyx_v_start_call);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 956, __pyx_L1_error)
      }

      /* "pyarrow/_flight.pyx":954
 *         if middleware:
 *             for factory in middleware:
 *                 c_options.middleware.push_back(             # <<<<<<<<<<<<<<
 *                     <shared_ptr[CClientMiddlewareFactory]>
 *                     make_shared[CPyClientMiddlewareFactory](
 */
      try {
        __pyx_v_c_options.middleware.push_back(((std::shared_ptr< arrow::flight::ClientMiddlewareFactory> )__pyx_t_9));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 954, __pyx_L1_error)
      }

      /* "pyarrow/_flight.pyx":953
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:
 *             for factory in middleware:             # <<<<<<<<<<<<<<
 *                 c_options.middleware.push_back(
 *                     <shared_ptr[CClientMiddlewareFactory]>
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pyarrow/_flight.pyx":952
 *         if override_hostname:
 *             c_options.override_hostname = tobytes(override_hostname)
 *         if middleware:             # <<<<<<<<<<<<<<
 *             for factory in middleware:
 *                 c_options.middleware.push_back(
 */
  }

  /* "pyarrow/_flight.pyx":959
 *                         <PyObject*> factory, start_call))
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(CFlightClient.Connect(c_location, c_options,
 *                                                       &self.client))
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":960
 * 
 *         with nogil:
 *             check_flight_status(CFlightClient.Connect(c_location, c_options,             # <<<<<<<<<<<<<<
 *                                                       &self.client))
 * 
 */
        __pyx_t_10 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::flight::FlightClient::Connect(__pyx_v_c_location, __pyx_v_c_options, (&__pyx_v_self->client))); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 960, __pyx_L9_error)
      }

      /* "pyarrow/_flight.pyx":959
 *                         <PyObject*> factory, start_call))
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(CFlightClient.Connect(c_location, c_options,
 *                                                       &self.client))
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L10;
        }
        __pyx_L9_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L10:;
      }
  }

  /* "pyarrow/_flight.pyx":939
 *         self.init(location, tls_root_certs, override_hostname, middleware)
 * 
 *     cdef init(self, Location location, tls_root_certs, override_hostname,             # <<<<<<<<<<<<<<
 *               middleware):
 *         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_AddTraceback("pyarrow._flight.FlightClient.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_factory);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":963
 *                                                       &self.client))
 * 
 *     def wait_for_available(self, timeout=5):             # <<<<<<<<<<<<<<
 *         """Block until the server can be contacted.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_3wait_for_available(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_2wait_for_available[] = "FlightClient.wait_for_available(self, timeout=5)\nBlock until the server can be contacted.\n\n        Parameters\n        ----------\n        timeout : int, default 5\n            The maximum seconds to wait.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_3wait_for_available(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wait_for_available (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_5);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wait_for_available") < 0)) __PYX_ERR(0, 963, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_timeout = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wait_for_available", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.wait_for_available", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_2wait_for_available(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_timeout);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_2wait_for_available(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_v_deadline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("wait_for_available", 0);

  /* "pyarrow/_flight.pyx":971
 *             The maximum seconds to wait.
 *         """
 *         deadline = time.time() + timeout             # <<<<<<<<<<<<<<
 *         while True:
 *             try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_deadline = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":972
 *         """
 *         deadline = time.time() + timeout
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 list(self.list_flights())
 */
  while (1) {

    /* "pyarrow/_flight.pyx":973
 *         deadline = time.time() + timeout
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 list(self.list_flights())
 *             except FlightUnavailableError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "pyarrow/_flight.pyx":974
 *         while True:
 *             try:
 *                 list(self.list_flights())             # <<<<<<<<<<<<<<
 *             except FlightUnavailableError:
 *                 if time.time() < deadline:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_list_flights); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyarrow/_flight.pyx":973
 *         deadline = time.time() + timeout
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 list(self.list_flights())
 *             except FlightUnavailableError:
 */
      }

      /* "pyarrow/_flight.pyx":986
 *                 break
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
      /*else:*/ {
        goto __pyx_L10_try_break;
      }
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pyarrow/_flight.pyx":975
 *             try:
 *                 list(self.list_flights())
 *             except FlightUnavailableError:             # <<<<<<<<<<<<<<
 *                 if time.time() < deadline:
 *                     time.sleep(0.025)
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnavailableError));
      if (__pyx_t_7) {
        __Pyx_AddTraceback("pyarrow._flight.FlightClient.wait_for_available", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 975, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyarrow/_flight.pyx":976
 *                 list(self.list_flights())
 *             except FlightUnavailableError:
 *                 if time.time() < deadline:             # <<<<<<<<<<<<<<
 *                     time.sleep(0.025)
 *                     continue
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_time); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 976, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_time); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 976, __pyx_L7_except_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_10))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 976, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_RichCompare(__pyx_t_8, __pyx_v_deadline, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 976, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 976, __pyx_L7_except_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (likely(__pyx_t_11)) {

          /* "pyarrow/_flight.pyx":977
 *             except FlightUnavailableError:
 *                 if time.time() < deadline:
 *                     time.sleep(0.025)             # <<<<<<<<<<<<<<
 *                     continue
 *                 else:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 977, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sleep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 977, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(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_10 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_float_0_025) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_float_0_025);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 977, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "pyarrow/_flight.pyx":978
 *                 if time.time() < deadline:
 *                     time.sleep(0.025)
 *                     continue             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise
 */
          goto __pyx_L14_except_continue;

          /* "pyarrow/_flight.pyx":976
 *                 list(self.list_flights())
 *             except FlightUnavailableError:
 *                 if time.time() < deadline:             # <<<<<<<<<<<<<<
 *                     time.sleep(0.025)
 *                     continue
 */
        }

        /* "pyarrow/_flight.pyx":980
 *                     continue
 *                 else:
 *                     raise             # <<<<<<<<<<<<<<
 *             except NotImplementedError:
 *                 # allow if list_flights is not implemented, because
 */
        /*else*/ {
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_3);
          __Pyx_XGIVEREF(__pyx_t_2);
          __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_2);
          __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; 
          __PYX_ERR(0, 980, __pyx_L7_except_error)
        }
        __pyx_L14_except_continue:;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L11_try_continue;
      }

      /* "pyarrow/_flight.pyx":981
 *                 else:
 *                     raise
 *             except NotImplementedError:             # <<<<<<<<<<<<<<
 *                 # allow if list_flights is not implemented, because
 *                 # the server can be contacted nonetheless
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NotImplementedError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("pyarrow._flight.FlightClient.wait_for_available", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 981, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyarrow/_flight.pyx":984
 *                 # allow if list_flights is not implemented, because
 *                 # the server can be contacted nonetheless
 *                 break             # <<<<<<<<<<<<<<
 *             else:
 *                 break
 */
        goto __pyx_L16_except_break;
        __pyx_L16_except_break:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L10_try_break;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;

      /* "pyarrow/_flight.pyx":973
 *         deadline = time.time() + timeout
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 list(self.list_flights())
 *             except FlightUnavailableError:
 */
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L1_error;
      __pyx_L10_try_break:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L4_break;
      __pyx_L11_try_continue:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L3_continue;
    }
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pyarrow/_flight.pyx":963
 *                                                       &self.client))
 * 
 *     def wait_for_available(self, timeout=5):             # <<<<<<<<<<<<<<
 *         """Block until the server can be contacted.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.wait_for_available", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_deadline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":989
 * 
 *     @classmethod
 *     def connect(cls, location, tls_root_certs=None, override_hostname=None):             # <<<<<<<<<<<<<<
 *         warnings.warn("The 'FlightClient.connect' method is deprecated, use "
 *                       "FlightClient constructor or pyarrow.flight.connect "
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_5connect(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_4connect[] = "FlightClient.connect(type cls, location, tls_root_certs=None, override_hostname=None)";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_5connect(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_location = 0;
  PyObject *__pyx_v_tls_root_certs = 0;
  PyObject *__pyx_v_override_hostname = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_location,&__pyx_n_s_tls_root_certs,&__pyx_n_s_override_hostname,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_location)) != 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_tls_root_certs);
          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_override_hostname);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connect") < 0)) __PYX_ERR(0, 989, __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_location = values[0];
    __pyx_v_tls_root_certs = values[1];
    __pyx_v_override_hostname = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connect", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 989, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_4connect(((PyTypeObject*)__pyx_v_cls), __pyx_v_location, __pyx_v_tls_root_certs, __pyx_v_override_hostname);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_4connect(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "pyarrow/_flight.pyx":990
 *     @classmethod
 *     def connect(cls, location, tls_root_certs=None, override_hostname=None):
 *         warnings.warn("The 'FlightClient.connect' method is deprecated, use "             # <<<<<<<<<<<<<<
 *                       "FlightClient constructor or pyarrow.flight.connect "
 *                       "function instead")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __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_The_FlightClient_connect_method) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_The_FlightClient_connect_method);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __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;

  /* "pyarrow/_flight.pyx":993
 *                       "FlightClient constructor or pyarrow.flight.connect "
 *                       "function instead")
 *         return FlightClient(location, tls_root_certs=tls_root_certs,             # <<<<<<<<<<<<<<
 *                             override_hostname=override_hostname)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_location);
  __Pyx_GIVEREF(__pyx_v_location);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_location);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tls_root_certs, __pyx_v_tls_root_certs) < 0) __PYX_ERR(0, 993, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":994
 *                       "function instead")
 *         return FlightClient(location, tls_root_certs=tls_root_certs,
 *                             override_hostname=override_hostname)             # <<<<<<<<<<<<<<
 * 
 *     def authenticate(self, auth_handler, options: FlightCallOptions = None):
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_override_hostname, __pyx_v_override_hostname) < 0) __PYX_ERR(0, 993, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":993
 *                       "FlightClient constructor or pyarrow.flight.connect "
 *                       "function instead")
 *         return FlightClient(location, tls_root_certs=tls_root_certs,             # <<<<<<<<<<<<<<
 *                             override_hostname=override_hostname)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightClient), __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":989
 * 
 *     @classmethod
 *     def connect(cls, location, tls_root_certs=None, override_hostname=None):             # <<<<<<<<<<<<<<
 *         warnings.warn("The 'FlightClient.connect' method is deprecated, use "
 *                       "FlightClient constructor or pyarrow.flight.connect "
 */

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

/* "pyarrow/_flight.pyx":996
 *                             override_hostname=override_hostname)
 * 
 *     def authenticate(self, auth_handler, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Authenticate to the server.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_7authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_6authenticate[] = "FlightClient.authenticate(self, auth_handler, FlightCallOptions options: FlightCallOptions = None)\nAuthenticate to the server.\n\n        Parameters\n        ----------\n        auth_handler : ClientAuthHandler\n            The authentication mechanism to use.\n        options : FlightCallOptions\n            Options for this call.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_7authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_auth_handler = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("authenticate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_auth_handler,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auth_handler)) != 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_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "authenticate") < 0)) __PYX_ERR(0, 996, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_auth_handler = values[0];
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("authenticate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 996, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 996, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_6authenticate(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_auth_handler, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_6authenticate(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_auth_handler, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  std::unique_ptr< arrow::flight::ClientAuthHandler>  __pyx_v_handler;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
  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;
  __Pyx_RefNannySetupContext("authenticate", 0);

  /* "pyarrow/_flight.pyx":1008
 *         cdef:
 *             unique_ptr[CClientAuthHandler] handler
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(auth_handler, ClientAuthHandler):
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1010
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         if not isinstance(auth_handler, ClientAuthHandler):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 "FlightClient.authenticate takes a ClientAuthHandler, "
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_auth_handler, __pyx_ptype_7pyarrow_7_flight_ClientAuthHandler); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pyarrow/_flight.pyx":1013
 *             raise TypeError(
 *                 "FlightClient.authenticate takes a ClientAuthHandler, "
 *                 "not '{}'".format(type(auth_handler)))             # <<<<<<<<<<<<<<
 *         handler.reset((<ClientAuthHandler> auth_handler).to_handler())
 *         with nogil:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightClient_authenticate_takes, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __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, ((PyObject *)Py_TYPE(__pyx_v_auth_handler))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_auth_handler)));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":1011
 * 
 *         if not isinstance(auth_handler, ClientAuthHandler):
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 "FlightClient.authenticate takes a ClientAuthHandler, "
 *                 "not '{}'".format(type(auth_handler)))
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1011, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1011, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1010
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         if not isinstance(auth_handler, ClientAuthHandler):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 "FlightClient.authenticate takes a ClientAuthHandler, "
 */
  }

  /* "pyarrow/_flight.pyx":1014
 *                 "FlightClient.authenticate takes a ClientAuthHandler, "
 *                 "not '{}'".format(type(auth_handler)))
 *         handler.reset((<ClientAuthHandler> auth_handler).to_handler())             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(
 */
  __pyx_v_handler.reset(((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthHandler *)((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_auth_handler)->__pyx_vtab)->to_handler(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_auth_handler)));

  /* "pyarrow/_flight.pyx":1015
 *                 "not '{}'".format(type(auth_handler)))
 *         handler.reset((<ClientAuthHandler> auth_handler).to_handler())
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().Authenticate(deref(c_options),
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1016
 *         handler.reset((<ClientAuthHandler> auth_handler).to_handler())
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 self.client.get().Authenticate(deref(c_options),
 *                                                move(handler)))
 */
        __pyx_t_6 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->client.get()->Authenticate((*__pyx_v_c_options),  cymove::cymove<std::unique_ptr< arrow::flight::ClientAuthHandler> >(__pyx_v_handler))); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1016, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1015
 *                 "not '{}'".format(type(auth_handler)))
 *         handler.reset((<ClientAuthHandler> auth_handler).to_handler())
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().Authenticate(deref(c_options),
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":996
 *                             override_hostname=override_hostname)
 * 
 *     def authenticate(self, auth_handler, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Authenticate to the server.
 * 
 */

  /* 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("pyarrow._flight.FlightClient.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1020
 *                                                move(handler)))
 * 
 *     def list_actions(self, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """List the actions available on a service."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_9list_actions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_8list_actions[] = "FlightClient.list_actions(self, FlightCallOptions options: FlightCallOptions = None)\nList the actions available on a service.";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_9list_actions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_actions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_options,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "list_actions") < 0)) __PYX_ERR(0, 1020, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("list_actions", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1020, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.list_actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1020, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_8list_actions(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_8list_actions(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  std::vector< arrow::flight::ActionType>  __pyx_v_results;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
  PyObject *__pyx_v_result = NULL;
   arrow::flight::ActionType __pyx_v_action_type;
  PyObject *__pyx_v_py_action = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  std::vector< arrow::flight::ActionType> ::iterator __pyx_t_3;
   arrow::flight::ActionType __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;
  __Pyx_RefNannySetupContext("list_actions", 0);

  /* "pyarrow/_flight.pyx":1024
 *         cdef:
 *             vector[CActionType] results
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1026
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().ListActions(deref(c_options), &results))
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1027
 * 
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 self.client.get().ListActions(deref(c_options), &results))
 * 
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->client.get()->ListActions((*__pyx_v_c_options), (&__pyx_v_results))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1027, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":1026
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().ListActions(deref(c_options), &results))
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":1030
 *                 self.client.get().ListActions(deref(c_options), &results))
 * 
 *         result = []             # <<<<<<<<<<<<<<
 *         for action_type in results:
 *             py_action = ActionType(frombytes(action_type.type),
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1031
 * 
 *         result = []
 *         for action_type in results:             # <<<<<<<<<<<<<<
 *             py_action = ActionType(frombytes(action_type.type),
 *                                    frombytes(action_type.description))
 */
  __pyx_t_3 = __pyx_v_results.begin();
  for (;;) {
    if (!(__pyx_t_3 != __pyx_v_results.end())) break;
    __pyx_t_4 = *__pyx_t_3;
    ++__pyx_t_3;
    __pyx_v_action_type = __pyx_t_4;

    /* "pyarrow/_flight.pyx":1032
 *         result = []
 *         for action_type in results:
 *             py_action = ActionType(frombytes(action_type.type),             # <<<<<<<<<<<<<<
 *                                    frombytes(action_type.description))
 *             result.append(py_action)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ActionType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_action_type.type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyarrow/_flight.pyx":1033
 *         for action_type in results:
 *             py_action = ActionType(frombytes(action_type.type),
 *                                    frombytes(action_type.description))             # <<<<<<<<<<<<<<
 *             result.append(py_action)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_frombytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_action_type.description); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __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(0, 1032, __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_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_1, __pyx_t_7);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_py_action, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":1034
 *             py_action = ActionType(frombytes(action_type.type),
 *                                    frombytes(action_type.description))
 *             result.append(py_action)             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_py_action); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1034, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1031
 * 
 *         result = []
 *         for action_type in results:             # <<<<<<<<<<<<<<
 *             py_action = ActionType(frombytes(action_type.type),
 *                                    frombytes(action_type.description))
 */
  }

  /* "pyarrow/_flight.pyx":1036
 *             result.append(py_action)
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def do_action(self, action, options: FlightCallOptions = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1020
 *                                                move(handler)))
 * 
 *     def list_actions(self, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """List the actions available on a service."""
 *         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_10);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.list_actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_py_action);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7pyarrow_7_flight_12FlightClient_12generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pyarrow/_flight.pyx":1038
 *         return result
 * 
 *     def do_action(self, action, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute an action on a service.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_11do_action(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_10do_action[] = "FlightClient.do_action(self, action, FlightCallOptions options: FlightCallOptions = None)\n\n        Execute an action on a service.\n\n        Parameters\n        ----------\n        action : str, tuple, or Action\n            Can be action type name (no body), type and body, or any Action\n            object\n        options : FlightCallOptions\n            RPC options\n\n        Returns\n        -------\n        results : iterator of Result values\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_11do_action(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_action = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_action (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_action,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action)) != 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_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_action") < 0)) __PYX_ERR(0, 1038, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_action = values[0];
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_action", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1038, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1038, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_10do_action(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_action, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_10do_action(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, PyObject *__pyx_v_action, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_action", 0);
  __pyx_cur_scope = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_1_do_action(__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_1_do_action, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1038, __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_action = __pyx_v_action;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_action);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_action);
  __pyx_cur_scope->__pyx_v_options = __pyx_v_options;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_options);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_options);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pyarrow_7_flight_12FlightClient_12generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_do_action, __pyx_n_s_FlightClient_do_action, __pyx_n_s_pyarrow__flight); if (unlikely(!gen)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_action", __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_7pyarrow_7_flight_12FlightClient_12generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *__pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
   arrow::flight::Action __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_action", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L18_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, 1038, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1057
 *             unique_ptr[CResultStream] results
 *             Result result
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(action, (str, bytes)):
 */
  __pyx_cur_scope->__pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_cur_scope->__pyx_v_options);

  /* "pyarrow/_flight.pyx":1059
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         if isinstance(action, (str, bytes)):             # <<<<<<<<<<<<<<
 *             action = Action(action, b'')
 *         elif isinstance(action, tuple):
 */
  __pyx_t_2 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_action); 
  __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_3 = PyBytes_Check(__pyx_cur_scope->__pyx_v_action); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":1060
 * 
 *         if isinstance(action, (str, bytes)):
 *             action = Action(action, b'')             # <<<<<<<<<<<<<<
 *         elif isinstance(action, tuple):
 *             action = Action(*action)
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_action);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_action);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_action);
    __Pyx_INCREF(__pyx_kp_b__37);
    __Pyx_GIVEREF(__pyx_kp_b__37);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_b__37);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Action), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_action);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_action, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyarrow/_flight.pyx":1059
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         if isinstance(action, (str, bytes)):             # <<<<<<<<<<<<<<
 *             action = Action(action, b'')
 *         elif isinstance(action, tuple):
 */
    goto __pyx_L4;
  }

  /* "pyarrow/_flight.pyx":1061
 *         if isinstance(action, (str, bytes)):
 *             action = Action(action, b'')
 *         elif isinstance(action, tuple):             # <<<<<<<<<<<<<<
 *             action = Action(*action)
 *         elif not isinstance(action, Action):
 */
  __pyx_t_2 = PyTuple_Check(__pyx_cur_scope->__pyx_v_action); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":1062
 *             action = Action(action, b'')
 *         elif isinstance(action, tuple):
 *             action = Action(*action)             # <<<<<<<<<<<<<<
 *         elif not isinstance(action, Action):
 *             raise TypeError("Action must be Action instance, string, or tuple")
 */
    __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_cur_scope->__pyx_v_action); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Action), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_action);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_action, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":1061
 *         if isinstance(action, (str, bytes)):
 *             action = Action(action, b'')
 *         elif isinstance(action, tuple):             # <<<<<<<<<<<<<<
 *             action = Action(*action)
 *         elif not isinstance(action, Action):
 */
    goto __pyx_L4;
  }

  /* "pyarrow/_flight.pyx":1063
 *         elif isinstance(action, tuple):
 *             action = Action(*action)
 *         elif not isinstance(action, Action):             # <<<<<<<<<<<<<<
 *             raise TypeError("Action must be Action instance, string, or tuple")
 * 
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_action, __pyx_ptype_7pyarrow_7_flight_Action); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pyarrow/_flight.pyx":1064
 *             action = Action(*action)
 *         elif not isinstance(action, Action):
 *             raise TypeError("Action must be Action instance, string, or tuple")             # <<<<<<<<<<<<<<
 * 
 *         cdef CAction c_action = Action.unwrap(<Action> action)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_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, 1064, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1063
 *         elif isinstance(action, tuple):
 *             action = Action(*action)
 *         elif not isinstance(action, Action):             # <<<<<<<<<<<<<<
 *             raise TypeError("Action must be Action instance, string, or tuple")
 * 
 */
  }
  __pyx_L4:;

  /* "pyarrow/_flight.pyx":1066
 *             raise TypeError("Action must be Action instance, string, or tuple")
 * 
 *         cdef CAction c_action = Action.unwrap(<Action> action)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(
 */
  __pyx_t_6 = __pyx_f_7pyarrow_7_flight_6Action_unwrap(((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_cur_scope->__pyx_v_action)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1066, __pyx_L1_error)
  __pyx_cur_scope->__pyx_v_c_action = __pyx_t_6;

  /* "pyarrow/_flight.pyx":1067
 * 
 *         cdef CAction c_action = Action.unwrap(<Action> action)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().DoAction(deref(c_options), c_action,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1068
 *         cdef CAction c_action = Action.unwrap(<Action> action)
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 self.client.get().DoAction(deref(c_options), c_action,
 *                                            &results))
 */
        __pyx_t_7 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_cur_scope->__pyx_v_self->client.get()->DoAction((*__pyx_cur_scope->__pyx_v_c_options), __pyx_cur_scope->__pyx_v_c_action, (&__pyx_cur_scope->__pyx_v_results))); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1068, __pyx_L8_error)
      }

      /* "pyarrow/_flight.pyx":1067
 * 
 *         cdef CAction c_action = Action.unwrap(<Action> action)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().DoAction(deref(c_options), c_action,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L9;
        }
        __pyx_L8_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L9:;
      }
  }

  /* "pyarrow/_flight.pyx":1072
 *                                            &results))
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             result = Result.__new__(Result)
 *             with nogil:
 */
  while (1) {

    /* "pyarrow/_flight.pyx":1073
 * 
 *         while True:
 *             result = Result.__new__(Result)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 check_flight_status(results.get().Next(&result.result))
 */
    __pyx_t_4 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_Result(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_Result), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_result));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_result, ((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":1074
 *         while True:
 *             result = Result.__new__(Result)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 check_flight_status(results.get().Next(&result.result))
 *                 if result.result == NULL:
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pyarrow/_flight.pyx":1075
 *             result = Result.__new__(Result)
 *             with nogil:
 *                 check_flight_status(results.get().Next(&result.result))             # <<<<<<<<<<<<<<
 *                 if result.result == NULL:
 *                     break
 */
          __pyx_t_7 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_cur_scope->__pyx_v_results.get()->Next((&__pyx_cur_scope->__pyx_v_result->result))); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1075, __pyx_L15_error)

          /* "pyarrow/_flight.pyx":1076
 *             with nogil:
 *                 check_flight_status(results.get().Next(&result.result))
 *                 if result.result == NULL:             # <<<<<<<<<<<<<<
 *                     break
 *             yield result
 */
          __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_result->result == NULL) != 0);
          if (__pyx_t_2) {

            /* "pyarrow/_flight.pyx":1077
 *                 check_flight_status(results.get().Next(&result.result))
 *                 if result.result == NULL:
 *                     break             # <<<<<<<<<<<<<<
 *             yield result
 * 
 */
            goto __pyx_L13_break;

            /* "pyarrow/_flight.pyx":1076
 *             with nogil:
 *                 check_flight_status(results.get().Next(&result.result))
 *                 if result.result == NULL:             # <<<<<<<<<<<<<<
 *                     break
 *             yield result
 */
          }
        }

        /* "pyarrow/_flight.pyx":1074
 *         while True:
 *             result = Result.__new__(Result)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 check_flight_status(results.get().Next(&result.result))
 *                 if result.result == NULL:
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L16;
          }
          __pyx_L13_break: {
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L11_break;
          }
          __pyx_L15_error: {
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L1_error;
          }
          __pyx_L16:;
        }
    }

    /* "pyarrow/_flight.pyx":1078
 *                 if result.result == NULL:
 *                     break
 *             yield result             # <<<<<<<<<<<<<<
 * 
 *     def list_flights(self, options: FlightCallOptions = None):
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_result));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_result);
    __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_L18_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1078, __pyx_L1_error)
  }
  __pyx_L11_break:;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pyarrow/_flight.pyx":1038
 *         return result
 * 
 *     def do_action(self, action, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute an action on a service.
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("do_action", __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_7pyarrow_7_flight_12FlightClient_15generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pyarrow/_flight.pyx":1080
 *             yield result
 * 
 *     def list_flights(self, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """List the flights available on a service."""
 *         cdef:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_14list_flights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_13list_flights[] = "FlightClient.list_flights(self, FlightCallOptions options: FlightCallOptions = None)\nList the flights available on a service.";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_14list_flights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_flights (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_options,0};
    PyObject* values[1] = {0};
    values[0] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "list_flights") < 0)) __PYX_ERR(0, 1080, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("list_flights", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1080, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.list_flights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1080, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_13list_flights(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_13list_flights(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_flights", 0);
  __pyx_cur_scope = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_2_list_flights(__pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_2_list_flights, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1080, __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_options = __pyx_v_options;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_options);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_options);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7pyarrow_7_flight_12FlightClient_15generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_list_flights, __pyx_n_s_FlightClient_list_flights, __pyx_n_s_pyarrow__flight); if (unlikely(!gen)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.list_flights", __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_7pyarrow_7_flight_12FlightClient_15generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *__pyx_cur_scope = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_flights", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L15_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, 1080, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1085
 *             unique_ptr[CFlightListing] listing
 *             FlightInfo result
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 *             CCriteria c_criteria
 * 
 */
  __pyx_cur_scope->__pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_cur_scope->__pyx_v_options);

  /* "pyarrow/_flight.pyx":1088
 *             CCriteria c_criteria
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().ListFlights(deref(c_options),
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1089
 * 
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 self.client.get().ListFlights(deref(c_options),
 *                                               c_criteria, &listing))
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_cur_scope->__pyx_v_self->client.get()->ListFlights((*__pyx_cur_scope->__pyx_v_c_options), __pyx_cur_scope->__pyx_v_c_criteria, (&__pyx_cur_scope->__pyx_v_listing))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1089, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1088
 *             CCriteria c_criteria
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().ListFlights(deref(c_options),
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":1093
 *                                               c_criteria, &listing))
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             result = FlightInfo.__new__(FlightInfo)
 *             with nogil:
 */
  while (1) {

    /* "pyarrow/_flight.pyx":1094
 * 
 *         while True:
 *             result = FlightInfo.__new__(FlightInfo)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 check_flight_status(listing.get().Next(&result.info))
 */
    __pyx_t_2 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightInfo(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightInfo), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_result));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_result, ((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":1095
 *         while True:
 *             result = FlightInfo.__new__(FlightInfo)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 check_flight_status(listing.get().Next(&result.info))
 *                 if result.info == NULL:
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        #endif
        /*try:*/ {

          /* "pyarrow/_flight.pyx":1096
 *             result = FlightInfo.__new__(FlightInfo)
 *             with nogil:
 *                 check_flight_status(listing.get().Next(&result.info))             # <<<<<<<<<<<<<<
 *                 if result.info == NULL:
 *                     break
 */
          __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_cur_scope->__pyx_v_listing.get()->Next((&__pyx_cur_scope->__pyx_v_result->info))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1096, __pyx_L12_error)

          /* "pyarrow/_flight.pyx":1097
 *             with nogil:
 *                 check_flight_status(listing.get().Next(&result.info))
 *                 if result.info == NULL:             # <<<<<<<<<<<<<<
 *                     break
 *             yield result
 */
          __pyx_t_3 = ((__pyx_cur_scope->__pyx_v_result->info == NULL) != 0);
          if (__pyx_t_3) {

            /* "pyarrow/_flight.pyx":1098
 *                 check_flight_status(listing.get().Next(&result.info))
 *                 if result.info == NULL:
 *                     break             # <<<<<<<<<<<<<<
 *             yield result
 * 
 */
            goto __pyx_L10_break;

            /* "pyarrow/_flight.pyx":1097
 *             with nogil:
 *                 check_flight_status(listing.get().Next(&result.info))
 *                 if result.info == NULL:             # <<<<<<<<<<<<<<
 *                     break
 *             yield result
 */
          }
        }

        /* "pyarrow/_flight.pyx":1095
 *         while True:
 *             result = FlightInfo.__new__(FlightInfo)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 check_flight_status(listing.get().Next(&result.info))
 *                 if result.info == NULL:
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L13;
          }
          __pyx_L10_break: {
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L8_break;
          }
          __pyx_L12_error: {
            #ifdef WITH_THREAD
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L1_error;
          }
          __pyx_L13:;
        }
    }

    /* "pyarrow/_flight.pyx":1099
 *                 if result.info == NULL:
 *                     break
 *             yield result             # <<<<<<<<<<<<<<
 * 
 *     def get_flight_info(self, descriptor: FlightDescriptor,
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_result));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_result);
    __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_L15_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1099, __pyx_L1_error)
  }
  __pyx_L8_break:;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "pyarrow/_flight.pyx":1080
 *             yield result
 * 
 *     def list_flights(self, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """List the flights available on a service."""
 *         cdef:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("list_flights", __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;
}

/* "pyarrow/_flight.pyx":1101
 *             yield result
 * 
 *     def get_flight_info(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                         options: FlightCallOptions = None):
 *         """Request information about an available flight."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_17get_flight_info(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_16get_flight_info[] = "FlightClient.get_flight_info(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)\nRequest information about an available flight.";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_17get_flight_info(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_flight_info (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_descriptor,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};

    /* "pyarrow/_flight.pyx":1102
 * 
 *     def get_flight_info(self, descriptor: FlightDescriptor,
 *                         options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Request information about an available flight."""
 *         cdef:
 */
    values[1] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_descriptor)) != 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_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_flight_info") < 0)) __PYX_ERR(0, 1101, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)values[0]);
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_flight_info", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1101, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_descriptor), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor, 1, "descriptor", 0))) __PYX_ERR(0, 1101, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1102, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_16get_flight_info(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_descriptor, __pyx_v_options);

  /* "pyarrow/_flight.pyx":1101
 *             yield result
 * 
 *     def get_flight_info(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                         options: FlightCallOptions = None):
 *         """Request information about an available flight."""
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_16get_flight_info(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInfo *__pyx_v_result = 0;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
   arrow::flight::FlightDescriptor __pyx_v_c_descriptor;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
   arrow::flight::FlightDescriptor __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("get_flight_info", 0);

  /* "pyarrow/_flight.pyx":1105
 *         """Request information about an available flight."""
 *         cdef:
 *             FlightInfo result = FlightInfo.__new__(FlightInfo)             # <<<<<<<<<<<<<<
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 *             CFlightDescriptor c_descriptor = \
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightInfo(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightInfo), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1105, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1106
 *         cdef:
 *             FlightInfo result = FlightInfo.__new__(FlightInfo)
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1108
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_2 = __pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap(__pyx_v_descriptor); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L1_error)
  __pyx_v_c_descriptor = __pyx_t_2;

  /* "pyarrow/_flight.pyx":1110
 *                 FlightDescriptor.unwrap(descriptor)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.client.get().GetFlightInfo(
 *                 deref(c_options), c_descriptor, &result.info))
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1111
 * 
 *         with nogil:
 *             check_flight_status(self.client.get().GetFlightInfo(             # <<<<<<<<<<<<<<
 *                 deref(c_options), c_descriptor, &result.info))
 * 
 */
        __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->client.get()->GetFlightInfo((*__pyx_v_c_options), __pyx_v_c_descriptor, (&__pyx_v_result->info))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1111, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":1110
 *                 FlightDescriptor.unwrap(descriptor)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.client.get().GetFlightInfo(
 *                 deref(c_options), c_descriptor, &result.info))
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":1114
 *                 deref(c_options), c_descriptor, &result.info))
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def get_schema(self, descriptor: FlightDescriptor,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1101
 *             yield result
 * 
 *     def get_flight_info(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                         options: FlightCallOptions = None):
 *         """Request information about an available flight."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1116
 *         return result
 * 
 *     def get_schema(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                    options: FlightCallOptions = None):
 *         """Request schema for an available flight."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_19get_schema(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_18get_schema[] = "FlightClient.get_schema(self, FlightDescriptor descriptor: FlightDescriptor, FlightCallOptions options: FlightCallOptions = None)\nRequest schema for an available flight.";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_19get_schema(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_descriptor,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};

    /* "pyarrow/_flight.pyx":1117
 * 
 *     def get_schema(self, descriptor: FlightDescriptor,
 *                    options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Request schema for an available flight."""
 *         cdef:
 */
    values[1] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_descriptor)) != 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_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_schema") < 0)) __PYX_ERR(0, 1116, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)values[0]);
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_schema", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1116, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.get_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_descriptor), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor, 1, "descriptor", 0))) __PYX_ERR(0, 1116, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1117, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_18get_schema(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_descriptor, __pyx_v_options);

  /* "pyarrow/_flight.pyx":1116
 *         return result
 * 
 *     def get_schema(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                    options: FlightCallOptions = None):
 *         """Request schema for an available flight."""
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_18get_schema(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  struct __pyx_obj_7pyarrow_7_flight_SchemaResult *__pyx_v_result = 0;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
   arrow::flight::FlightDescriptor __pyx_v_c_descriptor;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
   arrow::flight::FlightDescriptor __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("get_schema", 0);

  /* "pyarrow/_flight.pyx":1120
 *         """Request schema for an available flight."""
 *         cdef:
 *             SchemaResult result = SchemaResult.__new__(SchemaResult)             # <<<<<<<<<<<<<<
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 *             CFlightDescriptor c_descriptor = \
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_SchemaResult(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_SchemaResult), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1121
 *         cdef:
 *             SchemaResult result = SchemaResult.__new__(SchemaResult)
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1123
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_status(
 */
  __pyx_t_2 = __pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap(__pyx_v_descriptor); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L1_error)
  __pyx_v_c_descriptor = __pyx_t_2;

  /* "pyarrow/_flight.pyx":1124
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_status(
 *                 self.client.get()
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1125
 *                 FlightDescriptor.unwrap(descriptor)
 *         with nogil:
 *             check_status(             # <<<<<<<<<<<<<<
 *                 self.client.get()
 *                     .GetSchema(deref(c_options), c_descriptor, &result.result)
 */
        __pyx_t_3 = __pyx_f_7pyarrow_3lib_check_status(__pyx_v_self->client.get()->GetSchema((*__pyx_v_c_options), __pyx_v_c_descriptor, (&__pyx_v_result->result))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1125, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":1124
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_status(
 *                 self.client.get()
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":1130
 *             )
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def do_get(self, ticket: Ticket, options: FlightCallOptions = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1116
 *         return result
 * 
 *     def get_schema(self, descriptor: FlightDescriptor,             # <<<<<<<<<<<<<<
 *                    options: FlightCallOptions = None):
 *         """Request schema for an available flight."""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.get_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1132
 *         return result
 * 
 *     def do_get(self, ticket: Ticket, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Request the data for a flight.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_21do_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_20do_get[] = "FlightClient.do_get(self, Ticket ticket: Ticket, FlightCallOptions options: FlightCallOptions = None)\nRequest the data for a flight.\n\n        Returns\n        -------\n        reader : FlightStreamReader\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_21do_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_ticket = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ticket,&__pyx_n_s_options,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ticket)) != 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_options);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_get") < 0)) __PYX_ERR(0, 1132, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ticket = ((struct __pyx_obj_7pyarrow_7_flight_Ticket *)values[0]);
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ticket), __pyx_ptype_7pyarrow_7_flight_Ticket, 1, "ticket", 0))) __PYX_ERR(0, 1132, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1132, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_20do_get(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_ticket, __pyx_v_options);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_20do_get(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_ticket, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  std::unique_ptr< arrow::flight::FlightStreamReader>  __pyx_v_reader;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("do_get", 0);

  /* "pyarrow/_flight.pyx":1141
 *         cdef:
 *             unique_ptr[CFlightStreamReader] reader
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1143
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().DoGet(
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1144
 * 
 *         with nogil:
 *             check_flight_status(             # <<<<<<<<<<<<<<
 *                 self.client.get().DoGet(
 *                     deref(c_options), ticket.ticket, &reader))
 */
        __pyx_t_1 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->client.get()->DoGet((*__pyx_v_c_options), __pyx_v_ticket->ticket, (&__pyx_v_reader))); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1144, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":1143
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(
 *                 self.client.get().DoGet(
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":1147
 *                 self.client.get().DoGet(
 *                     deref(c_options), ticket.ticket, &reader))
 *         result = FlightStreamReader()             # <<<<<<<<<<<<<<
 *         result.reader.reset(reader.release())
 *         result.schema = pyarrow_wrap_schema(result.reader.get().schema())
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightStreamReader)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1148
 *                     deref(c_options), ticket.ticket, &reader))
 *         result = FlightStreamReader()
 *         result.reader.reset(reader.release())             # <<<<<<<<<<<<<<
 *         result.schema = pyarrow_wrap_schema(result.reader.get().schema())
 *         return result
 */
  __pyx_v_result->__pyx_base.__pyx_base.reader.reset(__pyx_v_reader.release());

  /* "pyarrow/_flight.pyx":1149
 *         result = FlightStreamReader()
 *         result.reader.reset(reader.release())
 *         result.schema = pyarrow_wrap_schema(result.reader.get().schema())             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_result->__pyx_base.__pyx_base.reader.get()->schema()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7pyarrow_3lib_Schema))))) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->__pyx_base.__pyx_base.schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_result->__pyx_base.__pyx_base.schema));
  __pyx_v_result->__pyx_base.__pyx_base.schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1150
 *         result.reader.reset(reader.release())
 *         result.schema = pyarrow_wrap_schema(result.reader.get().schema())
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def do_put(self, descriptor: FlightDescriptor, schema: Schema,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1132
 *         return result
 * 
 *     def do_get(self, ticket: Ticket, options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Request the data for a flight.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1152
 *         return result
 * 
 *     def do_put(self, descriptor: FlightDescriptor, schema: Schema,             # <<<<<<<<<<<<<<
 *                options: FlightCallOptions = None):
 *         """Upload data to a flight.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_23do_put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_22do_put[] = "FlightClient.do_put(self, FlightDescriptor descriptor: FlightDescriptor, Schema schema: Schema, FlightCallOptions options: FlightCallOptions = None)\nUpload data to a flight.\n\n        Returns\n        -------\n        writer : FlightStreamWriter\n        reader : FlightMetadataReader\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_23do_put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_put (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_descriptor,&__pyx_n_s_schema,&__pyx_n_s_options,0};
    PyObject* values[3] = {0,0,0};

    /* "pyarrow/_flight.pyx":1153
 * 
 *     def do_put(self, descriptor: FlightDescriptor, schema: Schema,
 *                options: FlightCallOptions = None):             # <<<<<<<<<<<<<<
 *         """Upload data to a flight.
 * 
 */
    values[2] = (PyObject *)((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_descriptor)) != 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_schema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_put", 0, 2, 3, 1); __PYX_ERR(0, 1152, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_put") < 0)) __PYX_ERR(0, 1152, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)values[0]);
    __pyx_v_schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)values[1]);
    __pyx_v_options = ((struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_put", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1152, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_descriptor), __pyx_ptype_7pyarrow_7_flight_FlightDescriptor, 1, "descriptor", 0))) __PYX_ERR(0, 1152, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_schema), __pyx_ptype_7pyarrow_3lib_Schema, 1, "schema", 0))) __PYX_ERR(0, 1152, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), __pyx_ptype_7pyarrow_7_flight_FlightCallOptions, 1, "options", 0))) __PYX_ERR(0, 1153, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12FlightClient_22do_put(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), __pyx_v_descriptor, __pyx_v_schema, __pyx_v_options);

  /* "pyarrow/_flight.pyx":1152
 *         return result
 * 
 *     def do_put(self, descriptor: FlightDescriptor, schema: Schema,             # <<<<<<<<<<<<<<
 *                options: FlightCallOptions = None):
 *         """Upload data to a flight.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_22do_put(struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor, struct __pyx_obj_7pyarrow_3lib_Schema *__pyx_v_schema, struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *__pyx_v_options) {
  std::shared_ptr< arrow::Schema>  __pyx_v_c_schema;
  std::unique_ptr< arrow::flight::FlightStreamWriter>  __pyx_v_writer;
   arrow::flight::FlightCallOptions *__pyx_v_c_options;
   arrow::flight::FlightDescriptor __pyx_v_c_descriptor;
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *__pyx_v_reader = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
   arrow::flight::FlightDescriptor __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("do_put", 0);

  /* "pyarrow/_flight.pyx":1162
 *         """
 *         cdef:
 *             shared_ptr[CSchema] c_schema = pyarrow_unwrap_schema(schema)             # <<<<<<<<<<<<<<
 *             unique_ptr[CFlightStreamWriter] writer
 *             unique_ptr[CFlightMetadataReader] metadata_reader
 */
  __pyx_v_c_schema = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema(((PyObject *)__pyx_v_schema));

  /* "pyarrow/_flight.pyx":1165
 *             unique_ptr[CFlightStreamWriter] writer
 *             unique_ptr[CFlightMetadataReader] metadata_reader
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)             # <<<<<<<<<<<<<<
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 */
  __pyx_v_c_options = __pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap(__pyx_v_options);

  /* "pyarrow/_flight.pyx":1167
 *             CFlightCallOptions* c_options = FlightCallOptions.unwrap(options)
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)             # <<<<<<<<<<<<<<
 *             FlightMetadataReader reader = FlightMetadataReader()
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap(__pyx_v_descriptor); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1167, __pyx_L1_error)
  __pyx_v_c_descriptor = __pyx_t_1;

  /* "pyarrow/_flight.pyx":1168
 *             CFlightDescriptor c_descriptor = \
 *                 FlightDescriptor.unwrap(descriptor)
 *             FlightMetadataReader reader = FlightMetadataReader()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightMetadataReader)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_reader = ((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1170
 *             FlightMetadataReader reader = FlightMetadataReader()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.client.get().DoPut(
 *                 deref(c_options),
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1171
 * 
 *         with nogil:
 *             check_flight_status(self.client.get().DoPut(             # <<<<<<<<<<<<<<
 *                 deref(c_options),
 *                 c_descriptor,
 */
        __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->client.get()->DoPut((*__pyx_v_c_options), __pyx_v_c_descriptor, __pyx_v_c_schema, (&__pyx_v_writer), (&__pyx_v_reader->reader))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1171, __pyx_L4_error)
      }

      /* "pyarrow/_flight.pyx":1170
 *             FlightMetadataReader reader = FlightMetadataReader()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.client.get().DoPut(
 *                 deref(c_options),
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L4_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":1177
 *                 &writer,
 *                 &reader.reader))
 *         result = FlightStreamWriter()             # <<<<<<<<<<<<<<
 *         result.writer.reset(writer.release())
 *         return result, reader
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightStreamWriter)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1178
 *                 &reader.reader))
 *         result = FlightStreamWriter()
 *         result.writer.reset(writer.release())             # <<<<<<<<<<<<<<
 *         return result, reader
 * 
 */
  __pyx_v_result->__pyx_base.writer.reset(__pyx_v_writer.release());

  /* "pyarrow/_flight.pyx":1179
 *         result = FlightStreamWriter()
 *         result.writer.reset(writer.release())
 *         return result, reader             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_reader));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reader));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_reader));
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1152
 *         return result
 * 
 *     def do_put(self, descriptor: FlightDescriptor, schema: Schema,             # <<<<<<<<<<<<<<
 *                options: FlightCallOptions = None):
 *         """Upload data to a flight.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_reader);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_25__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_24__reduce_cython__[] = "FlightClient.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_25__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_7pyarrow_7_flight_12FlightClient_24__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_24__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightClient.__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("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_27__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12FlightClient_26__setstate_cython__[] = "FlightClient.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_12FlightClient_27__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_7pyarrow_7_flight_12FlightClient_26__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightClient *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_12FlightClient_26__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightClient *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1185
 *     """Abstract base class for Flight data streams."""
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         """Create the C++ data stream for the backing Python object.
 * 
 */

static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_16FlightDataStream_to_stream(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v_self) {
   arrow::flight::FlightDataStream *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_stream", 0);

  /* "pyarrow/_flight.pyx":1191
 *         lifetime from the Cython/C++ side.
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1191, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1185
 *     """Abstract base class for Flight data streams."""
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         """Create the C++ data stream for the backing Python object.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightDataStream.to_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDataStream_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDataStream___reduce_cython__[] = "FlightDataStream.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDataStream_1__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_7pyarrow_7_flight_16FlightDataStream___reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDataStream___reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_FlightDataStream); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightDataStream__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_FlightDataStream); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.FlightDataStream.__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_FlightDataStream, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightDataStream__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDataStream_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightDataStream_2__setstate_cython__[] = "FlightDataStream.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightDataStream_3__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_7pyarrow_7_flight_16FlightDataStream_2__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightDataStream_2__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_FlightDataStream, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_FlightDataStream__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightDataStream__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_FlightDataStream, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_FlightDataStream__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("pyarrow._flight.FlightDataStream.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1199
 *         object data_source
 * 
 *     def __init__(self, data_source):             # <<<<<<<<<<<<<<
 *         """Create a RecordBatchStream from a data source.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_17RecordBatchStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17RecordBatchStream___init__[] = "Create a RecordBatchStream from a data source.\n\n        Parameters\n        ----------\n        data_source : RecordBatchReader or Table\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_17RecordBatchStream___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_17RecordBatchStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data_source = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data_source,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_data_source)) != 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(0, 1199, __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_data_source = 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(0, 1199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.RecordBatchStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17RecordBatchStream___init__(((struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)__pyx_v_self), __pyx_v_data_source);

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

static int __pyx_pf_7pyarrow_7_flight_17RecordBatchStream___init__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self, PyObject *__pyx_v_data_source) {
  int __pyx_r;
  __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;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":1206
 *         data_source : RecordBatchReader or Table
 *         """
 *         if (not isinstance(data_source, _CRecordBatchReader) and             # <<<<<<<<<<<<<<
 *                 not isinstance(data_source, lib.Table)):
 *             raise TypeError("Expected RecordBatchReader or Table, "
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_data_source, __pyx_ptype_7pyarrow_3lib__CRecordBatchReader); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pyarrow/_flight.pyx":1207
 *         """
 *         if (not isinstance(data_source, _CRecordBatchReader) and
 *                 not isinstance(data_source, lib.Table)):             # <<<<<<<<<<<<<<
 *             raise TypeError("Expected RecordBatchReader or Table, "
 *                             "but got: {}".format(type(data_source)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_lib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Table); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_data_source, __pyx_t_5); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "pyarrow/_flight.pyx":1206
 *         data_source : RecordBatchReader or Table
 *         """
 *         if (not isinstance(data_source, _CRecordBatchReader) and             # <<<<<<<<<<<<<<
 *                 not isinstance(data_source, lib.Table)):
 *             raise TypeError("Expected RecordBatchReader or Table, "
 */
  if (unlikely(__pyx_t_1)) {

    /* "pyarrow/_flight.pyx":1209
 *                 not isinstance(data_source, lib.Table)):
 *             raise TypeError("Expected RecordBatchReader or Table, "
 *                             "but got: {}".format(type(data_source)))             # <<<<<<<<<<<<<<
 *         self.data_source = data_source
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Expected_RecordBatchReader_or_Ta, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_data_source))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_data_source)));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyarrow/_flight.pyx":1208
 *         if (not isinstance(data_source, _CRecordBatchReader) and
 *                 not isinstance(data_source, lib.Table)):
 *             raise TypeError("Expected RecordBatchReader or Table, "             # <<<<<<<<<<<<<<
 *                             "but got: {}".format(type(data_source)))
 *         self.data_source = data_source
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __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(0, 1208, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1206
 *         data_source : RecordBatchReader or Table
 *         """
 *         if (not isinstance(data_source, _CRecordBatchReader) and             # <<<<<<<<<<<<<<
 *                 not isinstance(data_source, lib.Table)):
 *             raise TypeError("Expected RecordBatchReader or Table, "
 */
  }

  /* "pyarrow/_flight.pyx":1210
 *             raise TypeError("Expected RecordBatchReader or Table, "
 *                             "but got: {}".format(type(data_source)))
 *         self.data_source = data_source             # <<<<<<<<<<<<<<
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:
 */
  __Pyx_INCREF(__pyx_v_data_source);
  __Pyx_GIVEREF(__pyx_v_data_source);
  __Pyx_GOTREF(__pyx_v_self->data_source);
  __Pyx_DECREF(__pyx_v_self->data_source);
  __pyx_v_self->data_source = __pyx_v_data_source;

  /* "pyarrow/_flight.pyx":1199
 *         object data_source
 * 
 *     def __init__(self, data_source):             # <<<<<<<<<<<<<<
 *         """Create a RecordBatchStream from a data source.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight.RecordBatchStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1212
 *         self.data_source = data_source
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             shared_ptr[CRecordBatchReader] reader
 */

static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_17RecordBatchStream_to_stream(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self) {
  std::shared_ptr< arrow::RecordBatchReader>  __pyx_v_reader;
   arrow::Table *__pyx_v_table;
   arrow::flight::FlightDataStream *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  std::shared_ptr< arrow::RecordBatchReader>  __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
   arrow::Table *__pyx_t_7;
  __Pyx_RefNannySetupContext("to_stream", 0);

  /* "pyarrow/_flight.pyx":1215
 *         cdef:
 *             shared_ptr[CRecordBatchReader] reader
 *         if isinstance(self.data_source, _CRecordBatchReader):             # <<<<<<<<<<<<<<
 *             reader = (<_CRecordBatchReader> self.data_source).reader
 *         elif isinstance(self.data_source, lib.Table):
 */
  __pyx_t_1 = __pyx_v_self->data_source;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, __pyx_ptype_7pyarrow_3lib__CRecordBatchReader); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":1216
 *             shared_ptr[CRecordBatchReader] reader
 *         if isinstance(self.data_source, _CRecordBatchReader):
 *             reader = (<_CRecordBatchReader> self.data_source).reader             # <<<<<<<<<<<<<<
 *         elif isinstance(self.data_source, lib.Table):
 *             table = (<Table> self.data_source).table
 */
    __pyx_t_4 = ((struct __pyx_obj_7pyarrow_3lib__CRecordBatchReader *)__pyx_v_self->data_source)->reader;
    __pyx_v_reader = __pyx_t_4;

    /* "pyarrow/_flight.pyx":1215
 *         cdef:
 *             shared_ptr[CRecordBatchReader] reader
 *         if isinstance(self.data_source, _CRecordBatchReader):             # <<<<<<<<<<<<<<
 *             reader = (<_CRecordBatchReader> self.data_source).reader
 *         elif isinstance(self.data_source, lib.Table):
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":1217
 *         if isinstance(self.data_source, _CRecordBatchReader):
 *             reader = (<_CRecordBatchReader> self.data_source).reader
 *         elif isinstance(self.data_source, lib.Table):             # <<<<<<<<<<<<<<
 *             table = (<Table> self.data_source).table
 *             reader.reset(new TableBatchReader(deref(table)))
 */
  __pyx_t_1 = __pyx_v_self->data_source;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_lib); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Table); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_6); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (likely(__pyx_t_2)) {

    /* "pyarrow/_flight.pyx":1218
 *             reader = (<_CRecordBatchReader> self.data_source).reader
 *         elif isinstance(self.data_source, lib.Table):
 *             table = (<Table> self.data_source).table             # <<<<<<<<<<<<<<
 *             reader.reset(new TableBatchReader(deref(table)))
 *         else:
 */
    __pyx_t_7 = ((struct __pyx_obj_7pyarrow_3lib_Table *)__pyx_v_self->data_source)->table;
    __pyx_v_table = __pyx_t_7;

    /* "pyarrow/_flight.pyx":1219
 *         elif isinstance(self.data_source, lib.Table):
 *             table = (<Table> self.data_source).table
 *             reader.reset(new TableBatchReader(deref(table)))             # <<<<<<<<<<<<<<
 *         else:
 *             raise RuntimeError("Can't construct RecordBatchStream "
 */
    __pyx_v_reader.reset(new arrow::TableBatchReader((*__pyx_v_table)));

    /* "pyarrow/_flight.pyx":1217
 *         if isinstance(self.data_source, _CRecordBatchReader):
 *             reader = (<_CRecordBatchReader> self.data_source).reader
 *         elif isinstance(self.data_source, lib.Table):             # <<<<<<<<<<<<<<
 *             table = (<Table> self.data_source).table
 *             reader.reset(new TableBatchReader(deref(table)))
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":1221
 *             reader.reset(new TableBatchReader(deref(table)))
 *         else:
 *             raise RuntimeError("Can't construct RecordBatchStream "             # <<<<<<<<<<<<<<
 *                                "from type {}".format(type(self.data_source)))
 *         return new CRecordBatchStream(reader)
 */
  /*else*/ {

    /* "pyarrow/_flight.pyx":1222
 *         else:
 *             raise RuntimeError("Can't construct RecordBatchStream "
 *                                "from type {}".format(type(self.data_source)))             # <<<<<<<<<<<<<<
 *         return new CRecordBatchStream(reader)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Can_t_construct_RecordBatchStrea, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_self->data_source))) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)Py_TYPE(__pyx_v_self->data_source)));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":1221
 *             reader.reset(new TableBatchReader(deref(table)))
 *         else:
 *             raise RuntimeError("Can't construct RecordBatchStream "             # <<<<<<<<<<<<<<
 *                                "from type {}".format(type(self.data_source)))
 *         return new CRecordBatchStream(reader)
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1221, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "pyarrow/_flight.pyx":1223
 *             raise RuntimeError("Can't construct RecordBatchStream "
 *                                "from type {}".format(type(self.data_source)))
 *         return new CRecordBatchStream(reader)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = new  arrow::flight::RecordBatchStream(__pyx_v_reader);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1212
 *         self.data_source = data_source
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             shared_ptr[CRecordBatchReader] reader
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight.RecordBatchStream.to_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17RecordBatchStream_2__reduce_cython__[] = "RecordBatchStream.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_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_7pyarrow_7_flight_17RecordBatchStream_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17RecordBatchStream_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.data_source,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->data_source);
  __Pyx_GIVEREF(__pyx_v_self->data_source);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->data_source);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.data_source,)
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.data_source,)
 *     _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(1, 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(1, 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.data_source is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.data_source,)
 *     _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.data_source is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->data_source != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.data_source is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.data_source is not None
 *     if use_setstate:
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_RecordBatchStream); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_6351270);
    __Pyx_GIVEREF(__pyx_int_6351270);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_6351270);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.data_source is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, None), state
 *     else:
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_RecordBatchStream__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_RecordBatchStream); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_6351270);
    __Pyx_GIVEREF(__pyx_int_6351270);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_6351270);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.RecordBatchStream.__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_RecordBatchStream, (type(self), 0x060e9a6, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_RecordBatchStream__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17RecordBatchStream_4__setstate_cython__[] = "RecordBatchStream.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_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_7pyarrow_7_flight_17RecordBatchStream_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17RecordBatchStream_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_RecordBatchStream, (type(self), 0x060e9a6, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_RecordBatchStream__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_RecordBatchStream__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_RecordBatchStream, (type(self), 0x060e9a6, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_RecordBatchStream__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("pyarrow._flight.RecordBatchStream.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1235
 *         unique_ptr[CFlightDataStream] current_stream
 * 
 *     def __init__(self, schema, generator):             # <<<<<<<<<<<<<<
 *         """Create a GeneratorStream from a Python generator.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_15GeneratorStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_15GeneratorStream___init__[] = "Create a GeneratorStream from a Python generator.\n\n        Parameters\n        ----------\n        schema : Schema\n            The schema for the data to be returned.\n\n        generator : iterator or iterable\n            The generator should yield other FlightDataStream objects,\n            Tables, RecordBatches, or RecordBatchReaders.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7pyarrow_7_flight_15GeneratorStream___init__;
#endif
static int __pyx_pw_7pyarrow_7_flight_15GeneratorStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_schema = 0;
  PyObject *__pyx_v_generator = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_schema,&__pyx_n_s_generator,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_schema)) != 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_generator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1235, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1235, __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_schema = values[0];
    __pyx_v_generator = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.GeneratorStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_15GeneratorStream___init__(((struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)__pyx_v_self), __pyx_v_schema, __pyx_v_generator);

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

static int __pyx_pf_7pyarrow_7_flight_15GeneratorStream___init__(struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self, PyObject *__pyx_v_schema, PyObject *__pyx_v_generator) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":1247
 *             Tables, RecordBatches, or RecordBatchReaders.
 *         """
 *         self.schema = pyarrow_unwrap_schema(schema)             # <<<<<<<<<<<<<<
 *         self.generator = iter(generator)
 * 
 */
  __pyx_v_self->schema = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema(__pyx_v_schema);

  /* "pyarrow/_flight.pyx":1248
 *         """
 *         self.schema = pyarrow_unwrap_schema(schema)
 *         self.generator = iter(generator)             # <<<<<<<<<<<<<<
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:
 */
  __pyx_t_1 = PyObject_GetIter(__pyx_v_generator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->generator);
  __Pyx_DECREF(__pyx_v_self->generator);
  __pyx_v_self->generator = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1235
 *         unique_ptr[CFlightDataStream] current_stream
 * 
 *     def __init__(self, schema, generator):             # <<<<<<<<<<<<<<
 *         """Create a GeneratorStream from a Python generator.
 * 
 */

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

/* "pyarrow/_flight.pyx":1250
 *         self.generator = iter(generator)
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             function[cb_data_stream_next] callback = &_data_stream_next
 */

static  arrow::flight::FlightDataStream *__pyx_f_7pyarrow_7_flight_15GeneratorStream_to_stream(struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self) {
  std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_data_stream_next>  __pyx_v_callback;
   arrow::flight::FlightDataStream *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_stream", 0);

  /* "pyarrow/_flight.pyx":1252
 *     cdef CFlightDataStream* to_stream(self) except *:
 *         cdef:
 *             function[cb_data_stream_next] callback = &_data_stream_next             # <<<<<<<<<<<<<<
 *         return new CPyGeneratorFlightDataStream(self, self.schema, callback)
 * 
 */
  __pyx_v_callback = (&__pyx_f_7pyarrow_7_flight__data_stream_next);

  /* "pyarrow/_flight.pyx":1253
 *         cdef:
 *             function[cb_data_stream_next] callback = &_data_stream_next
 *         return new CPyGeneratorFlightDataStream(self, self.schema, callback)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = new  arrow::py::flight::PyGeneratorFlightDataStream(((PyObject *)__pyx_v_self), __pyx_v_self->schema, __pyx_v_callback);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1250
 *         self.generator = iter(generator)
 * 
 *     cdef CFlightDataStream* to_stream(self) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             function[cb_data_stream_next] callback = &_data_stream_next
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_15GeneratorStream_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_15GeneratorStream_2__reduce_cython__[] = "GeneratorStream.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_15GeneratorStream_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_7pyarrow_7_flight_15GeneratorStream_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_15GeneratorStream_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.GeneratorStream.__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("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_15GeneratorStream_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_15GeneratorStream_4__setstate_cython__[] = "GeneratorStream.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_15GeneratorStream_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_7pyarrow_7_flight_15GeneratorStream_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_15GeneratorStream_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1261
 *         const CServerCallContext* context
 * 
 *     def peer_identity(self):             # <<<<<<<<<<<<<<
 *         """Get the identity of the authenticated peer.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_1peer_identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerCallContext_peer_identity[] = "ServerCallContext.peer_identity(self)\nGet the identity of the authenticated peer.\n\n        May be the empty string.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_1peer_identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("peer_identity (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ServerCallContext_peer_identity(((struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_peer_identity(struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("peer_identity", 0);

  /* "pyarrow/_flight.pyx":1266
 *         May be the empty string.
 *         """
 *         return tobytes(self.context.peer_identity())             # <<<<<<<<<<<<<<
 * 
 *     def get_middleware(self, key):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->context->peer_identity()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1266, __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, 1266, __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;

  /* "pyarrow/_flight.pyx":1261
 *         const CServerCallContext* context
 * 
 *     def peer_identity(self):             # <<<<<<<<<<<<<<
 *         """Get the identity of the authenticated peer.
 * 
 */

  /* 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("pyarrow._flight.ServerCallContext.peer_identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1268
 *         return tobytes(self.context.peer_identity())
 * 
 *     def get_middleware(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Get a middleware instance by key.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_3get_middleware(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerCallContext_2get_middleware[] = "ServerCallContext.get_middleware(self, key)\n\n        Get a middleware instance by key.\n\n        Returns None if the middleware was not found.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_3get_middleware(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_middleware (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ServerCallContext_2get_middleware(((struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_2get_middleware(struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self, PyObject *__pyx_v_key) {
   arrow::flight::ServerMiddleware *__pyx_v_c_middleware;
   arrow::py::flight::PyServerMiddleware *__pyx_v_middleware;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_py_middleware = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  void *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_middleware", 0);

  /* "pyarrow/_flight.pyx":1276
 *         cdef:
 *             CServerMiddleware* c_middleware = \
 *                 self.context.GetMiddleware(CPyServerMiddlewareName)             # <<<<<<<<<<<<<<
 *             CPyServerMiddleware* middleware
 *         if c_middleware == NULL:
 */
  __pyx_v_c_middleware = __pyx_v_self->context->GetMiddleware( arrow::py::flight::kPyServerMiddlewareName);

  /* "pyarrow/_flight.pyx":1278
 *                 self.context.GetMiddleware(CPyServerMiddlewareName)
 *             CPyServerMiddleware* middleware
 *         if c_middleware == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         if c_middleware.name() != CPyServerMiddlewareName:
 */
  __pyx_t_1 = ((__pyx_v_c_middleware == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":1279
 *             CPyServerMiddleware* middleware
 *         if c_middleware == NULL:
 *             return None             # <<<<<<<<<<<<<<
 *         if c_middleware.name() != CPyServerMiddlewareName:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":1278
 *                 self.context.GetMiddleware(CPyServerMiddlewareName)
 *             CPyServerMiddleware* middleware
 *         if c_middleware == NULL:             # <<<<<<<<<<<<<<
 *             return None
 *         if c_middleware.name() != CPyServerMiddlewareName:
 */
  }

  /* "pyarrow/_flight.pyx":1280
 *         if c_middleware == NULL:
 *             return None
 *         if c_middleware.name() != CPyServerMiddlewareName:             # <<<<<<<<<<<<<<
 *             return None
 *         middleware = <CPyServerMiddleware*> c_middleware
 */
  __pyx_t_1 = ((__pyx_v_c_middleware->name() !=  arrow::py::flight::kPyServerMiddlewareName) != 0);
  if (__pyx_t_1) {

    /* "pyarrow/_flight.pyx":1281
 *             return None
 *         if c_middleware.name() != CPyServerMiddlewareName:
 *             return None             # <<<<<<<<<<<<<<
 *         middleware = <CPyServerMiddleware*> c_middleware
 *         py_middleware = <_ServerMiddlewareWrapper> middleware.py_object()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":1280
 *         if c_middleware == NULL:
 *             return None
 *         if c_middleware.name() != CPyServerMiddlewareName:             # <<<<<<<<<<<<<<
 *             return None
 *         middleware = <CPyServerMiddleware*> c_middleware
 */
  }

  /* "pyarrow/_flight.pyx":1282
 *         if c_middleware.name() != CPyServerMiddlewareName:
 *             return None
 *         middleware = <CPyServerMiddleware*> c_middleware             # <<<<<<<<<<<<<<
 *         py_middleware = <_ServerMiddlewareWrapper> middleware.py_object()
 *         return py_middleware.middleware.get(key)
 */
  __pyx_v_middleware = (( arrow::py::flight::PyServerMiddleware *)__pyx_v_c_middleware);

  /* "pyarrow/_flight.pyx":1283
 *             return None
 *         middleware = <CPyServerMiddleware*> c_middleware
 *         py_middleware = <_ServerMiddlewareWrapper> middleware.py_object()             # <<<<<<<<<<<<<<
 *         return py_middleware.middleware.get(key)
 * 
 */
  __pyx_t_2 = __pyx_v_middleware->py_object();
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_py_middleware = ((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":1284
 *         middleware = <CPyServerMiddleware*> c_middleware
 *         py_middleware = <_ServerMiddlewareWrapper> middleware.py_object()
 *         return py_middleware.middleware.get(key)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_py_middleware->middleware == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 1284, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_py_middleware->middleware, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1268
 *         return tobytes(self.context.peer_identity())
 * 
 *     def get_middleware(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Get a middleware instance by key.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.ServerCallContext.get_middleware", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_middleware);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1287
 * 
 *     @staticmethod
 *     cdef ServerCallContext wrap(const CServerCallContext& context):             # <<<<<<<<<<<<<<
 *         cdef ServerCallContext result = \
 *             ServerCallContext.__new__(ServerCallContext)
 */

static struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap( arrow::flight::ServerCallContext const &__pyx_v_context) {
  struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1289
 *     cdef ServerCallContext wrap(const CServerCallContext& context):
 *         cdef ServerCallContext result = \
 *             ServerCallContext.__new__(ServerCallContext)             # <<<<<<<<<<<<<<
 *         result.context = &context
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_ServerCallContext(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_ServerCallContext), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1290
 *         cdef ServerCallContext result = \
 *             ServerCallContext.__new__(ServerCallContext)
 *         result.context = &context             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->context = (&__pyx_v_context);

  /* "pyarrow/_flight.pyx":1291
 *             ServerCallContext.__new__(ServerCallContext)
 *         result.context = &context
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1287
 * 
 *     @staticmethod
 *     cdef ServerCallContext wrap(const CServerCallContext& context):             # <<<<<<<<<<<<<<
 *         cdef ServerCallContext result = \
 *             ServerCallContext.__new__(ServerCallContext)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerCallContext.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerCallContext_4__reduce_cython__[] = "ServerCallContext.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_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_7pyarrow_7_flight_17ServerCallContext_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerCallContext.__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("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerCallContext_6__setstate_cython__[] = "ServerCallContext.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerCallContext_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_7pyarrow_7_flight_17ServerCallContext_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerCallContext_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1299
 *         CServerAuthReader* reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         cdef c_string token
 *         if not self.reader:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_read[] = "ServerAuthReader.read(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ServerAuthReader_read(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_read(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self) {
  std::string __pyx_v_token;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("read", 0);

  /* "pyarrow/_flight.pyx":1301
 *     def read(self):
 *         cdef c_string token
 *         if not self.reader:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ServerAuthReader outside "
 *                              "ServerAuthHandler.authenticate")
 */
  __pyx_t_1 = ((!(__pyx_v_self->reader != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pyarrow/_flight.pyx":1302
 *         cdef c_string token
 *         if not self.reader:
 *             raise ValueError("Cannot use ServerAuthReader outside "             # <<<<<<<<<<<<<<
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1302, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1301
 *     def read(self):
 *         cdef c_string token
 *         if not self.reader:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ServerAuthReader outside "
 *                              "ServerAuthHandler.authenticate")
 */
  }

  /* "pyarrow/_flight.pyx":1304
 *             raise ValueError("Cannot use ServerAuthReader outside "
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.Read(&token))
 *         return token
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1305
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 *             check_flight_status(self.reader.Read(&token))             # <<<<<<<<<<<<<<
 *         return token
 * 
 */
        __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->reader->Read((&__pyx_v_token))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1305, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1304
 *             raise ValueError("Cannot use ServerAuthReader outside "
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.Read(&token))
 *         return token
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":1306
 *         with nogil:
 *             check_flight_status(self.reader.Read(&token))
 *         return token             # <<<<<<<<<<<<<<
 * 
 *     cdef void poison(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_token); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1299
 *         CServerAuthReader* reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         cdef c_string token
 *         if not self.reader:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthReader.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1308
 *         return token
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

static void __pyx_f_7pyarrow_7_flight_16ServerAuthReader_poison(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poison", 0);

  /* "pyarrow/_flight.pyx":1315
 *         the reference goes away.
 *         """
 *         self.reader = NULL             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_v_self->reader = NULL;

  /* "pyarrow/_flight.pyx":1308
 *         return token
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

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

/* "pyarrow/_flight.pyx":1318
 * 
 *     @staticmethod
 *     cdef ServerAuthReader wrap(CServerAuthReader* reader):             # <<<<<<<<<<<<<<
 *         cdef ServerAuthReader result = \
 *             ServerAuthReader.__new__(ServerAuthReader)
 */

static struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_f_7pyarrow_7_flight_16ServerAuthReader_wrap( arrow::flight::ServerAuthReader *__pyx_v_reader) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1320
 *     cdef ServerAuthReader wrap(CServerAuthReader* reader):
 *         cdef ServerAuthReader result = \
 *             ServerAuthReader.__new__(ServerAuthReader)             # <<<<<<<<<<<<<<
 *         result.reader = reader
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_ServerAuthReader(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_ServerAuthReader), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1321
 *         cdef ServerAuthReader result = \
 *             ServerAuthReader.__new__(ServerAuthReader)
 *         result.reader = reader             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->reader = __pyx_v_reader;

  /* "pyarrow/_flight.pyx":1322
 *             ServerAuthReader.__new__(ServerAuthReader)
 *         result.reader = reader
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1318
 * 
 *     @staticmethod
 *     cdef ServerAuthReader wrap(CServerAuthReader* reader):             # <<<<<<<<<<<<<<
 *         cdef ServerAuthReader result = \
 *             ServerAuthReader.__new__(ServerAuthReader)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthReader.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_2__reduce_cython__[] = "ServerAuthReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_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_7pyarrow_7_flight_16ServerAuthReader_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_4__setstate_cython__[] = "ServerAuthReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_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_7pyarrow_7_flight_16ServerAuthReader_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1330
 *         CServerAuthSender* sender
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_write[] = "ServerAuthSender.write(self, message)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ServerAuthSender_write(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_self), ((PyObject *)__pyx_v_message));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_write(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self, PyObject *__pyx_v_message) {
  std::string __pyx_v_c_message;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("write", 0);

  /* "pyarrow/_flight.pyx":1331
 * 
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)             # <<<<<<<<<<<<<<
 *         if not self.sender:
 *             raise ValueError("Cannot use ServerAuthSender outside "
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_message);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_c_message = __pyx_t_4;

  /* "pyarrow/_flight.pyx":1332
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ServerAuthSender outside "
 *                              "ServerAuthHandler.authenticate")
 */
  __pyx_t_5 = ((!(__pyx_v_self->sender != 0)) != 0);
  if (unlikely(__pyx_t_5)) {

    /* "pyarrow/_flight.pyx":1333
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 *             raise ValueError("Cannot use ServerAuthSender outside "             # <<<<<<<<<<<<<<
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1333, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1332
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ServerAuthSender outside "
 *                              "ServerAuthHandler.authenticate")
 */
  }

  /* "pyarrow/_flight.pyx":1335
 *             raise ValueError("Cannot use ServerAuthSender outside "
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.sender.Write(c_message))
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1336
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 *             check_flight_status(self.sender.Write(c_message))             # <<<<<<<<<<<<<<
 * 
 *     cdef void poison(self):
 */
        __pyx_t_6 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->sender->Write(__pyx_v_c_message)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1336, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1335
 *             raise ValueError("Cannot use ServerAuthSender outside "
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.sender.Write(c_message))
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":1330
 *         CServerAuthSender* sender
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 */

  /* 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("pyarrow._flight.ServerAuthSender.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1338
 *             check_flight_status(self.sender.Write(c_message))
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

static void __pyx_f_7pyarrow_7_flight_16ServerAuthSender_poison(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poison", 0);

  /* "pyarrow/_flight.pyx":1345
 *         the reference goes away.
 *         """
 *         self.sender = NULL             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_v_self->sender = NULL;

  /* "pyarrow/_flight.pyx":1338
 *             check_flight_status(self.sender.Write(c_message))
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

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

/* "pyarrow/_flight.pyx":1348
 * 
 *     @staticmethod
 *     cdef ServerAuthSender wrap(CServerAuthSender* sender):             # <<<<<<<<<<<<<<
 *         cdef ServerAuthSender result = \
 *             ServerAuthSender.__new__(ServerAuthSender)
 */

static struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_f_7pyarrow_7_flight_16ServerAuthSender_wrap( arrow::flight::ServerAuthSender *__pyx_v_sender) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1350
 *     cdef ServerAuthSender wrap(CServerAuthSender* sender):
 *         cdef ServerAuthSender result = \
 *             ServerAuthSender.__new__(ServerAuthSender)             # <<<<<<<<<<<<<<
 *         result.sender = sender
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_ServerAuthSender(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_ServerAuthSender), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1351
 *         cdef ServerAuthSender result = \
 *             ServerAuthSender.__new__(ServerAuthSender)
 *         result.sender = sender             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->sender = __pyx_v_sender;

  /* "pyarrow/_flight.pyx":1352
 *             ServerAuthSender.__new__(ServerAuthSender)
 *         result.sender = sender
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1348
 * 
 *     @staticmethod
 *     cdef ServerAuthSender wrap(CServerAuthSender* sender):             # <<<<<<<<<<<<<<
 *         cdef ServerAuthSender result = \
 *             ServerAuthSender.__new__(ServerAuthSender)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthSender.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_2__reduce_cython__[] = "ServerAuthSender.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_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_7pyarrow_7_flight_16ServerAuthSender_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthSender.__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("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_4__setstate_cython__[] = "ServerAuthSender.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_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_7pyarrow_7_flight_16ServerAuthSender_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerAuthSender_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1360
 *         CClientAuthReader* reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         cdef c_string token
 *         if not self.reader:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_read[] = "ClientAuthReader.read(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientAuthReader_read(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_read(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self) {
  std::string __pyx_v_token;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("read", 0);

  /* "pyarrow/_flight.pyx":1362
 *     def read(self):
 *         cdef c_string token
 *         if not self.reader:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ClientAuthReader outside "
 *                              "ClientAuthHandler.authenticate")
 */
  __pyx_t_1 = ((!(__pyx_v_self->reader != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pyarrow/_flight.pyx":1363
 *         cdef c_string token
 *         if not self.reader:
 *             raise ValueError("Cannot use ClientAuthReader outside "             # <<<<<<<<<<<<<<
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1363, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1362
 *     def read(self):
 *         cdef c_string token
 *         if not self.reader:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ClientAuthReader outside "
 *                              "ClientAuthHandler.authenticate")
 */
  }

  /* "pyarrow/_flight.pyx":1365
 *             raise ValueError("Cannot use ClientAuthReader outside "
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.Read(&token))
 *         return token
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1366
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 *             check_flight_status(self.reader.Read(&token))             # <<<<<<<<<<<<<<
 *         return token
 * 
 */
        __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->reader->Read((&__pyx_v_token))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1366, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1365
 *             raise ValueError("Cannot use ClientAuthReader outside "
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.reader.Read(&token))
 *         return token
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":1367
 *         with nogil:
 *             check_flight_status(self.reader.Read(&token))
 *         return token             # <<<<<<<<<<<<<<
 * 
 *     cdef void poison(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_token); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1360
 *         CClientAuthReader* reader
 * 
 *     def read(self):             # <<<<<<<<<<<<<<
 *         cdef c_string token
 *         if not self.reader:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthReader.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1369
 *         return token
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

static void __pyx_f_7pyarrow_7_flight_16ClientAuthReader_poison(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poison", 0);

  /* "pyarrow/_flight.pyx":1376
 *         the reference goes away.
 *         """
 *         self.reader = NULL             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_v_self->reader = NULL;

  /* "pyarrow/_flight.pyx":1369
 *         return token
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

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

/* "pyarrow/_flight.pyx":1379
 * 
 *     @staticmethod
 *     cdef ClientAuthReader wrap(CClientAuthReader* reader):             # <<<<<<<<<<<<<<
 *         cdef ClientAuthReader result = \
 *             ClientAuthReader.__new__(ClientAuthReader)
 */

static struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_f_7pyarrow_7_flight_16ClientAuthReader_wrap( arrow::flight::ClientAuthReader *__pyx_v_reader) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1381
 *     cdef ClientAuthReader wrap(CClientAuthReader* reader):
 *         cdef ClientAuthReader result = \
 *             ClientAuthReader.__new__(ClientAuthReader)             # <<<<<<<<<<<<<<
 *         result.reader = reader
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_ClientAuthReader(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_ClientAuthReader), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1382
 *         cdef ClientAuthReader result = \
 *             ClientAuthReader.__new__(ClientAuthReader)
 *         result.reader = reader             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->reader = __pyx_v_reader;

  /* "pyarrow/_flight.pyx":1383
 *             ClientAuthReader.__new__(ClientAuthReader)
 *         result.reader = reader
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1379
 * 
 *     @staticmethod
 *     cdef ClientAuthReader wrap(CClientAuthReader* reader):             # <<<<<<<<<<<<<<
 *         cdef ClientAuthReader result = \
 *             ClientAuthReader.__new__(ClientAuthReader)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthReader.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_2__reduce_cython__[] = "ClientAuthReader.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_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_7pyarrow_7_flight_16ClientAuthReader_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthReader.__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("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_4__setstate_cython__[] = "ClientAuthReader.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_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_7pyarrow_7_flight_16ClientAuthReader_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthReader_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1391
 *         CClientAuthSender* sender
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_write[] = "ClientAuthSender.write(self, message)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_1write(PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientAuthSender_write(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_self), ((PyObject *)__pyx_v_message));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_write(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self, PyObject *__pyx_v_message) {
  std::string __pyx_v_c_message;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  std::string __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("write", 0);

  /* "pyarrow/_flight.pyx":1392
 * 
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)             # <<<<<<<<<<<<<<
 *         if not self.sender:
 *             raise ValueError("Cannot use ClientAuthSender outside "
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_message);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_c_message = __pyx_t_4;

  /* "pyarrow/_flight.pyx":1393
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ClientAuthSender outside "
 *                              "ClientAuthHandler.authenticate")
 */
  __pyx_t_5 = ((!(__pyx_v_self->sender != 0)) != 0);
  if (unlikely(__pyx_t_5)) {

    /* "pyarrow/_flight.pyx":1394
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 *             raise ValueError("Cannot use ClientAuthSender outside "             # <<<<<<<<<<<<<<
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1394, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1393
 *     def write(self, message):
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot use ClientAuthSender outside "
 *                              "ClientAuthHandler.authenticate")
 */
  }

  /* "pyarrow/_flight.pyx":1396
 *             raise ValueError("Cannot use ClientAuthSender outside "
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.sender.Write(c_message))
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1397
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 *             check_flight_status(self.sender.Write(c_message))             # <<<<<<<<<<<<<<
 * 
 *     cdef void poison(self):
 */
        __pyx_t_6 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->sender->Write(__pyx_v_c_message)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1397, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":1396
 *             raise ValueError("Cannot use ClientAuthSender outside "
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.sender.Write(c_message))
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":1391
 *         CClientAuthSender* sender
 * 
 *     def write(self, message):             # <<<<<<<<<<<<<<
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 */

  /* 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("pyarrow._flight.ClientAuthSender.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1399
 *             check_flight_status(self.sender.Write(c_message))
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

static void __pyx_f_7pyarrow_7_flight_16ClientAuthSender_poison(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poison", 0);

  /* "pyarrow/_flight.pyx":1406
 *         the reference goes away.
 *         """
 *         self.sender = NULL             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_v_self->sender = NULL;

  /* "pyarrow/_flight.pyx":1399
 *             check_flight_status(self.sender.Write(c_message))
 * 
 *     cdef void poison(self):             # <<<<<<<<<<<<<<
 *         """Prevent further usage of this object.
 * 
 */

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

/* "pyarrow/_flight.pyx":1409
 * 
 *     @staticmethod
 *     cdef ClientAuthSender wrap(CClientAuthSender* sender):             # <<<<<<<<<<<<<<
 *         cdef ClientAuthSender result = \
 *             ClientAuthSender.__new__(ClientAuthSender)
 */

static struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_f_7pyarrow_7_flight_16ClientAuthSender_wrap( arrow::flight::ClientAuthSender *__pyx_v_sender) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_result = 0;
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1411
 *     cdef ClientAuthSender wrap(CClientAuthSender* sender):
 *         cdef ClientAuthSender result = \
 *             ClientAuthSender.__new__(ClientAuthSender)             # <<<<<<<<<<<<<<
 *         result.sender = sender
 *         return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_ClientAuthSender(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_ClientAuthSender), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = ((struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1412
 *         cdef ClientAuthSender result = \
 *             ClientAuthSender.__new__(ClientAuthSender)
 *         result.sender = sender             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_v_result->sender = __pyx_v_sender;

  /* "pyarrow/_flight.pyx":1413
 *             ClientAuthSender.__new__(ClientAuthSender)
 *         result.sender = sender
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1409
 * 
 *     @staticmethod
 *     cdef ClientAuthSender wrap(CClientAuthSender* sender):             # <<<<<<<<<<<<<<
 *         cdef ClientAuthSender result = \
 *             ClientAuthSender.__new__(ClientAuthSender)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthSender.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_2__reduce_cython__[] = "ClientAuthSender.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_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_7pyarrow_7_flight_16ClientAuthSender_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthSender.__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("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_4__setstate_cython__[] = "ClientAuthSender.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_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_7pyarrow_7_flight_16ClientAuthSender_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientAuthSender_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":1416
 * 
 * 
 * cdef CStatus _data_stream_next(void* self, CFlightPayload* payload) except *:             # <<<<<<<<<<<<<<
 *     """Callback for implementing FlightDataStream in Python."""
 *     cdef:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__data_stream_next(void *__pyx_v_self,  arrow::flight::FlightPayload *__pyx_v_payload) {
  std::unique_ptr< arrow::flight::FlightDataStream>  __pyx_v_data_stream;
   arrow::ipc::IpcOptions __pyx_v_c_ipc_options;
  PyObject *__pyx_v_py_stream = NULL;
  struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *__pyx_v_stream = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  PyObject *__pyx_v_metadata = NULL;
  PyObject *__pyx_v_stream_schema = NULL;
  PyObject *__pyx_v_substream_schema = NULL;
  struct __pyx_obj_7pyarrow_3lib_RecordBatch *__pyx_v_batch = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __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;
  arrow::Status __pyx_t_10;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
   arrow::flight::FlightDataStream *__pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("_data_stream_next", 0);

  /* "pyarrow/_flight.pyx":1421
 *         unique_ptr[CFlightDataStream] data_stream
 *         # TODO make it possible to pass IPC options around?
 *         cdef CIpcOptions c_ipc_options = CIpcOptions.Defaults()             # <<<<<<<<<<<<<<
 * 
 *     py_stream = <object> self
 */
  __pyx_v_c_ipc_options =  arrow::ipc::IpcOptions::Defaults();

  /* "pyarrow/_flight.pyx":1423
 *         cdef CIpcOptions c_ipc_options = CIpcOptions.Defaults()
 * 
 *     py_stream = <object> self             # <<<<<<<<<<<<<<
 *     if not isinstance(py_stream, GeneratorStream):
 *         raise RuntimeError("self object in callback is not GeneratorStream")
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_py_stream = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1424
 * 
 *     py_stream = <object> self
 *     if not isinstance(py_stream, GeneratorStream):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("self object in callback is not GeneratorStream")
 *     stream = <GeneratorStream> py_stream
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_py_stream, __pyx_ptype_7pyarrow_7_flight_GeneratorStream); 
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyarrow/_flight.pyx":1425
 *     py_stream = <object> self
 *     if not isinstance(py_stream, GeneratorStream):
 *         raise RuntimeError("self object in callback is not GeneratorStream")             # <<<<<<<<<<<<<<
 *     stream = <GeneratorStream> py_stream
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1425, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1424
 * 
 *     py_stream = <object> self
 *     if not isinstance(py_stream, GeneratorStream):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("self object in callback is not GeneratorStream")
 *     stream = <GeneratorStream> py_stream
 */
  }

  /* "pyarrow/_flight.pyx":1426
 *     if not isinstance(py_stream, GeneratorStream):
 *         raise RuntimeError("self object in callback is not GeneratorStream")
 *     stream = <GeneratorStream> py_stream             # <<<<<<<<<<<<<<
 * 
 *     if stream.current_stream != nullptr:
 */
  __pyx_t_1 = __pyx_v_py_stream;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_stream = ((struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1428
 *     stream = <GeneratorStream> py_stream
 * 
 *     if stream.current_stream != nullptr:             # <<<<<<<<<<<<<<
 *         check_flight_status(stream.current_stream.get().Next(payload))
 *         # If the stream ended, see if there's another stream from the
 */
  __pyx_t_3 = ((__pyx_v_stream->current_stream != nullptr) != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":1429
 * 
 *     if stream.current_stream != nullptr:
 *         check_flight_status(stream.current_stream.get().Next(payload))             # <<<<<<<<<<<<<<
 *         # If the stream ended, see if there's another stream from the
 *         # generator
 */
    __pyx_t_4 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_stream->current_stream.get()->Next(__pyx_v_payload)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1429, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1432
 *         # If the stream ended, see if there's another stream from the
 *         # generator
 *         if payload.ipc_message.metadata != nullptr:             # <<<<<<<<<<<<<<
 *             return CStatus_OK()
 *         stream.current_stream.reset(nullptr)
 */
    __pyx_t_3 = ((__pyx_v_payload->ipc_message.metadata != nullptr) != 0);
    if (__pyx_t_3) {

      /* "pyarrow/_flight.pyx":1433
 *         # generator
 *         if payload.ipc_message.metadata != nullptr:
 *             return CStatus_OK()             # <<<<<<<<<<<<<<
 *         stream.current_stream.reset(nullptr)
 * 
 */
      __pyx_r = arrow::Status::OK();
      goto __pyx_L0;

      /* "pyarrow/_flight.pyx":1432
 *         # If the stream ended, see if there's another stream from the
 *         # generator
 *         if payload.ipc_message.metadata != nullptr:             # <<<<<<<<<<<<<<
 *             return CStatus_OK()
 *         stream.current_stream.reset(nullptr)
 */
    }

    /* "pyarrow/_flight.pyx":1434
 *         if payload.ipc_message.metadata != nullptr:
 *             return CStatus_OK()
 *         stream.current_stream.reset(nullptr)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_v_stream->current_stream.reset(nullptr);

    /* "pyarrow/_flight.pyx":1428
 *     stream = <GeneratorStream> py_stream
 * 
 *     if stream.current_stream != nullptr:             # <<<<<<<<<<<<<<
 *         check_flight_status(stream.current_stream.get().Next(payload))
 *         # If the stream ended, see if there's another stream from the
 */
  }

  /* "pyarrow/_flight.pyx":1436
 *         stream.current_stream.reset(nullptr)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = next(stream.generator)
 *     except StopIteration:
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1437
 * 
 *     try:
 *         result = next(stream.generator)             # <<<<<<<<<<<<<<
 *     except StopIteration:
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)
 */
      __pyx_t_1 = __pyx_v_stream->generator;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1437, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_result = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "pyarrow/_flight.pyx":1436
 *         stream.current_stream.reset(nullptr)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = next(stream.generator)
 *     except StopIteration:
 */
    }
    __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_L11_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1438
 *     try:
 *         result = next(stream.generator)
 *     except StopIteration:             # <<<<<<<<<<<<<<
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)
 *         return CStatus_OK()
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("pyarrow._flight._data_stream_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 1438, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_9);

      /* "pyarrow/_flight.pyx":1439
 *         result = next(stream.generator)
 *     except StopIteration:
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)             # <<<<<<<<<<<<<<
 *         return CStatus_OK()
 *     except FlightError as flight_error:
 */
      __pyx_v_payload->ipc_message.metadata.reset((( arrow::Buffer *)nullptr));

      /* "pyarrow/_flight.pyx":1440
 *     except StopIteration:
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)
 *         return CStatus_OK()             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_r = arrow::Status::OK();
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L9_except_return;
    }

    /* "pyarrow/_flight.pyx":1441
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)
 *         return CStatus_OK()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("pyarrow._flight._data_stream_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 1441, __pyx_L8_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_flight_error = __pyx_t_1;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1442
 *         return CStatus_OK()
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(result, (list, tuple)):
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L18_return;
      }

      /* "pyarrow/_flight.pyx":1441
 *         payload.ipc_message.metadata.reset(<CBuffer*> nullptr)
 *         return CStatus_OK()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
      /*finally:*/ {
        __pyx_L18_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L9_except_return;
        }
      }
    }
    goto __pyx_L8_except_error;
    __pyx_L8_except_error:;

    /* "pyarrow/_flight.pyx":1436
 *         stream.current_stream.reset(nullptr)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = next(stream.generator)
 *     except StopIteration:
 */
    __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_L9_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_L11_try_end:;
  }

  /* "pyarrow/_flight.pyx":1444
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if isinstance(result, (list, tuple)):             # <<<<<<<<<<<<<<
 *         result, metadata = result
 *     else:
 */
  __pyx_t_2 = PyList_Check(__pyx_v_result); 
  __pyx_t_11 = (__pyx_t_2 != 0);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_3 = __pyx_t_11;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_11 = PyTuple_Check(__pyx_v_result); 
  __pyx_t_2 = (__pyx_t_11 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L22_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":1445
 * 
 *     if isinstance(result, (list, tuple)):
 *         result, metadata = result             # <<<<<<<<<<<<<<
 *     else:
 *         result, metadata = result, None
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_result))) || (PyList_CheckExact(__pyx_v_result))) {
      PyObject* sequence = __pyx_v_result;
      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, 1445, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L24_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L24_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_9), 2) < 0) __PYX_ERR(0, 1445, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L25_unpacking_done;
      __pyx_L24_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1445, __pyx_L1_error)
      __pyx_L25_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_v_metadata = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":1444
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if isinstance(result, (list, tuple)):             # <<<<<<<<<<<<<<
 *         result, metadata = result
 *     else:
 */
    goto __pyx_L21;
  }

  /* "pyarrow/_flight.pyx":1447
 *         result, metadata = result
 *     else:
 *         result, metadata = result, None             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(result, (Table, _CRecordBatchReader)):
 */
  /*else*/ {
    __pyx_t_1 = __pyx_v_result;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_8 = Py_None;
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_metadata = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_L21:;

  /* "pyarrow/_flight.pyx":1449
 *         result, metadata = result, None
 * 
 *     if isinstance(result, (Table, _CRecordBatchReader)):             # <<<<<<<<<<<<<<
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_3lib_Table); 
  __pyx_t_11 = (__pyx_t_3 != 0);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_2 = __pyx_t_11;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_3lib__CRecordBatchReader); 
  __pyx_t_3 = (__pyx_t_11 != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L27_bool_binop_done:;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":1450
 * 
 *     if isinstance(result, (Table, _CRecordBatchReader)):
 *         if metadata:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_metadata); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1450, __pyx_L1_error)
    if (unlikely(__pyx_t_3)) {

      /* "pyarrow/_flight.pyx":1451
 *     if isinstance(result, (Table, _CRecordBatchReader)):
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "             # <<<<<<<<<<<<<<
 *                              "RecordBatch.")
 *         result = RecordBatchStream(result)
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 1451, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":1450
 * 
 *     if isinstance(result, (Table, _CRecordBatchReader)):
 *         if metadata:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 */
    }

    /* "pyarrow/_flight.pyx":1453
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 *         result = RecordBatchStream(result)             # <<<<<<<<<<<<<<
 * 
 *     stream_schema = pyarrow_wrap_schema(stream.schema)
 */
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_RecordBatchStream), __pyx_v_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1449
 *         result, metadata = result, None
 * 
 *     if isinstance(result, (Table, _CRecordBatchReader)):             # <<<<<<<<<<<<<<
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "
 */
  }

  /* "pyarrow/_flight.pyx":1455
 *         result = RecordBatchStream(result)
 * 
 *     stream_schema = pyarrow_wrap_schema(stream.schema)             # <<<<<<<<<<<<<<
 *     if isinstance(result, FlightDataStream):
 *         if metadata:
 */
  __pyx_t_8 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_stream->schema); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_stream_schema = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyarrow/_flight.pyx":1456
 * 
 *     stream_schema = pyarrow_wrap_schema(stream.schema)
 *     if isinstance(result, FlightDataStream):             # <<<<<<<<<<<<<<
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "
 */
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_7_flight_FlightDataStream); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":1457
 *     stream_schema = pyarrow_wrap_schema(stream.schema)
 *     if isinstance(result, FlightDataStream):
 *         if metadata:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_metadata); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1457, __pyx_L1_error)
    if (unlikely(__pyx_t_2)) {

      /* "pyarrow/_flight.pyx":1458
 *     if isinstance(result, FlightDataStream):
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "             # <<<<<<<<<<<<<<
 *                              "RecordBatch.")
 *         data_stream = unique_ptr[CFlightDataStream](
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 1458, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":1457
 *     stream_schema = pyarrow_wrap_schema(stream.schema)
 *     if isinstance(result, FlightDataStream):
 *         if metadata:             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 */
    }

    /* "pyarrow/_flight.pyx":1461
 *                              "RecordBatch.")
 *         data_stream = unique_ptr[CFlightDataStream](
 *             (<FlightDataStream> result).to_stream())             # <<<<<<<<<<<<<<
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())
 *         if substream_schema != stream_schema:
 */
    __pyx_t_13 = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream *)((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_result)->__pyx_vtab)->to_stream(((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1461, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1460
 *             raise ValueError("Can only return metadata alongside a "
 *                              "RecordBatch.")
 *         data_stream = unique_ptr[CFlightDataStream](             # <<<<<<<<<<<<<<
 *             (<FlightDataStream> result).to_stream())
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())
 */
    __pyx_v_data_stream = std::unique_ptr< arrow::flight::FlightDataStream> (__pyx_t_13);

    /* "pyarrow/_flight.pyx":1462
 *         data_stream = unique_ptr[CFlightDataStream](
 *             (<FlightDataStream> result).to_stream())
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())             # <<<<<<<<<<<<<<
 *         if substream_schema != stream_schema:
 *             raise ValueError("Got a FlightDataStream whose schema does not "
 */
    __pyx_t_8 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_data_stream.get()->schema()); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_substream_schema = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1463
 *             (<FlightDataStream> result).to_stream())
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())
 *         if substream_schema != stream_schema:             # <<<<<<<<<<<<<<
 *             raise ValueError("Got a FlightDataStream whose schema does not "
 *                              "match the declared schema of this "
 */
    __pyx_t_8 = PyObject_RichCompare(__pyx_v_substream_schema, __pyx_v_stream_schema, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1463, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1463, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "pyarrow/_flight.pyx":1467
 *                              "match the declared schema of this "
 *                              "GeneratorStream. "
 *                              "Got: {}\nExpected: {}".format(substream_schema,             # <<<<<<<<<<<<<<
 *                                                             stream_schema))
 *         stream.current_stream.reset(
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Got_a_FlightDataStream_whose_sch, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyarrow/_flight.pyx":1468
 *                              "GeneratorStream. "
 *                              "Got: {}\nExpected: {}".format(substream_schema,
 *                                                             stream_schema))             # <<<<<<<<<<<<<<
 *         stream.current_stream.reset(
 *             new CPyFlightDataStream(result, move(data_stream)))
 */
      __pyx_t_9 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(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_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_substream_schema, __pyx_v_stream_schema};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __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_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_substream_schema, __pyx_v_stream_schema};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_v_substream_schema);
        __Pyx_GIVEREF(__pyx_v_substream_schema);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_v_substream_schema);
        __Pyx_INCREF(__pyx_v_stream_schema);
        __Pyx_GIVEREF(__pyx_v_stream_schema);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_v_stream_schema);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1464
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())
 *         if substream_schema != stream_schema:
 *             raise ValueError("Got a FlightDataStream whose schema does not "             # <<<<<<<<<<<<<<
 *                              "match the declared schema of this "
 *                              "GeneratorStream. "
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1464, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":1463
 *             (<FlightDataStream> result).to_stream())
 *         substream_schema = pyarrow_wrap_schema(data_stream.get().schema())
 *         if substream_schema != stream_schema:             # <<<<<<<<<<<<<<
 *             raise ValueError("Got a FlightDataStream whose schema does not "
 *                              "match the declared schema of this "
 */
    }

    /* "pyarrow/_flight.pyx":1469
 *                              "Got: {}\nExpected: {}".format(substream_schema,
 *                                                             stream_schema))
 *         stream.current_stream.reset(             # <<<<<<<<<<<<<<
 *             new CPyFlightDataStream(result, move(data_stream)))
 *         return _data_stream_next(self, payload)
 */
    __pyx_v_stream->current_stream.reset(new  arrow::py::flight::PyFlightDataStream(__pyx_v_result,  cymove::cymove<std::unique_ptr< arrow::flight::FlightDataStream> >(__pyx_v_data_stream)));

    /* "pyarrow/_flight.pyx":1471
 *         stream.current_stream.reset(
 *             new CPyFlightDataStream(result, move(data_stream)))
 *         return _data_stream_next(self, payload)             # <<<<<<<<<<<<<<
 *     elif isinstance(result, RecordBatch):
 *         batch = <RecordBatch> result
 */
    __pyx_t_10 = __pyx_f_7pyarrow_7_flight__data_stream_next(__pyx_v_self, __pyx_v_payload); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1471, __pyx_L1_error)
    __pyx_r = __pyx_t_10;
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":1456
 * 
 *     stream_schema = pyarrow_wrap_schema(stream.schema)
 *     if isinstance(result, FlightDataStream):             # <<<<<<<<<<<<<<
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "
 */
  }

  /* "pyarrow/_flight.pyx":1472
 *             new CPyFlightDataStream(result, move(data_stream)))
 *         return _data_stream_next(self, payload)
 *     elif isinstance(result, RecordBatch):             # <<<<<<<<<<<<<<
 *         batch = <RecordBatch> result
 *         if batch.schema != stream_schema:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_3lib_RecordBatch); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_3)) {

    /* "pyarrow/_flight.pyx":1473
 *         return _data_stream_next(self, payload)
 *     elif isinstance(result, RecordBatch):
 *         batch = <RecordBatch> result             # <<<<<<<<<<<<<<
 *         if batch.schema != stream_schema:
 *             raise ValueError("Got a RecordBatch whose schema does not "
 */
    __pyx_t_1 = __pyx_v_result;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_batch = ((struct __pyx_obj_7pyarrow_3lib_RecordBatch *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":1474
 *     elif isinstance(result, RecordBatch):
 *         batch = <RecordBatch> result
 *         if batch.schema != stream_schema:             # <<<<<<<<<<<<<<
 *             raise ValueError("Got a RecordBatch whose schema does not "
 *                              "match the declared schema of this "
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_batch), __pyx_n_s_schema); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_v_stream_schema, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_t_3)) {

      /* "pyarrow/_flight.pyx":1478
 *                              "match the declared schema of this "
 *                              "GeneratorStream. "
 *                              "Got: {}\nExpected: {}".format(batch.schema,             # <<<<<<<<<<<<<<
 *                                                             stream_schema))
 *         check_flight_status(GetRecordBatchPayload(
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Got_a_RecordBatch_whose_schema_d, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_batch), __pyx_n_s_schema); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);

      /* "pyarrow/_flight.pyx":1479
 *                              "GeneratorStream. "
 *                              "Got: {}\nExpected: {}".format(batch.schema,
 *                                                             stream_schema))             # <<<<<<<<<<<<<<
 *         check_flight_status(GetRecordBatchPayload(
 *             deref(batch.batch),
 */
      __pyx_t_9 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && likely(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_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_14, __pyx_v_stream_schema};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1478, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_14, __pyx_v_stream_schema};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1478, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_4, __pyx_t_14);
        __Pyx_INCREF(__pyx_v_stream_schema);
        __Pyx_GIVEREF(__pyx_v_stream_schema);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_4, __pyx_v_stream_schema);
        __pyx_t_14 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1475
 *         batch = <RecordBatch> result
 *         if batch.schema != stream_schema:
 *             raise ValueError("Got a RecordBatch whose schema does not "             # <<<<<<<<<<<<<<
 *                              "match the declared schema of this "
 *                              "GeneratorStream. "
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1475, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1475, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":1474
 *     elif isinstance(result, RecordBatch):
 *         batch = <RecordBatch> result
 *         if batch.schema != stream_schema:             # <<<<<<<<<<<<<<
 *             raise ValueError("Got a RecordBatch whose schema does not "
 *                              "match the declared schema of this "
 */
    }

    /* "pyarrow/_flight.pyx":1480
 *                              "Got: {}\nExpected: {}".format(batch.schema,
 *                                                             stream_schema))
 *         check_flight_status(GetRecordBatchPayload(             # <<<<<<<<<<<<<<
 *             deref(batch.batch),
 *             c_ipc_options,
 */
    __pyx_t_4 = __pyx_f_7pyarrow_7_flight_check_flight_status( arrow::ipc::internal::GetRecordBatchPayload((*__pyx_v_batch->batch), __pyx_v_c_ipc_options,  arrow::default_memory_pool(), (&__pyx_v_payload->ipc_message))); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1480, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1485
 *             c_default_memory_pool(),
 *             &payload.ipc_message))
 *         if metadata:             # <<<<<<<<<<<<<<
 *             payload.app_metadata = pyarrow_unwrap_buffer(as_buffer(metadata))
 *     else:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_metadata); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1485, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "pyarrow/_flight.pyx":1486
 *             &payload.ipc_message))
 *         if metadata:
 *             payload.app_metadata = pyarrow_unwrap_buffer(as_buffer(metadata))             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("GeneratorStream must be initialized with "
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_as_buffer); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_15 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_15, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_metadata);
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_payload->app_metadata = __pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1485
 *             c_default_memory_pool(),
 *             &payload.ipc_message))
 *         if metadata:             # <<<<<<<<<<<<<<
 *             payload.app_metadata = pyarrow_unwrap_buffer(as_buffer(metadata))
 *     else:
 */
    }

    /* "pyarrow/_flight.pyx":1472
 *             new CPyFlightDataStream(result, move(data_stream)))
 *         return _data_stream_next(self, payload)
 *     elif isinstance(result, RecordBatch):             # <<<<<<<<<<<<<<
 *         batch = <RecordBatch> result
 *         if batch.schema != stream_schema:
 */
    goto __pyx_L30;
  }

  /* "pyarrow/_flight.pyx":1488
 *             payload.app_metadata = pyarrow_unwrap_buffer(as_buffer(metadata))
 *     else:
 *         raise TypeError("GeneratorStream must be initialized with "             # <<<<<<<<<<<<<<
 *                         "an iterator of FlightDataStream, Table, "
 *                         "RecordBatch, or RecordBatchStreamReader objects, "
 */
  /*else*/ {

    /* "pyarrow/_flight.pyx":1491
 *                         "an iterator of FlightDataStream, Table, "
 *                         "RecordBatch, or RecordBatchStreamReader objects, "
 *                         "not {}.".format(type(result)))             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_GeneratorStream_must_be_initiali, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_15, ((PyObject *)Py_TYPE(__pyx_v_result))) : __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)Py_TYPE(__pyx_v_result)));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1488
 *             payload.app_metadata = pyarrow_unwrap_buffer(as_buffer(metadata))
 *     else:
 *         raise TypeError("GeneratorStream must be initialized with "             # <<<<<<<<<<<<<<
 *                         "an iterator of FlightDataStream, Table, "
 *                         "RecordBatch, or RecordBatchStreamReader objects, "
 */
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1488, __pyx_L1_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(0, 1488, __pyx_L1_error)
  }
  __pyx_L30:;

  /* "pyarrow/_flight.pyx":1492
 *                         "RecordBatch, or RecordBatchStreamReader objects, "
 *                         "not {}.".format(type(result)))
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1416
 * 
 * 
 * cdef CStatus _data_stream_next(void* self, CFlightPayload* payload) except *:             # <<<<<<<<<<<<<<
 *     """Callback for implementing FlightDataStream in Python."""
 *     cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pyarrow._flight._data_stream_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_stream);
  __Pyx_XDECREF((PyObject *)__pyx_v_stream);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_XDECREF(__pyx_v_metadata);
  __Pyx_XDECREF(__pyx_v_stream_schema);
  __Pyx_XDECREF(__pyx_v_substream_schema);
  __Pyx_XDECREF((PyObject *)__pyx_v_batch);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1495
 * 
 * 
 * cdef CStatus _list_flights(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                            const CCriteria* c_criteria,
 *                            unique_ptr[CFlightListing]* listing) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__list_flights(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context,  arrow::flight::Criteria const *__pyx_v_c_criteria, std::unique_ptr< arrow::flight::FlightListing>  *__pyx_v_listing) {
  std::vector< arrow::flight::FlightInfo>  __pyx_v_flights;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  arrow::Status __pyx_t_15;
  __Pyx_RefNannySetupContext("_list_flights", 0);

  /* "pyarrow/_flight.pyx":1502
 *         vector[CFlightInfo] flights
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1503
 * 
 *     try:
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),             # <<<<<<<<<<<<<<
 *                                               c_criteria.expression)
 *         for info in result:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_list_flights); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1503, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1503, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "pyarrow/_flight.pyx":1504
 *     try:
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)             # <<<<<<<<<<<<<<
 *         for info in result:
 *             if not isinstance(info, FlightInfo):
 */
      __pyx_t_7 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_c_criteria->expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1504, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      __pyx_t_9 = 0;
      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_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1503, __pyx_L3_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_6);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1505
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)
 *         for info in result:             # <<<<<<<<<<<<<<
 *             if not isinstance(info, FlightInfo):
 *                 raise TypeError("FlightServerBase.list_flights must return "
 */
      if (likely(PyList_CheckExact(__pyx_v_result)) || PyTuple_CheckExact(__pyx_v_result)) {
        __pyx_t_4 = __pyx_v_result; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0;
        __pyx_t_12 = NULL;
      } else {
        __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1505, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1505, __pyx_L3_error)
      }
      for (;;) {
        if (likely(!__pyx_t_12)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1505, __pyx_L3_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1505, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1505, __pyx_L3_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1505, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_12(__pyx_t_4);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1505, __pyx_L3_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_XDECREF_SET(__pyx_v_info, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pyarrow/_flight.pyx":1506
 *                                               c_criteria.expression)
 *         for info in result:
 *             if not isinstance(info, FlightInfo):             # <<<<<<<<<<<<<<
 *                 raise TypeError("FlightServerBase.list_flights must return "
 *                                 "FlightInfo instances, but got {}".format(
 */
        __pyx_t_13 = __Pyx_TypeCheck(__pyx_v_info, __pyx_ptype_7pyarrow_7_flight_FlightInfo); 
        __pyx_t_14 = ((!(__pyx_t_13 != 0)) != 0);
        if (unlikely(__pyx_t_14)) {

          /* "pyarrow/_flight.pyx":1508
 *             if not isinstance(info, FlightInfo):
 *                 raise TypeError("FlightServerBase.list_flights must return "
 *                                 "FlightInfo instances, but got {}".format(             # <<<<<<<<<<<<<<
 *                                     type(info)))
 *             flights.push_back(deref((<FlightInfo> info).info.get()))
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightServerBase_list_flights_mu, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1508, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_10);

          /* "pyarrow/_flight.pyx":1509
 *                 raise TypeError("FlightServerBase.list_flights must return "
 *                                 "FlightInfo instances, but got {}".format(
 *                                     type(info)))             # <<<<<<<<<<<<<<
 *             flights.push_back(deref((<FlightInfo> info).info.get()))
 *         listing.reset(new CSimpleFlightListing(flights))
 */
          __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_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_7, ((PyObject *)Py_TYPE(__pyx_v_info))) : __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)Py_TYPE(__pyx_v_info)));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1508, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "pyarrow/_flight.pyx":1507
 *         for info in result:
 *             if not isinstance(info, FlightInfo):
 *                 raise TypeError("FlightServerBase.list_flights must return "             # <<<<<<<<<<<<<<
 *                                 "FlightInfo instances, but got {}".format(
 *                                     type(info)))
 */
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1507, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_Raise(__pyx_t_10, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __PYX_ERR(0, 1507, __pyx_L3_error)

          /* "pyarrow/_flight.pyx":1506
 *                                               c_criteria.expression)
 *         for info in result:
 *             if not isinstance(info, FlightInfo):             # <<<<<<<<<<<<<<
 *                 raise TypeError("FlightServerBase.list_flights must return "
 *                                 "FlightInfo instances, but got {}".format(
 */
        }

        /* "pyarrow/_flight.pyx":1510
 *                                 "FlightInfo instances, but got {}".format(
 *                                     type(info)))
 *             flights.push_back(deref((<FlightInfo> info).info.get()))             # <<<<<<<<<<<<<<
 *         listing.reset(new CSimpleFlightListing(flights))
 *     except FlightError as flight_error:
 */
        try {
          __pyx_v_flights.push_back((*((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_info)->info.get()));
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 1510, __pyx_L3_error)
        }

        /* "pyarrow/_flight.pyx":1505
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)
 *         for info in result:             # <<<<<<<<<<<<<<
 *             if not isinstance(info, FlightInfo):
 *                 raise TypeError("FlightServerBase.list_flights must return "
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1511
 *                                     type(info)))
 *             flights.push_back(deref((<FlightInfo> info).info.get()))
 *         listing.reset(new CSimpleFlightListing(flights))             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_v_listing->reset(new  arrow::flight::SimpleFlightListing(__pyx_v_flights));

      /* "pyarrow/_flight.pyx":1502
 *         vector[CFlightInfo] flights
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)
 */
    }
    __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_10); __pyx_t_10 = 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;

    /* "pyarrow/_flight.pyx":1512
 *             flights.push_back(deref((<FlightInfo> info).info.get()))
 *         listing.reset(new CSimpleFlightListing(flights))
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_9) {
      __Pyx_AddTraceback("pyarrow._flight._list_flights", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_5) < 0) __PYX_ERR(0, 1512, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_v_flight_error = __pyx_t_10;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1513
 *         listing.reset(new CSimpleFlightListing(flights))
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L16_return;
      }

      /* "pyarrow/_flight.pyx":1512
 *             flights.push_back(deref((<FlightInfo> info).info.get()))
 *         listing.reset(new CSimpleFlightListing(flights))
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L16_return: {
          __pyx_t_15 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_15;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1502
 *         vector[CFlightInfo] flights
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_flights(ServerCallContext.wrap(context),
 *                                               c_criteria.expression)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1514
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1495
 * 
 * 
 * cdef CStatus _list_flights(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                            const CCriteria* c_criteria,
 *                            unique_ptr[CFlightListing]* listing) except *:
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyarrow._flight._list_flights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1517
 * 
 * 
 * cdef CStatus _get_flight_info(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                               CFlightDescriptor c_descriptor,
 *                               unique_ptr[CFlightInfo]* info) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__get_flight_info(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context,  arrow::flight::FlightDescriptor __pyx_v_c_descriptor, std::unique_ptr< arrow::flight::FlightInfo>  *__pyx_v_info) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_py_descriptor = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  arrow::Status __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("_get_flight_info", 0);

  /* "pyarrow/_flight.pyx":1523
 *     cdef:
 *         FlightDescriptor py_descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *     py_descriptor.descriptor = c_descriptor
 *     try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_py_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1524
 *         FlightDescriptor py_descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor             # <<<<<<<<<<<<<<
 *     try:
 *         result = (<object> self).get_flight_info(
 */
  __pyx_v_py_descriptor->descriptor = __pyx_v_c_descriptor;

  /* "pyarrow/_flight.pyx":1525
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).get_flight_info(
 *             ServerCallContext.wrap(context),
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "pyarrow/_flight.pyx":1526
 *     py_descriptor.descriptor = c_descriptor
 *     try:
 *         result = (<object> self).get_flight_info(             # <<<<<<<<<<<<<<
 *             ServerCallContext.wrap(context),
 *             py_descriptor)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_flight_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1526, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "pyarrow/_flight.pyx":1527
 *     try:
 *         result = (<object> self).get_flight_info(
 *             ServerCallContext.wrap(context),             # <<<<<<<<<<<<<<
 *             py_descriptor)
 *     except FlightError as flight_error:
 */
      __pyx_t_6 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1527, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "pyarrow/_flight.pyx":1528
 *         result = (<object> self).get_flight_info(
 *             ServerCallContext.wrap(context),
 *             py_descriptor)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __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, ((PyObject *)__pyx_v_py_descriptor)};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __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, ((PyObject *)__pyx_v_py_descriptor)};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __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(0, 1526, __pyx_L3_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(((PyObject *)__pyx_v_py_descriptor));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_py_descriptor));
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, ((PyObject *)__pyx_v_py_descriptor));
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1525
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).get_flight_info(
 *             ServerCallContext.wrap(context),
 */
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1529
 *             ServerCallContext.wrap(context),
 *             py_descriptor)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightInfo):
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pyarrow._flight._get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 1529, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1530
 *             py_descriptor)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     if not isinstance(result, FlightInfo):
 *         raise TypeError("FlightServerBase.get_flight_info must return "
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1529
 *             ServerCallContext.wrap(context),
 *             py_descriptor)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightInfo):
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1525
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).get_flight_info(
 *             ServerCallContext.wrap(context),
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1531
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightInfo):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.get_flight_info must return "
 *                         "a FlightInfo instance, but got {}".format(
 */
  __pyx_t_11 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_7_flight_FlightInfo); 
  __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
  if (unlikely(__pyx_t_12)) {

    /* "pyarrow/_flight.pyx":1533
 *     if not isinstance(result, FlightInfo):
 *         raise TypeError("FlightServerBase.get_flight_info must return "
 *                         "a FlightInfo instance, but got {}".format(             # <<<<<<<<<<<<<<
 *                             type(result)))
 *     info.reset(new CFlightInfo(deref((<FlightInfo> result).info.get())))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightServerBase_get_flight_info, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "pyarrow/_flight.pyx":1534
 *         raise TypeError("FlightServerBase.get_flight_info must return "
 *                         "a FlightInfo instance, but got {}".format(
 *                             type(result)))             # <<<<<<<<<<<<<<
 *     info.reset(new CFlightInfo(deref((<FlightInfo> result).info.get())))
 *     return CStatus_OK()
 */
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, ((PyObject *)Py_TYPE(__pyx_v_result))) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_result)));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyarrow/_flight.pyx":1532
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightInfo):
 *         raise TypeError("FlightServerBase.get_flight_info must return "             # <<<<<<<<<<<<<<
 *                         "a FlightInfo instance, but got {}".format(
 *                             type(result)))
 */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1532, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1531
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightInfo):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.get_flight_info must return "
 *                         "a FlightInfo instance, but got {}".format(
 */
  }

  /* "pyarrow/_flight.pyx":1535
 *                         "a FlightInfo instance, but got {}".format(
 *                             type(result)))
 *     info.reset(new CFlightInfo(deref((<FlightInfo> result).info.get())))             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
  __pyx_v_info->reset(new  arrow::flight::FlightInfo((*((struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)__pyx_v_result)->info.get())));

  /* "pyarrow/_flight.pyx":1536
 *                             type(result)))
 *     info.reset(new CFlightInfo(deref((<FlightInfo> result).info.get())))
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * cdef CStatus _get_schema(void* self, const CServerCallContext& context,
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1517
 * 
 * 
 * cdef CStatus _get_flight_info(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                               CFlightDescriptor c_descriptor,
 *                               unique_ptr[CFlightInfo]* info) except *:
 */

  /* 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_9);
  __Pyx_AddTraceback("pyarrow._flight._get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_descriptor);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1538
 *     return CStatus_OK()
 * 
 * cdef CStatus _get_schema(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                          CFlightDescriptor c_descriptor,
 *                          unique_ptr[CSchemaResult]* info) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__get_schema(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context,  arrow::flight::FlightDescriptor __pyx_v_c_descriptor, std::unique_ptr< arrow::flight::SchemaResult>  *__pyx_v_info) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_py_descriptor = 0;
  PyObject *__pyx_v_result = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_get_schema", 0);

  /* "pyarrow/_flight.pyx":1544
 *     cdef:
 *         FlightDescriptor py_descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 *     py_descriptor.descriptor = c_descriptor
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_py_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1545
 *         FlightDescriptor py_descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor             # <<<<<<<<<<<<<<
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),
 *                                         py_descriptor)
 */
  __pyx_v_py_descriptor->descriptor = __pyx_v_c_descriptor;

  /* "pyarrow/_flight.pyx":1546
 *             FlightDescriptor.__new__(FlightDescriptor)
 *     py_descriptor.descriptor = c_descriptor
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),             # <<<<<<<<<<<<<<
 *                                         py_descriptor)
 *     if not isinstance(result, SchemaResult):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_schema); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pyarrow/_flight.pyx":1547
 *     py_descriptor.descriptor = c_descriptor
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),
 *                                         py_descriptor)             # <<<<<<<<<<<<<<
 *     if not isinstance(result, SchemaResult):
 *         raise TypeError("FlightServerBase.get_schema_info must return "
 */
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_v_py_descriptor)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_v_py_descriptor)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_py_descriptor));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_py_descriptor));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_py_descriptor));
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1548
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),
 *                                         py_descriptor)
 *     if not isinstance(result, SchemaResult):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.get_schema_info must return "
 *                         "a SchemaResult instance, but got {}".format(
 */
  __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_7_flight_SchemaResult); 
  __pyx_t_8 = ((!(__pyx_t_7 != 0)) != 0);
  if (unlikely(__pyx_t_8)) {

    /* "pyarrow/_flight.pyx":1550
 *     if not isinstance(result, SchemaResult):
 *         raise TypeError("FlightServerBase.get_schema_info must return "
 *                         "a SchemaResult instance, but got {}".format(             # <<<<<<<<<<<<<<
 *                             type(result)))
 *     info.reset(new CSchemaResult(deref((<SchemaResult> result).result.get())))
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_FlightServerBase_get_schema_info, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "pyarrow/_flight.pyx":1551
 *         raise TypeError("FlightServerBase.get_schema_info must return "
 *                         "a SchemaResult instance, but got {}".format(
 *                             type(result)))             # <<<<<<<<<<<<<<
 *     info.reset(new CSchemaResult(deref((<SchemaResult> result).result.get())))
 *     return CStatus_OK()
 */
    __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, ((PyObject *)Py_TYPE(__pyx_v_result))) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_result)));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":1549
 *                                         py_descriptor)
 *     if not isinstance(result, SchemaResult):
 *         raise TypeError("FlightServerBase.get_schema_info must return "             # <<<<<<<<<<<<<<
 *                         "a SchemaResult instance, but got {}".format(
 *                             type(result)))
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1549, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1548
 *     result = (<object> self).get_schema(ServerCallContext.wrap(context),
 *                                         py_descriptor)
 *     if not isinstance(result, SchemaResult):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.get_schema_info must return "
 *                         "a SchemaResult instance, but got {}".format(
 */
  }

  /* "pyarrow/_flight.pyx":1552
 *                         "a SchemaResult instance, but got {}".format(
 *                             type(result)))
 *     info.reset(new CSchemaResult(deref((<SchemaResult> result).result.get())))             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
  __pyx_v_info->reset(new  arrow::flight::SchemaResult((*((struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)__pyx_v_result)->result.get())));

  /* "pyarrow/_flight.pyx":1553
 *                             type(result)))
 *     info.reset(new CSchemaResult(deref((<SchemaResult> result).result.get())))
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * cdef CStatus _do_put(void* self, const CServerCallContext& context,
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1538
 *     return CStatus_OK()
 * 
 * cdef CStatus _get_schema(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                          CFlightDescriptor c_descriptor,
 *                          unique_ptr[CSchemaResult]* info) except *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight._get_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_descriptor);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1555
 *     return CStatus_OK()
 * 
 * cdef CStatus _do_put(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                      unique_ptr[CFlightMessageReader] reader,
 *                      unique_ptr[CFlightMetadataWriter] writer) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__do_put(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context, std::unique_ptr< arrow::flight::FlightMessageReader>  __pyx_v_reader, std::unique_ptr< arrow::flight::FlightMetadataWriter>  __pyx_v_writer) {
  struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *__pyx_v_py_reader = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_py_writer = 0;
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *__pyx_v_descriptor = 0;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  arrow::Status __pyx_t_10;
  __Pyx_RefNannySetupContext("_do_put", 0);

  /* "pyarrow/_flight.pyx":1560
 *     """Callback for implementing Flight servers in Python."""
 *     cdef:
 *         MetadataRecordBatchReader py_reader = MetadataRecordBatchReader()             # <<<<<<<<<<<<<<
 *         FlightMetadataWriter py_writer = FlightMetadataWriter()
 *         FlightDescriptor descriptor = \
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_MetadataRecordBatchReader)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_reader = ((struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1561
 *     cdef:
 *         MetadataRecordBatchReader py_reader = MetadataRecordBatchReader()
 *         FlightMetadataWriter py_writer = FlightMetadataWriter()             # <<<<<<<<<<<<<<
 *         FlightDescriptor descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightMetadataWriter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_writer = ((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1563
 *         FlightMetadataWriter py_writer = FlightMetadataWriter()
 *         FlightDescriptor descriptor = \
 *             FlightDescriptor.__new__(FlightDescriptor)             # <<<<<<<<<<<<<<
 * 
 *     descriptor.descriptor = reader.get().descriptor()
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(((PyTypeObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1563, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_descriptor = ((struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1565
 *             FlightDescriptor.__new__(FlightDescriptor)
 * 
 *     descriptor.descriptor = reader.get().descriptor()             # <<<<<<<<<<<<<<
 *     py_reader.reader.reset(reader.release())
 *     py_reader.schema = pyarrow_wrap_schema(
 */
  __pyx_v_descriptor->descriptor = __pyx_v_reader.get()->descriptor();

  /* "pyarrow/_flight.pyx":1566
 * 
 *     descriptor.descriptor = reader.get().descriptor()
 *     py_reader.reader.reset(reader.release())             # <<<<<<<<<<<<<<
 *     py_reader.schema = pyarrow_wrap_schema(
 *         py_reader.reader.get().schema())
 */
  __pyx_v_py_reader->__pyx_base.reader.reset(__pyx_v_reader.release());

  /* "pyarrow/_flight.pyx":1567
 *     descriptor.descriptor = reader.get().descriptor()
 *     py_reader.reader.reset(reader.release())
 *     py_reader.schema = pyarrow_wrap_schema(             # <<<<<<<<<<<<<<
 *         py_reader.reader.get().schema())
 *     py_writer.writer.reset(writer.release())
 */
  __pyx_t_1 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_schema(__pyx_v_py_reader->__pyx_base.reader.get()->schema()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7pyarrow_3lib_Schema))))) __PYX_ERR(0, 1567, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_py_reader->__pyx_base.schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_py_reader->__pyx_base.schema));
  __pyx_v_py_reader->__pyx_base.schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1569
 *     py_reader.schema = pyarrow_wrap_schema(
 *         py_reader.reader.get().schema())
 *     py_writer.writer.reset(writer.release())             # <<<<<<<<<<<<<<
 *     try:
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 */
  __pyx_v_py_writer->writer.reset(__pyx_v_writer.release());

  /* "pyarrow/_flight.pyx":1570
 *         py_reader.reader.get().schema())
 *     py_writer.writer.reset(writer.release())
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 *                                py_reader, py_writer)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "pyarrow/_flight.pyx":1571
 *     py_writer.writer.reset(writer.release())
 *     try:
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,             # <<<<<<<<<<<<<<
 *                                py_reader, py_writer)
 *         return CStatus_OK()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_put); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "pyarrow/_flight.pyx":1572
 *     try:
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 *                                py_reader, py_writer)             # <<<<<<<<<<<<<<
 *         return CStatus_OK()
 *     except FlightError as flight_error:
 */
      __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[5] = {__pyx_t_7, __pyx_t_6, ((PyObject *)__pyx_v_descriptor), ((PyObject *)__pyx_v_py_reader), ((PyObject *)__pyx_v_py_writer)};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __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[5] = {__pyx_t_7, __pyx_t_6, ((PyObject *)__pyx_v_descriptor), ((PyObject *)__pyx_v_py_reader), ((PyObject *)__pyx_v_py_writer)};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1571, __pyx_L3_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(((PyObject *)__pyx_v_descriptor));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_descriptor));
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, ((PyObject *)__pyx_v_descriptor));
        __Pyx_INCREF(((PyObject *)__pyx_v_py_reader));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_py_reader));
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, ((PyObject *)__pyx_v_py_reader));
        __Pyx_INCREF(((PyObject *)__pyx_v_py_writer));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_py_writer));
        PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, ((PyObject *)__pyx_v_py_writer));
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1573
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 *                                py_reader, py_writer)
 *         return CStatus_OK()             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_r = arrow::Status::OK();
      goto __pyx_L7_try_return;

      /* "pyarrow/_flight.pyx":1570
 *         py_reader.reader.get().schema())
 *     py_writer.writer.reset(writer.release())
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 *                                py_reader, py_writer)
 */
    }
    __pyx_L3_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;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1574
 *                                py_reader, py_writer)
 *         return CStatus_OK()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pyarrow._flight._do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 1574, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1575
 *         return CStatus_OK()
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1574
 *                                py_reader, py_writer)
 *         return CStatus_OK()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1570
 *         py_reader.reader.get().schema())
 *     py_writer.writer.reset(writer.release())
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).do_put(ServerCallContext.wrap(context), descriptor,
 *                                py_reader, py_writer)
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "pyarrow/_flight.pyx":1555
 *     return CStatus_OK()
 * 
 * cdef CStatus _do_put(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                      unique_ptr[CFlightMessageReader] reader,
 *                      unique_ptr[CFlightMetadataWriter] writer) except *:
 */

  /* 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_9);
  __Pyx_AddTraceback("pyarrow._flight._do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_reader);
  __Pyx_XDECREF((PyObject *)__pyx_v_py_writer);
  __Pyx_XDECREF((PyObject *)__pyx_v_descriptor);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1578
 * 
 * 
 * cdef CStatus _do_get(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                      CTicket ticket,
 *                      unique_ptr[CFlightDataStream]* stream) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__do_get(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context,  arrow::flight::Ticket __pyx_v_ticket, std::unique_ptr< arrow::flight::FlightDataStream>  *__pyx_v_stream) {
  std::unique_ptr< arrow::flight::FlightDataStream>  __pyx_v_data_stream;
  struct __pyx_obj_7pyarrow_7_flight_Ticket *__pyx_v_py_ticket = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  arrow::Status __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
   arrow::flight::FlightDataStream *__pyx_t_13;
  __Pyx_RefNannySetupContext("_do_get", 0);

  /* "pyarrow/_flight.pyx":1585
 *         unique_ptr[CFlightDataStream] data_stream
 * 
 *     py_ticket = Ticket(ticket.ticket)             # <<<<<<<<<<<<<<
 *     try:
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 */
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_ticket.ticket); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Ticket), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_py_ticket = ((struct __pyx_obj_7pyarrow_7_flight_Ticket *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1586
 * 
 *     py_ticket = Ticket(ticket.ticket)
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1587
 *     py_ticket = Ticket(ticket.ticket)
 *     try:
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),             # <<<<<<<<<<<<<<
 *                                         py_ticket)
 *     except FlightError as flight_error:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "pyarrow/_flight.pyx":1588
 *     try:
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, ((PyObject *)__pyx_v_py_ticket)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1587, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, ((PyObject *)__pyx_v_py_ticket)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1587, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __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(0, 1587, __pyx_L3_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(((PyObject *)__pyx_v_py_ticket));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_py_ticket));
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, ((PyObject *)__pyx_v_py_ticket));
        __pyx_t_6 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1587, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyarrow/_flight.pyx":1586
 * 
 *     py_ticket = Ticket(ticket.ticket)
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)
 */
    }
    __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_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_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1589
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pyarrow._flight._do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 1589, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_flight_error = __pyx_t_1;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1590
 *                                         py_ticket)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     if not isinstance(result, FlightDataStream):
 *         raise TypeError("FlightServerBase.do_get must return "
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1589
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1586
 * 
 *     py_ticket = Ticket(ticket.ticket)
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).do_get(ServerCallContext.wrap(context),
 *                                         py_ticket)
 */
    __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_L6_except_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_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1591
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.do_get must return "
 *                         "a FlightDataStream")
 */
  __pyx_t_11 = __Pyx_TypeCheck(__pyx_v_result, __pyx_ptype_7pyarrow_7_flight_FlightDataStream); 
  __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
  if (unlikely(__pyx_t_12)) {

    /* "pyarrow/_flight.pyx":1592
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):
 *         raise TypeError("FlightServerBase.do_get must return "             # <<<<<<<<<<<<<<
 *                         "a FlightDataStream")
 *     data_stream = unique_ptr[CFlightDataStream](
 */
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1592, __pyx_L1_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, 1592, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":1591
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):             # <<<<<<<<<<<<<<
 *         raise TypeError("FlightServerBase.do_get must return "
 *                         "a FlightDataStream")
 */
  }

  /* "pyarrow/_flight.pyx":1595
 *                         "a FlightDataStream")
 *     data_stream = unique_ptr[CFlightDataStream](
 *         (<FlightDataStream> result).to_stream())             # <<<<<<<<<<<<<<
 *     stream[0] = unique_ptr[CFlightDataStream](
 *         new CPyFlightDataStream(result, move(data_stream)))
 */
  __pyx_t_13 = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream *)((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_result)->__pyx_vtab)->to_stream(((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v_result)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1595, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1594
 *         raise TypeError("FlightServerBase.do_get must return "
 *                         "a FlightDataStream")
 *     data_stream = unique_ptr[CFlightDataStream](             # <<<<<<<<<<<<<<
 *         (<FlightDataStream> result).to_stream())
 *     stream[0] = unique_ptr[CFlightDataStream](
 */
  __pyx_v_data_stream = std::unique_ptr< arrow::flight::FlightDataStream> (__pyx_t_13);

  /* "pyarrow/_flight.pyx":1596
 *     data_stream = unique_ptr[CFlightDataStream](
 *         (<FlightDataStream> result).to_stream())
 *     stream[0] = unique_ptr[CFlightDataStream](             # <<<<<<<<<<<<<<
 *         new CPyFlightDataStream(result, move(data_stream)))
 *     return CStatus_OK()
 */
  (__pyx_v_stream[0]) = std::unique_ptr< arrow::flight::FlightDataStream> (new  arrow::py::flight::PyFlightDataStream(__pyx_v_result,  cymove::cymove<std::unique_ptr< arrow::flight::FlightDataStream> >(__pyx_v_data_stream)));

  /* "pyarrow/_flight.pyx":1598
 *     stream[0] = unique_ptr[CFlightDataStream](
 *         new CPyFlightDataStream(result, move(data_stream)))
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1578
 * 
 * 
 * cdef CStatus _do_get(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                      CTicket ticket,
 *                      unique_ptr[CFlightDataStream]* stream) except *:
 */

  /* function exit code */
  __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_9);
  __Pyx_AddTraceback("pyarrow._flight._do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_ticket);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1601
 * 
 * 
 * cdef CStatus _do_action_result_next(             # <<<<<<<<<<<<<<
 *     void* self,
 *     unique_ptr[CFlightResult]* result
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__do_action_result_next(void *__pyx_v_self, std::unique_ptr< arrow::flight::Result>  *__pyx_v_result) {
   arrow::flight::Result *__pyx_v_c_result;
  PyObject *__pyx_v_action_result = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  arrow::Status __pyx_t_10;
  __Pyx_RefNannySetupContext("_do_action_result_next", 0);

  /* "pyarrow/_flight.pyx":1609
 *         CFlightResult* c_result
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1610
 * 
 *     try:
 *         action_result = next(<object> self)             # <<<<<<<<<<<<<<
 *         if not isinstance(action_result, Result):
 *             action_result = Result(action_result)
 */
      __pyx_t_4 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1610, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_action_result = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1611
 *     try:
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):             # <<<<<<<<<<<<<<
 *             action_result = Result(action_result)
 *         c_result = (<Result> action_result).result.get()
 */
      __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_action_result, __pyx_ptype_7pyarrow_7_flight_Result); 
      __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
      if (__pyx_t_6) {

        /* "pyarrow/_flight.pyx":1612
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):
 *             action_result = Result(action_result)             # <<<<<<<<<<<<<<
 *         c_result = (<Result> action_result).result.get()
 *         result.reset(new CFlightResult(deref(c_result)))
 */
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Result), __pyx_v_action_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1612, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_action_result, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pyarrow/_flight.pyx":1611
 *     try:
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):             # <<<<<<<<<<<<<<
 *             action_result = Result(action_result)
 *         c_result = (<Result> action_result).result.get()
 */
      }

      /* "pyarrow/_flight.pyx":1613
 *         if not isinstance(action_result, Result):
 *             action_result = Result(action_result)
 *         c_result = (<Result> action_result).result.get()             # <<<<<<<<<<<<<<
 *         result.reset(new CFlightResult(deref(c_result)))
 *     except StopIteration:
 */
      __pyx_v_c_result = ((struct __pyx_obj_7pyarrow_7_flight_Result *)__pyx_v_action_result)->result.get();

      /* "pyarrow/_flight.pyx":1614
 *             action_result = Result(action_result)
 *         c_result = (<Result> action_result).result.get()
 *         result.reset(new CFlightResult(deref(c_result)))             # <<<<<<<<<<<<<<
 *     except StopIteration:
 *         result.reset(nullptr)
 */
      __pyx_v_result->reset(new  arrow::flight::Result((*__pyx_v_c_result)));

      /* "pyarrow/_flight.pyx":1609
 *         CFlightResult* c_result
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):
 */
    }
    __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;

    /* "pyarrow/_flight.pyx":1615
 *         c_result = (<Result> action_result).result.get()
 *         result.reset(new CFlightResult(deref(c_result)))
 *     except StopIteration:             # <<<<<<<<<<<<<<
 *         result.reset(nullptr)
 *     except FlightError as flight_error:
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._do_action_result_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 1615, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);

      /* "pyarrow/_flight.pyx":1616
 *         result.reset(new CFlightResult(deref(c_result)))
 *     except StopIteration:
 *         result.reset(nullptr)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_v_result->reset(nullptr);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L4_exception_handled;
    }

    /* "pyarrow/_flight.pyx":1617
 *     except StopIteration:
 *         result.reset(nullptr)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._do_action_result_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_4) < 0) __PYX_ERR(0, 1617, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_flight_error = __pyx_t_8;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1618
 *         result.reset(nullptr)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L16_return;
      }

      /* "pyarrow/_flight.pyx":1617
 *     except StopIteration:
 *         result.reset(nullptr)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L16_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1609
 *         CFlightResult* c_result
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         action_result = next(<object> self)
 *         if not isinstance(action_result, Result):
 */
    __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);
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1619
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1601
 * 
 * 
 * cdef CStatus _do_action_result_next(             # <<<<<<<<<<<<<<
 *     void* self,
 *     unique_ptr[CFlightResult]* result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyarrow._flight._do_action_result_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_action_result);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1622
 * 
 * 
 * cdef CStatus _do_action(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                         const CAction& action,
 *                         unique_ptr[CResultStream]* result) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__do_action(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context,  arrow::flight::Action const &__pyx_v_action, std::unique_ptr< arrow::flight::ResultStream>  *__pyx_v_result) {
  std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_result_next>  __pyx_v_ptr;
  struct __pyx_obj_7pyarrow_7_flight_Action *__pyx_v_py_action = NULL;
  PyObject *__pyx_v_responses = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  arrow::Status __pyx_t_10;
  __Pyx_RefNannySetupContext("_do_action", 0);

  /* "pyarrow/_flight.pyx":1627
 *     """Callback for implementing Flight servers in Python."""
 *     cdef:
 *         function[cb_result_next] ptr = &_do_action_result_next             # <<<<<<<<<<<<<<
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))
 *     try:
 */
  __pyx_v_ptr = (&__pyx_f_7pyarrow_7_flight__do_action_result_next);

  /* "pyarrow/_flight.pyx":1628
 *     cdef:
 *         function[cb_result_next] ptr = &_do_action_result_next
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))             # <<<<<<<<<<<<<<
 *     try:
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 */
  __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_action.type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(__pyx_v_action.body); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __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_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Action), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_py_action = ((struct __pyx_obj_7pyarrow_7_flight_Action *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1629
 *         function[cb_result_next] ptr = &_do_action_result_next
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))
 *     try:             # <<<<<<<<<<<<<<
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "pyarrow/_flight.pyx":1630
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))
 *     try:
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),             # <<<<<<<<<<<<<<
 *                                               py_action)
 *     except FlightError as flight_error:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_action); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1630, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1630, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyarrow/_flight.pyx":1631
 *     try:
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_1, ((PyObject *)__pyx_v_py_action)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1630, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_1, ((PyObject *)__pyx_v_py_action)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1630, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1630, __pyx_L3_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_1);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_py_action));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_py_action));
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, ((PyObject *)__pyx_v_py_action));
        __pyx_t_1 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1630, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_responses = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyarrow/_flight.pyx":1629
 *         function[cb_result_next] ptr = &_do_action_result_next
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))
 *     try:             # <<<<<<<<<<<<<<
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1632
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     result.reset(new CPyFlightResultStream(responses, ptr))
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pyarrow._flight._do_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(0, 1632, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_flight_error = __pyx_t_3;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1633
 *                                               py_action)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     result.reset(new CPyFlightResultStream(responses, ptr))
 *     return CStatus_OK()
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1632
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     result.reset(new CPyFlightResultStream(responses, ptr))
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_10 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_10;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1629
 *         function[cb_result_next] ptr = &_do_action_result_next
 *     py_action = Action(action.type, pyarrow_wrap_buffer(action.body))
 *     try:             # <<<<<<<<<<<<<<
 *         responses = (<object> self).do_action(ServerCallContext.wrap(context),
 *                                               py_action)
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1634
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     result.reset(new CPyFlightResultStream(responses, ptr))             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
  __pyx_v_result->reset(new  arrow::py::flight::PyFlightResultStream(__pyx_v_responses, __pyx_v_ptr));

  /* "pyarrow/_flight.pyx":1635
 *         return (<FlightError> flight_error).to_status()
 *     result.reset(new CPyFlightResultStream(responses, ptr))
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1622
 * 
 * 
 * cdef CStatus _do_action(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                         const CAction& action,
 *                         unique_ptr[CResultStream]* result) except *:
 */

  /* 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_AddTraceback("pyarrow._flight._do_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_py_action);
  __Pyx_XDECREF(__pyx_v_responses);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1638
 * 
 * 
 * cdef CStatus _list_actions(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                            vector[CActionType]* actions) except *:
 *     """Callback for implementing Flight servers in Python."""
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__list_actions(void *__pyx_v_self,  arrow::flight::ServerCallContext const &__pyx_v_context, std::vector< arrow::flight::ActionType>  *__pyx_v_actions) {
   arrow::flight::ActionType __pyx_v_action_type;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_action = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  std::string __pyx_t_13;
  int __pyx_t_14;
  arrow::Status __pyx_t_15;
  __Pyx_RefNannySetupContext("_list_actions", 0);

  /* "pyarrow/_flight.pyx":1644
 *         CActionType action_type
 *     # Method should return a list of ActionTypes or similar tuple
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1645
 *     # Method should return a list of ActionTypes or similar tuple
 *     try:
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))             # <<<<<<<<<<<<<<
 *         for action in result:
 *             if not isinstance(action, tuple):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_list_actions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1645, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = ((PyObject *)__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap(__pyx_v_context)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1645, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1645, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1646
 *     try:
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:             # <<<<<<<<<<<<<<
 *             if not isinstance(action, tuple):
 *                 raise TypeError(
 */
      if (likely(PyList_CheckExact(__pyx_v_result)) || PyTuple_CheckExact(__pyx_v_result)) {
        __pyx_t_4 = __pyx_v_result; __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_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1646, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1646, __pyx_L3_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_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1646, __pyx_L3_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1646, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1646, __pyx_L3_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1646, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_9(__pyx_t_4);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1646, __pyx_L3_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pyarrow/_flight.pyx":1647
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:
 *             if not isinstance(action, tuple):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     "Results of list_actions must be ActionType or tuple")
 */
        __pyx_t_10 = PyTuple_Check(__pyx_v_action); 
        __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
        if (unlikely(__pyx_t_11)) {

          /* "pyarrow/_flight.pyx":1648
 *         for action in result:
 *             if not isinstance(action, tuple):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     "Results of list_actions must be ActionType or tuple")
 *             action_type.type = tobytes(action[0])
 */
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1648, __pyx_L3_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, 1648, __pyx_L3_error)

          /* "pyarrow/_flight.pyx":1647
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:
 *             if not isinstance(action, tuple):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     "Results of list_actions must be ActionType or tuple")
 */
        }

        /* "pyarrow/_flight.pyx":1650
 *                 raise TypeError(
 *                     "Results of list_actions must be ActionType or tuple")
 *             action_type.type = tobytes(action[0])             # <<<<<<<<<<<<<<
 *             action_type.description = tobytes(action[1])
 *             actions.push_back(action_type)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1650, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_action, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1650, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1650, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_action_type.type = __pyx_t_13;

        /* "pyarrow/_flight.pyx":1651
 *                     "Results of list_actions must be ActionType or tuple")
 *             action_type.type = tobytes(action[0])
 *             action_type.description = tobytes(action[1])             # <<<<<<<<<<<<<<
 *             actions.push_back(action_type)
 *     except FlightError as flight_error:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1651, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_action, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1651, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_5 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1651, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_action_type.description = __pyx_t_13;

        /* "pyarrow/_flight.pyx":1652
 *             action_type.type = tobytes(action[0])
 *             action_type.description = tobytes(action[1])
 *             actions.push_back(action_type)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
        try {
          __pyx_v_actions->push_back(__pyx_v_action_type);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 1652, __pyx_L3_error)
        }

        /* "pyarrow/_flight.pyx":1646
 *     try:
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:             # <<<<<<<<<<<<<<
 *             if not isinstance(action, tuple):
 *                 raise TypeError(
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1644
 *         CActionType action_type
 *     # Method should return a list of ActionTypes or similar tuple
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:
 */
    }
    __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_12); __pyx_t_12 = 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;

    /* "pyarrow/_flight.pyx":1653
 *             action_type.description = tobytes(action[1])
 *             actions.push_back(action_type)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("pyarrow._flight._list_actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1653, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1654
 *             actions.push_back(action_type)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L16_return;
      }

      /* "pyarrow/_flight.pyx":1653
 *             action_type.description = tobytes(action[1])
 *             actions.push_back(action_type)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L16_return: {
          __pyx_t_15 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_15;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1644
 *         CActionType action_type
 *     # Method should return a list of ActionTypes or similar tuple
 *     try:             # <<<<<<<<<<<<<<
 *         result = (<object> self).list_actions(ServerCallContext.wrap(context))
 *         for action in result:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1655
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1638
 * 
 * 
 * cdef CStatus _list_actions(void* self, const CServerCallContext& context,             # <<<<<<<<<<<<<<
 *                            vector[CActionType]* actions) except *:
 *     """Callback for implementing Flight servers in Python."""
 */

  /* 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_12);
  __Pyx_AddTraceback("pyarrow._flight._list_actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_action);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1658
 * 
 * 
 * cdef CStatus _server_authenticate(void* self, CServerAuthSender* outgoing,             # <<<<<<<<<<<<<<
 *                                   CServerAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__server_authenticate(void *__pyx_v_self,  arrow::flight::ServerAuthSender *__pyx_v_outgoing,  arrow::flight::ServerAuthReader *__pyx_v_incoming) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *__pyx_v_sender = NULL;
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *__pyx_v_reader = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  arrow::Status __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("_server_authenticate", 0);

  /* "pyarrow/_flight.pyx":1661
 *                                   CServerAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 *     sender = ServerAuthSender.wrap(outgoing)             # <<<<<<<<<<<<<<
 *     reader = ServerAuthReader.wrap(incoming)
 *     try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7pyarrow_7_flight_16ServerAuthSender_wrap(__pyx_v_outgoing)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sender = ((struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1662
 *     """Callback for implementing authentication in Python."""
 *     sender = ServerAuthSender.wrap(outgoing)
 *     reader = ServerAuthReader.wrap(incoming)             # <<<<<<<<<<<<<<
 *     try:
 *         (<object> self).authenticate(sender, reader)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7pyarrow_7_flight_16ServerAuthReader_wrap(__pyx_v_incoming)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_reader = ((struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1663
 *     sender = ServerAuthSender.wrap(outgoing)
 *     reader = ServerAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1664
 *     reader = ServerAuthReader.wrap(incoming)
 *     try:
 *         (<object> self).authenticate(sender, reader)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_authenticate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1664, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __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, ((PyObject *)__pyx_v_sender), ((PyObject *)__pyx_v_reader)};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_sender), ((PyObject *)__pyx_v_reader)};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1664, __pyx_L6_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(((PyObject *)__pyx_v_sender));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_sender));
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_sender));
          __Pyx_INCREF(((PyObject *)__pyx_v_reader));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_reader));
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_reader));
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyarrow/_flight.pyx":1663
 *     sender = ServerAuthSender.wrap(outgoing)
 *     reader = ServerAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pyarrow/_flight.pyx":1665
 *     try:
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
      if (__pyx_t_7) {
        __Pyx_AddTraceback("pyarrow._flight._server_authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1665, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_flight_error = __pyx_t_5;
        /*try:*/ {

          /* "pyarrow/_flight.pyx":1666
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     finally:
 *         sender.poison()
 */
          __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L16_return;
        }

        /* "pyarrow/_flight.pyx":1665
 *     try:
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 */
        /*finally:*/ {
          __pyx_L16_return: {
            __pyx_t_9 = __pyx_r;
            __Pyx_DECREF(__pyx_v_flight_error);
            __pyx_v_flight_error = NULL;
            __pyx_r = __pyx_t_9;
            goto __pyx_L9_except_return;
          }
        }
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;

      /* "pyarrow/_flight.pyx":1663
 *     sender = ServerAuthSender.wrap(outgoing)
 *     reader = ServerAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_error;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L3_return;
      __pyx_L11_try_end:;
    }
  }

  /* "pyarrow/_flight.pyx":1668
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
  /*finally:*/ {
    /*normal exit:*/{
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

      /* "pyarrow/_flight.pyx":1669
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_7 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {

        /* "pyarrow/_flight.pyx":1668
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
        ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

        /* "pyarrow/_flight.pyx":1669
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      }
      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_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_9 = __pyx_r;

      /* "pyarrow/_flight.pyx":1668
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

      /* "pyarrow/_flight.pyx":1669
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      __pyx_r = __pyx_t_9;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }

  /* "pyarrow/_flight.pyx":1670
 *         sender.poison()
 *         reader.poison()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1658
 * 
 * 
 * cdef CStatus _server_authenticate(void* self, CServerAuthSender* outgoing,             # <<<<<<<<<<<<<<
 *                                   CServerAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 */

  /* 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_8);
  __Pyx_AddTraceback("pyarrow._flight._server_authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sender);
  __Pyx_XDECREF((PyObject *)__pyx_v_reader);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1673
 * 
 * 
 * cdef CStatus _is_valid(void* self, const c_string& token,             # <<<<<<<<<<<<<<
 *                        c_string* peer_identity) except *:
 *     """Callback for implementing authentication in Python."""
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__is_valid(void *__pyx_v_self, std::string const &__pyx_v_token, std::string *__pyx_v_peer_identity) {
  std::string __pyx_v_c_result;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  std::string __pyx_t_10;
  int __pyx_t_11;
  arrow::Status __pyx_t_12;
  __Pyx_RefNannySetupContext("_is_valid", 0);

  /* "pyarrow/_flight.pyx":1677
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1678
 *     cdef c_string c_result
 *     try:
 *         c_result = tobytes((<object> self).is_valid(token))             # <<<<<<<<<<<<<<
 *         peer_identity[0] = c_result
 *     except FlightError as flight_error:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_valid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_token); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1678, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_c_result = __pyx_t_10;

      /* "pyarrow/_flight.pyx":1679
 *     try:
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      (__pyx_v_peer_identity[0]) = __pyx_v_c_result;

      /* "pyarrow/_flight.pyx":1677
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result
 */
    }
    __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_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1680
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("pyarrow._flight._is_valid", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1680, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1681
 *         peer_identity[0] = c_result
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1680
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_12 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_12;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1677
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).is_valid(token))
 *         peer_identity[0] = c_result
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1682
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1673
 * 
 * 
 * cdef CStatus _is_valid(void* self, const c_string& token,             # <<<<<<<<<<<<<<
 *                        c_string* peer_identity) except *:
 *     """Callback for implementing authentication in Python."""
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyarrow._flight._is_valid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1685
 * 
 * 
 * cdef CStatus _client_authenticate(void* self, CClientAuthSender* outgoing,             # <<<<<<<<<<<<<<
 *                                   CClientAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__client_authenticate(void *__pyx_v_self,  arrow::flight::ClientAuthSender *__pyx_v_outgoing,  arrow::flight::ClientAuthReader *__pyx_v_incoming) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *__pyx_v_sender = NULL;
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *__pyx_v_reader = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  arrow::Status __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("_client_authenticate", 0);

  /* "pyarrow/_flight.pyx":1688
 *                                   CClientAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 *     sender = ClientAuthSender.wrap(outgoing)             # <<<<<<<<<<<<<<
 *     reader = ClientAuthReader.wrap(incoming)
 *     try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7pyarrow_7_flight_16ClientAuthSender_wrap(__pyx_v_outgoing)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sender = ((struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1689
 *     """Callback for implementing authentication in Python."""
 *     sender = ClientAuthSender.wrap(outgoing)
 *     reader = ClientAuthReader.wrap(incoming)             # <<<<<<<<<<<<<<
 *     try:
 *         (<object> self).authenticate(sender, reader)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_7pyarrow_7_flight_16ClientAuthReader_wrap(__pyx_v_incoming)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_reader = ((struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1690
 *     sender = ClientAuthSender.wrap(outgoing)
 *     reader = ClientAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1691
 *     reader = ClientAuthReader.wrap(incoming)
 *     try:
 *         (<object> self).authenticate(sender, reader)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_authenticate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1691, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __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, ((PyObject *)__pyx_v_sender), ((PyObject *)__pyx_v_reader)};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_sender), ((PyObject *)__pyx_v_reader)};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L6_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1691, __pyx_L6_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(((PyObject *)__pyx_v_sender));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_sender));
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_sender));
          __Pyx_INCREF(((PyObject *)__pyx_v_reader));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_reader));
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, ((PyObject *)__pyx_v_reader));
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyarrow/_flight.pyx":1690
 *     sender = ClientAuthSender.wrap(outgoing)
 *     reader = ClientAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pyarrow/_flight.pyx":1692
 *     try:
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 */
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
      if (__pyx_t_7) {
        __Pyx_AddTraceback("pyarrow._flight._client_authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1692, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_flight_error = __pyx_t_5;
        /*try:*/ {

          /* "pyarrow/_flight.pyx":1693
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     finally:
 *         sender.poison()
 */
          __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L16_return;
        }

        /* "pyarrow/_flight.pyx":1692
 *     try:
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 */
        /*finally:*/ {
          __pyx_L16_return: {
            __pyx_t_9 = __pyx_r;
            __Pyx_DECREF(__pyx_v_flight_error);
            __pyx_v_flight_error = NULL;
            __pyx_r = __pyx_t_9;
            goto __pyx_L9_except_return;
          }
        }
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;

      /* "pyarrow/_flight.pyx":1690
 *     sender = ClientAuthSender.wrap(outgoing)
 *     reader = ClientAuthReader.wrap(incoming)
 *     try:             # <<<<<<<<<<<<<<
 *         (<object> self).authenticate(sender, reader)
 *     except FlightError as flight_error:
 */
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L4_error;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L3_return;
      __pyx_L11_try_end:;
    }
  }

  /* "pyarrow/_flight.pyx":1695
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
  /*finally:*/ {
    /*normal exit:*/{
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

      /* "pyarrow/_flight.pyx":1696
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __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;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __pyx_t_7 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {

        /* "pyarrow/_flight.pyx":1695
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
        ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

        /* "pyarrow/_flight.pyx":1696
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      }
      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_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_9 = __pyx_r;

      /* "pyarrow/_flight.pyx":1695
 *         return (<FlightError> flight_error).to_status()
 *     finally:
 *         sender.poison()             # <<<<<<<<<<<<<<
 *         reader.poison()
 *     return CStatus_OK()
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender *)__pyx_v_sender->__pyx_vtab)->poison(__pyx_v_sender);

      /* "pyarrow/_flight.pyx":1696
 *     finally:
 *         sender.poison()
 *         reader.poison()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
      ((struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader *)__pyx_v_reader->__pyx_vtab)->poison(__pyx_v_reader);
      __pyx_r = __pyx_t_9;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }

  /* "pyarrow/_flight.pyx":1697
 *         sender.poison()
 *         reader.poison()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1685
 * 
 * 
 * cdef CStatus _client_authenticate(void* self, CClientAuthSender* outgoing,             # <<<<<<<<<<<<<<
 *                                   CClientAuthReader* incoming) except *:
 *     """Callback for implementing authentication in Python."""
 */

  /* 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_8);
  __Pyx_AddTraceback("pyarrow._flight._client_authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sender);
  __Pyx_XDECREF((PyObject *)__pyx_v_reader);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1700
 * 
 * 
 * cdef CStatus _get_token(void* self, c_string* token) except *:             # <<<<<<<<<<<<<<
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__get_token(void *__pyx_v_self, std::string *__pyx_v_token) {
  std::string __pyx_v_c_result;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  std::string __pyx_t_9;
  int __pyx_t_10;
  arrow::Status __pyx_t_11;
  __Pyx_RefNannySetupContext("_get_token", 0);

  /* "pyarrow/_flight.pyx":1703
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1704
 *     cdef c_string c_result
 *     try:
 *         c_result = tobytes((<object> self).get_token())             # <<<<<<<<<<<<<<
 *         token[0] = c_result
 *     except FlightError as flight_error:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1704, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1704, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1704, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1704, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1704, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_c_result = __pyx_t_9;

      /* "pyarrow/_flight.pyx":1705
 *     try:
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      (__pyx_v_token[0]) = __pyx_v_c_result;

      /* "pyarrow/_flight.pyx":1703
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result
 */
    }
    __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_8); __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1706
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_10) {
      __Pyx_AddTraceback("pyarrow._flight._get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1706, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1707
 *         token[0] = c_result
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1706
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_11 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_11;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1703
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 *     try:             # <<<<<<<<<<<<<<
 *         c_result = tobytes((<object> self).get_token())
 *         token[0] = c_result
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1708
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1700
 * 
 * 
 * cdef CStatus _get_token(void* self, c_string* token) except *:             # <<<<<<<<<<<<<<
 *     """Callback for implementing authentication in Python."""
 *     cdef c_string c_result
 */

  /* 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_8);
  __Pyx_AddTraceback("pyarrow._flight._get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1711
 * 
 * 
 * cdef CStatus _middleware_sending_headers(             # <<<<<<<<<<<<<<
 *         void* self, CAddCallHeaders* add_headers) except *:
 *     """Callback for implementing middleware."""
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_sending_headers(void *__pyx_v_self,  arrow::flight::AddCallHeaders *__pyx_v_add_headers) {
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  PyObject *__pyx_v_header = NULL;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_value = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  arrow::Status __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  Py_ssize_t __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  PyObject *__pyx_t_18 = NULL;
  std::string __pyx_t_19;
  std::string __pyx_t_20;
  __Pyx_RefNannySetupContext("_middleware_sending_headers", 0);

  /* "pyarrow/_flight.pyx":1714
 *         void* self, CAddCallHeaders* add_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_error:
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1715
 *     """Callback for implementing middleware."""
 *     try:
 *         headers = (<object> self).sending_headers()             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sending_headers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1715, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1715, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_headers = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1714
 *         void* self, CAddCallHeaders* add_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_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;
    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;

    /* "pyarrow/_flight.pyx":1716
 *     try:
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._middleware_sending_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1716, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1717
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 * 
 *     if headers:
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1716
 *     try:
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_8 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_8;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1714
 *         void* self, CAddCallHeaders* add_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = (<object> self).sending_headers()
 *     except FlightError as flight_error:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1719
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if headers:             # <<<<<<<<<<<<<<
 *         for header, values in headers.items():
 *             if isinstance(values, (str, bytes)):
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_headers); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1719, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyarrow/_flight.pyx":1720
 * 
 *     if headers:
 *         for header, values in headers.items():             # <<<<<<<<<<<<<<
 *             if isinstance(values, (str, bytes)):
 *                 values = (values,)
 */
    __pyx_t_10 = 0;
    if (unlikely(__pyx_v_headers == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 1720, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_headers, 0, __pyx_n_s_items, (&__pyx_t_11), (&__pyx_t_7)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6);
    __pyx_t_6 = __pyx_t_5;
    __pyx_t_5 = 0;
    while (1) {
      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_11, &__pyx_t_10, &__pyx_t_5, &__pyx_t_4, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_12 == 0)) break;
      if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_header, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1721
 *     if headers:
 *         for header, values in headers.items():
 *             if isinstance(values, (str, bytes)):             # <<<<<<<<<<<<<<
 *                 values = (values,)
 *             # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 */
      __pyx_t_13 = PyUnicode_Check(__pyx_v_values); 
      __pyx_t_14 = (__pyx_t_13 != 0);
      if (!__pyx_t_14) {
      } else {
        __pyx_t_9 = __pyx_t_14;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_14 = PyBytes_Check(__pyx_v_values); 
      __pyx_t_13 = (__pyx_t_14 != 0);
      __pyx_t_9 = __pyx_t_13;
      __pyx_L20_bool_binop_done:;
      __pyx_t_13 = (__pyx_t_9 != 0);
      if (__pyx_t_13) {

        /* "pyarrow/_flight.pyx":1722
 *         for header, values in headers.items():
 *             if isinstance(values, (str, bytes)):
 *                 values = (values,)             # <<<<<<<<<<<<<<
 *             # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 *             # valid ASCII.
 */
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1722, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_values);
        __Pyx_GIVEREF(__pyx_v_values);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_values);
        __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pyarrow/_flight.pyx":1721
 *     if headers:
 *         for header, values in headers.items():
 *             if isinstance(values, (str, bytes)):             # <<<<<<<<<<<<<<
 *                 values = (values,)
 *             # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 */
      }

      /* "pyarrow/_flight.pyx":1725
 *             # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 *             # valid ASCII.
 *             if isinstance(header, str):             # <<<<<<<<<<<<<<
 *                 header = header.encode("ascii")
 *             for value in values:
 */
      __pyx_t_13 = PyUnicode_Check(__pyx_v_header); 
      __pyx_t_9 = (__pyx_t_13 != 0);
      if (__pyx_t_9) {

        /* "pyarrow/_flight.pyx":1726
 *             # valid ASCII.
 *             if isinstance(header, str):
 *                 header = header.encode("ascii")             # <<<<<<<<<<<<<<
 *             for value in values:
 *                 if isinstance(value, str):
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_header, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_4 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_15, __pyx_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_u_ascii);
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_header, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pyarrow/_flight.pyx":1725
 *             # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 *             # valid ASCII.
 *             if isinstance(header, str):             # <<<<<<<<<<<<<<
 *                 header = header.encode("ascii")
 *             for value in values:
 */
      }

      /* "pyarrow/_flight.pyx":1727
 *             if isinstance(header, str):
 *                 header = header.encode("ascii")
 *             for value in values:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, str):
 *                     value = value.encode("ascii")
 */
      if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
        __pyx_t_4 = __pyx_v_values; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
      } else {
        __pyx_t_16 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1727, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_17 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1727, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_17)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_5); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 1727, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1727, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          } else {
            if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_5); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 1727, __pyx_L1_error)
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1727, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            #endif
          }
        } else {
          __pyx_t_5 = __pyx_t_17(__pyx_t_4);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1727, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pyarrow/_flight.pyx":1728
 *                 header = header.encode("ascii")
 *             for value in values:
 *                 if isinstance(value, str):             # <<<<<<<<<<<<<<
 *                     value = value.encode("ascii")
 *                 add_headers.AddHeader(header, value)
 */
        __pyx_t_9 = PyUnicode_Check(__pyx_v_value); 
        __pyx_t_13 = (__pyx_t_9 != 0);
        if (__pyx_t_13) {

          /* "pyarrow/_flight.pyx":1729
 *             for value in values:
 *                 if isinstance(value, str):
 *                     value = value.encode("ascii")             # <<<<<<<<<<<<<<
 *                 add_headers.AddHeader(header, value)
 * 
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1729, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_18 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_18)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_18);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
            }
          }
          __pyx_t_5 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_18, __pyx_n_u_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_n_u_ascii);
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1729, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "pyarrow/_flight.pyx":1728
 *                 header = header.encode("ascii")
 *             for value in values:
 *                 if isinstance(value, str):             # <<<<<<<<<<<<<<
 *                     value = value.encode("ascii")
 *                 add_headers.AddHeader(header, value)
 */
        }

        /* "pyarrow/_flight.pyx":1730
 *                 if isinstance(value, str):
 *                     value = value.encode("ascii")
 *                 add_headers.AddHeader(header, value)             # <<<<<<<<<<<<<<
 * 
 *     return CStatus_OK()
 */
        __pyx_t_19 = __pyx_convert_string_from_py_std__in_string(__pyx_v_header); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1730, __pyx_L1_error)
        __pyx_t_20 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1730, __pyx_L1_error)
        __pyx_v_add_headers->AddHeader(__pyx_t_19, __pyx_t_20);

        /* "pyarrow/_flight.pyx":1727
 *             if isinstance(header, str):
 *                 header = header.encode("ascii")
 *             for value in values:             # <<<<<<<<<<<<<<
 *                 if isinstance(value, str):
 *                     value = value.encode("ascii")
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pyarrow/_flight.pyx":1719
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if headers:             # <<<<<<<<<<<<<<
 *         for header, values in headers.items():
 *             if isinstance(values, (str, bytes)):
 */
  }

  /* "pyarrow/_flight.pyx":1732
 *                 add_headers.AddHeader(header, value)
 * 
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1711
 * 
 * 
 * cdef CStatus _middleware_sending_headers(             # <<<<<<<<<<<<<<
 *         void* self, CAddCallHeaders* add_headers) except *:
 *     """Callback for implementing middleware."""
 */

  /* 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_15);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("pyarrow._flight._middleware_sending_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_XDECREF(__pyx_v_header);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1735
 * 
 * 
 * cdef CStatus _middleware_call_completed(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CStatus& call_status) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_call_completed(void *__pyx_v_self, arrow::Status const &__pyx_v_call_status) {
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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;
  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;
  arrow::Status __pyx_t_22;
  __Pyx_RefNannySetupContext("_middleware_call_completed", 0);

  /* "pyarrow/_flight.pyx":1739
 *         const CStatus& call_status) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             check_flight_status(call_status)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1740
 *     """Callback for implementing middleware."""
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             check_flight_status(call_status)
 *         except Exception as e:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        /*try:*/ {

          /* "pyarrow/_flight.pyx":1741
 *     try:
 *         try:
 *             check_flight_status(call_status)             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             (<object> self).call_completed(e)
 */
          __pyx_t_7 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_call_status); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1741, __pyx_L9_error)

          /* "pyarrow/_flight.pyx":1740
 *     """Callback for implementing middleware."""
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             check_flight_status(call_status)
 *         except Exception as e:
 */
        }

        /* "pyarrow/_flight.pyx":1745
 *             (<object> self).call_completed(e)
 *         else:
 *             (<object> self).call_completed(None)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
        /*else:*/ {
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_call_completed); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1745, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
            }
          }
          __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, Py_None) : __Pyx_PyObject_CallOneArg(__pyx_t_9, Py_None);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1745, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __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_L14_try_end;
        __pyx_L9_error:;

        /* "pyarrow/_flight.pyx":1742
 *         try:
 *             check_flight_status(call_status)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             (<object> self).call_completed(e)
 *         else:
 */
        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_7) {
          __Pyx_AddTraceback("pyarrow._flight._middleware_call_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 1742, __pyx_L11_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __pyx_v_e = __pyx_t_9;
          /*try:*/ {

            /* "pyarrow/_flight.pyx":1743
 *             check_flight_status(call_status)
 *         except Exception as e:
 *             (<object> self).call_completed(e)             # <<<<<<<<<<<<<<
 *         else:
 *             (<object> self).call_completed(None)
 */
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_call_completed); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1743, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_12);
            __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_11 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_v_e) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_e);
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1743, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }

          /* "pyarrow/_flight.pyx":1742
 *         try:
 *             check_flight_status(call_status)
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             (<object> self).call_completed(e)
 *         else:
 */
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_DECREF(__pyx_v_e);
              __pyx_v_e = NULL;
              goto __pyx_L21;
            }
            __pyx_L20_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_11); __pyx_t_11 = 0;
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 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_7 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
              {
                __Pyx_DECREF(__pyx_v_e);
                __pyx_v_e = 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_7; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
              goto __pyx_L11_except_error;
            }
            __pyx_L21:;
          }
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          goto __pyx_L10_exception_handled;
        }
        goto __pyx_L11_except_error;
        __pyx_L11_except_error:;

        /* "pyarrow/_flight.pyx":1740
 *     """Callback for implementing middleware."""
 *     try:
 *         try:             # <<<<<<<<<<<<<<
 *             check_flight_status(call_status)
 *         except Exception as e:
 */
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L3_error;
        __pyx_L10_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_L14_try_end:;
      }

      /* "pyarrow/_flight.pyx":1739
 *         const CStatus& call_status) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             check_flight_status(call_status)
 */
    }
    __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_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_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pyarrow/_flight.pyx":1746
 *         else:
 *             (<object> self).call_completed(None)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("pyarrow._flight._middleware_call_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0) __PYX_ERR(0, 1746, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_v_flight_error = __pyx_t_9;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1747
 *             (<object> self).call_completed(None)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __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;
        goto __pyx_L30_return;
      }

      /* "pyarrow/_flight.pyx":1746
 *         else:
 *             (<object> self).call_completed(None)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L30_return: {
          __pyx_t_22 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_22;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1739
 *         const CStatus& call_status) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         try:
 *             check_flight_status(call_status)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1748
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1735
 * 
 * 
 * cdef CStatus _middleware_call_completed(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CStatus& call_status) except *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_AddTraceback("pyarrow._flight._middleware_call_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1751
 * 
 * 
 * cdef CStatus _middleware_received_headers(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallHeaders& c_headers) except *:
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__middleware_received_headers(void *__pyx_v_self,  arrow::flight::CallHeaders const &__pyx_v_c_headers) {
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  arrow::Status __pyx_t_8;
  __Pyx_RefNannySetupContext("_middleware_received_headers", 0);

  /* "pyarrow/_flight.pyx":1755
 *         const CCallHeaders& c_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1756
 *     """Callback for implementing middleware."""
 *     try:
 *         headers = convert_headers(c_headers)             # <<<<<<<<<<<<<<
 *         (<object> self).received_headers(headers)
 *     except FlightError as flight_error:
 */
      __pyx_t_4 = __pyx_f_7pyarrow_7_flight_convert_headers(__pyx_v_c_headers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1756, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_headers = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1757
 *     try:
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_received_headers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1757, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_headers) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_headers);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1757, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1755
 *         const CCallHeaders& c_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)
 */
    }
    __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;

    /* "pyarrow/_flight.pyx":1758
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._middleware_received_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1758, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1759
 *         (<object> self).received_headers(headers)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 *     return CStatus_OK()
 * 
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1758
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_8 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_8;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1755
 *         const CCallHeaders& c_headers) except *:
 *     """Callback for implementing middleware."""
 *     try:             # <<<<<<<<<<<<<<
 *         headers = convert_headers(c_headers)
 *         (<object> self).received_headers(headers)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1760
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1751
 * 
 * 
 * cdef CStatus _middleware_received_headers(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallHeaders& c_headers) except *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight._middleware_received_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1763
 * 
 * 
 * cdef dict convert_headers(const CCallHeaders& c_headers):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CCallHeaders.const_iterator header_iter = c_headers.cbegin()
 */

static PyObject *__pyx_f_7pyarrow_7_flight_convert_headers( arrow::flight::CallHeaders const &__pyx_v_c_headers) {
   arrow::flight::CallHeaders::const_iterator __pyx_v_header_iter;
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_header = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  std::string __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("convert_headers", 0);

  /* "pyarrow/_flight.pyx":1765
 * cdef dict convert_headers(const CCallHeaders& c_headers):
 *     cdef:
 *         CCallHeaders.const_iterator header_iter = c_headers.cbegin()             # <<<<<<<<<<<<<<
 *     headers = {}
 *     while header_iter != c_headers.cend():
 */
  __pyx_v_header_iter = __pyx_v_c_headers.cbegin();

  /* "pyarrow/_flight.pyx":1766
 *     cdef:
 *         CCallHeaders.const_iterator header_iter = c_headers.cbegin()
 *     headers = {}             # <<<<<<<<<<<<<<
 *     while header_iter != c_headers.cend():
 *         # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_headers = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1767
 *         CCallHeaders.const_iterator header_iter = c_headers.cbegin()
 *     headers = {}
 *     while header_iter != c_headers.cend():             # <<<<<<<<<<<<<<
 *         # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 *         # valid ASCII.
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_header_iter != __pyx_v_c_headers.cend()) != 0);
    if (!__pyx_t_2) break;

    /* "pyarrow/_flight.pyx":1770
 *         # Headers in gRPC (and HTTP/1, HTTP/2) are required to be
 *         # valid ASCII.
 *         header = c_string(deref(header_iter).first).decode("ascii")             # <<<<<<<<<<<<<<
 *         if not header.endswith("-bin"):
 *             # Ignore -bin (gRPC binary) headers
 */
    try {
      __pyx_t_3 = std::string((*__pyx_v_header_iter).first);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1770, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_header, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":1771
 *         # valid ASCII.
 *         header = c_string(deref(header_iter).first).decode("ascii")
 *         if not header.endswith("-bin"):             # <<<<<<<<<<<<<<
 *             # Ignore -bin (gRPC binary) headers
 *             value = c_string(deref(header_iter).second).decode("ascii")
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_header, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_bin) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_bin);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = ((!__pyx_t_2) != 0);
    if (__pyx_t_6) {

      /* "pyarrow/_flight.pyx":1773
 *         if not header.endswith("-bin"):
 *             # Ignore -bin (gRPC binary) headers
 *             value = c_string(deref(header_iter).second).decode("ascii")             # <<<<<<<<<<<<<<
 *             if header not in headers:
 *                 headers[header] = []
 */
      try {
        __pyx_t_3 = std::string((*__pyx_v_header_iter).second);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 1773, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1774
 *             # Ignore -bin (gRPC binary) headers
 *             value = c_string(deref(header_iter).second).decode("ascii")
 *             if header not in headers:             # <<<<<<<<<<<<<<
 *                 headers[header] = []
 *             headers[header].append(value)
 */
      __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_v_header, __pyx_v_headers, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1774, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_6 != 0);
      if (__pyx_t_2) {

        /* "pyarrow/_flight.pyx":1775
 *             value = c_string(deref(header_iter).second).decode("ascii")
 *             if header not in headers:
 *                 headers[header] = []             # <<<<<<<<<<<<<<
 *             headers[header].append(value)
 *         postincrement(header_iter)
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyDict_SetItem(__pyx_v_headers, __pyx_v_header, __pyx_t_1) < 0)) __PYX_ERR(0, 1775, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyarrow/_flight.pyx":1774
 *             # Ignore -bin (gRPC binary) headers
 *             value = c_string(deref(header_iter).second).decode("ascii")
 *             if header not in headers:             # <<<<<<<<<<<<<<
 *                 headers[header] = []
 *             headers[header].append(value)
 */
      }

      /* "pyarrow/_flight.pyx":1776
 *             if header not in headers:
 *                 headers[header] = []
 *             headers[header].append(value)             # <<<<<<<<<<<<<<
 *         postincrement(header_iter)
 *     return headers
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_headers, __pyx_v_header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_value); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1776, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":1771
 *         # valid ASCII.
 *         header = c_string(deref(header_iter).first).decode("ascii")
 *         if not header.endswith("-bin"):             # <<<<<<<<<<<<<<
 *             # Ignore -bin (gRPC binary) headers
 *             value = c_string(deref(header_iter).second).decode("ascii")
 */
    }

    /* "pyarrow/_flight.pyx":1777
 *                 headers[header] = []
 *             headers[header].append(value)
 *         postincrement(header_iter)             # <<<<<<<<<<<<<<
 *     return headers
 * 
 */
    (void)((__pyx_v_header_iter++));
  }

  /* "pyarrow/_flight.pyx":1778
 *             headers[header].append(value)
 *         postincrement(header_iter)
 *     return headers             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_headers);
  __pyx_r = __pyx_v_headers;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1763
 * 
 * 
 * cdef dict convert_headers(const CCallHeaders& c_headers):             # <<<<<<<<<<<<<<
 *     cdef:
 *         CCallHeaders.const_iterator header_iter = c_headers.cbegin()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyarrow._flight.convert_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_header);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1781
 * 
 * 
 * cdef CStatus _server_middleware_start_call(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallInfo& c_info,
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__server_middleware_start_call(void *__pyx_v_self,  arrow::flight::CallInfo const &__pyx_v_c_info,  arrow::flight::CallHeaders const &__pyx_v_c_headers, std::shared_ptr< arrow::flight::ServerMiddleware>  *__pyx_v_c_instance) {
  PyObject *__pyx_v_instance = NULL;
  PyObject *__pyx_v_call_info = NULL;
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  arrow::Status __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_server_middleware_start_call", 0);

  /* "pyarrow/_flight.pyx":1787
 *         shared_ptr[CServerMiddleware]* c_instance) except *:
 *     """Callback for implementing server middleware."""
 *     instance = None             # <<<<<<<<<<<<<<
 *     try:
 *         call_info = wrap_call_info(c_info)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_instance = Py_None;

  /* "pyarrow/_flight.pyx":1788
 *     """Callback for implementing server middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         headers = convert_headers(c_headers)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1789
 *     instance = None
 *     try:
 *         call_info = wrap_call_info(c_info)             # <<<<<<<<<<<<<<
 *         headers = convert_headers(c_headers)
 *         instance = (<object> self).start_call(call_info, headers)
 */
      __pyx_t_4 = __pyx_f_7pyarrow_7_flight_wrap_call_info(__pyx_v_c_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_call_info = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1790
 *     try:
 *         call_info = wrap_call_info(c_info)
 *         headers = convert_headers(c_headers)             # <<<<<<<<<<<<<<
 *         instance = (<object> self).start_call(call_info, headers)
 *     except FlightError as flight_error:
 */
      __pyx_t_4 = __pyx_f_7pyarrow_7_flight_convert_headers(__pyx_v_c_headers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_headers = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1791
 *         call_info = wrap_call_info(c_info)
 *         headers = convert_headers(c_headers)
 *         instance = (<object> self).start_call(call_info, headers)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start_call); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_v_call_info, __pyx_v_headers};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L3_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_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_call_info, __pyx_v_headers};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1791, __pyx_L3_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_v_call_info);
        __Pyx_GIVEREF(__pyx_v_call_info);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_call_info);
        __Pyx_INCREF(__pyx_v_headers);
        __Pyx_GIVEREF(__pyx_v_headers);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_headers);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_instance, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1788
 *     """Callback for implementing server middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         headers = convert_headers(c_headers)
 */
    }
    __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_8); __pyx_t_8 = 0;

    /* "pyarrow/_flight.pyx":1792
 *         headers = convert_headers(c_headers)
 *         instance = (<object> self).start_call(call_info, headers)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._server_middleware_start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1792, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1793
 *         instance = (<object> self).start_call(call_info, headers)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 * 
 *     if instance:
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1792
 *         headers = convert_headers(c_headers)
 *         instance = (<object> self).start_call(call_info, headers)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_9 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_9;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1788
 *     """Callback for implementing server middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         headers = convert_headers(c_headers)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1795
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if instance:             # <<<<<<<<<<<<<<
 *         ServerMiddleware.wrap(instance, c_instance)
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_instance); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1795, __pyx_L1_error)
  if (__pyx_t_10) {

    /* "pyarrow/_flight.pyx":1796
 * 
 *     if instance:
 *         ServerMiddleware.wrap(instance, c_instance)             # <<<<<<<<<<<<<<
 * 
 *     return CStatus_OK()
 */
    __pyx_f_7pyarrow_7_flight_16ServerMiddleware_wrap(__pyx_v_instance, __pyx_v_c_instance);

    /* "pyarrow/_flight.pyx":1795
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if instance:             # <<<<<<<<<<<<<<
 *         ServerMiddleware.wrap(instance, c_instance)
 * 
 */
  }

  /* "pyarrow/_flight.pyx":1798
 *         ServerMiddleware.wrap(instance, c_instance)
 * 
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1781
 * 
 * 
 * cdef CStatus _server_middleware_start_call(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallInfo& c_info,
 */

  /* 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_8);
  __Pyx_AddTraceback("pyarrow._flight._server_middleware_start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instance);
  __Pyx_XDECREF(__pyx_v_call_info);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1801
 * 
 * 
 * cdef CStatus _client_middleware_start_call(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallInfo& c_info,
 */

static arrow::Status __pyx_f_7pyarrow_7_flight__client_middleware_start_call(void *__pyx_v_self,  arrow::flight::CallInfo const &__pyx_v_c_info, std::unique_ptr< arrow::flight::ClientMiddleware>  *__pyx_v_c_instance) {
  PyObject *__pyx_v_instance = NULL;
  PyObject *__pyx_v_call_info = NULL;
  PyObject *__pyx_v_flight_error = NULL;
  arrow::Status __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  arrow::Status __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_client_middleware_start_call", 0);

  /* "pyarrow/_flight.pyx":1806
 *         unique_ptr[CClientMiddleware]* c_instance) except *:
 *     """Callback for implementing client middleware."""
 *     instance = None             # <<<<<<<<<<<<<<
 *     try:
 *         call_info = wrap_call_info(c_info)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_instance = Py_None;

  /* "pyarrow/_flight.pyx":1807
 *     """Callback for implementing client middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)
 */
  {
    __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:*/ {

      /* "pyarrow/_flight.pyx":1808
 *     instance = None
 *     try:
 *         call_info = wrap_call_info(c_info)             # <<<<<<<<<<<<<<
 *         instance = (<object> self).start_call(call_info)
 *     except FlightError as flight_error:
 */
      __pyx_t_4 = __pyx_f_7pyarrow_7_flight_wrap_call_info(__pyx_v_c_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1808, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_call_info = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1809
 *     try:
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)             # <<<<<<<<<<<<<<
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_start_call); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_call_info) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_call_info);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_instance, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pyarrow/_flight.pyx":1807
 *     """Callback for implementing client middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)
 */
    }
    __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;

    /* "pyarrow/_flight.pyx":1810
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pyarrow._flight._client_middleware_start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1810, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_flight_error = __pyx_t_5;
      /*try:*/ {

        /* "pyarrow/_flight.pyx":1811
 *         instance = (<object> self).start_call(call_info)
 *     except FlightError as flight_error:
 *         return (<FlightError> flight_error).to_status()             # <<<<<<<<<<<<<<
 * 
 *     if instance:
 */
        __pyx_r = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError *)((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error)->__pyx_vtab)->to_status(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v_flight_error));
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_return;
      }

      /* "pyarrow/_flight.pyx":1810
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)
 *     except FlightError as flight_error:             # <<<<<<<<<<<<<<
 *         return (<FlightError> flight_error).to_status()
 * 
 */
      /*finally:*/ {
        __pyx_L13_return: {
          __pyx_t_8 = __pyx_r;
          __Pyx_DECREF(__pyx_v_flight_error);
          __pyx_v_flight_error = NULL;
          __pyx_r = __pyx_t_8;
          goto __pyx_L6_except_return;
        }
      }
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pyarrow/_flight.pyx":1807
 *     """Callback for implementing client middleware."""
 *     instance = None
 *     try:             # <<<<<<<<<<<<<<
 *         call_info = wrap_call_info(c_info)
 *         instance = (<object> self).start_call(call_info)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "pyarrow/_flight.pyx":1813
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if instance:             # <<<<<<<<<<<<<<
 *         ClientMiddleware.wrap(instance, c_instance)
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_instance); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1813, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "pyarrow/_flight.pyx":1814
 * 
 *     if instance:
 *         ClientMiddleware.wrap(instance, c_instance)             # <<<<<<<<<<<<<<
 * 
 *     return CStatus_OK()
 */
    __pyx_f_7pyarrow_7_flight_16ClientMiddleware_wrap(__pyx_v_instance, __pyx_v_c_instance);

    /* "pyarrow/_flight.pyx":1813
 *         return (<FlightError> flight_error).to_status()
 * 
 *     if instance:             # <<<<<<<<<<<<<<
 *         ClientMiddleware.wrap(instance, c_instance)
 * 
 */
  }

  /* "pyarrow/_flight.pyx":1816
 *         ClientMiddleware.wrap(instance, c_instance)
 * 
 *     return CStatus_OK()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = arrow::Status::OK();
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1801
 * 
 * 
 * cdef CStatus _client_middleware_start_call(             # <<<<<<<<<<<<<<
 *         void* self,
 *         const CCallInfo& c_info,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyarrow._flight._client_middleware_start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instance);
  __Pyx_XDECREF(__pyx_v_call_info);
  __Pyx_XDECREF(__pyx_v_flight_error);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1827
 *     """
 * 
 *     def authenticate(self, outgoing, incoming):             # <<<<<<<<<<<<<<
 *         """Conduct the handshake with the client.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_1authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_authenticate[] = "ServerAuthHandler.authenticate(self, outgoing, incoming)\nConduct the handshake with the client.\n\n        May raise an error if the client cannot authenticate.\n\n        Parameters\n        ----------\n        outgoing : ServerAuthSender\n            A channel to send messages to the client.\n        incoming : ServerAuthReader\n            A channel to read messages from the client.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_1authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_outgoing = 0;
  CYTHON_UNUSED PyObject *__pyx_v_incoming = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("authenticate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outgoing,&__pyx_n_s_incoming,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_outgoing)) != 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_incoming)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("authenticate", 1, 2, 2, 1); __PYX_ERR(0, 1827, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "authenticate") < 0)) __PYX_ERR(0, 1827, __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_outgoing = values[0];
    __pyx_v_incoming = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("authenticate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1827, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthHandler.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_authenticate(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_self), __pyx_v_outgoing, __pyx_v_incoming);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_authenticate(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_outgoing, CYTHON_UNUSED PyObject *__pyx_v_incoming) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("authenticate", 0);

  /* "pyarrow/_flight.pyx":1839
 *             A channel to read messages from the client.
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def is_valid(self, token):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1839, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1827
 *     """
 * 
 *     def authenticate(self, outgoing, incoming):             # <<<<<<<<<<<<<<
 *         """Conduct the handshake with the client.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthHandler.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1841
 *         raise NotImplementedError
 * 
 *     def is_valid(self, token):             # <<<<<<<<<<<<<<
 *         """Validate a client token, returning their identity.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_3is_valid(PyObject *__pyx_v_self, PyObject *__pyx_v_token); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_2is_valid[] = "ServerAuthHandler.is_valid(self, token)\nValidate a client token, returning their identity.\n\n        May return an empty string (if the auth mechanism does not\n        name the peer) or raise an exception (if the token is\n        invalid).\n\n        Parameters\n        ----------\n        token : bytes\n            The authentication token from the client.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_3is_valid(PyObject *__pyx_v_self, PyObject *__pyx_v_token) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_valid (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_2is_valid(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_self), ((PyObject *)__pyx_v_token));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_2is_valid(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_token) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_valid", 0);

  /* "pyarrow/_flight.pyx":1854
 * 
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     cdef PyServerAuthHandler* to_handler(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1854, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1841
 *         raise NotImplementedError
 * 
 *     def is_valid(self, token):             # <<<<<<<<<<<<<<
 *         """Validate a client token, returning their identity.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthHandler.is_valid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1856
 *         raise NotImplementedError
 * 
 *     cdef PyServerAuthHandler* to_handler(self):             # <<<<<<<<<<<<<<
 *         cdef PyServerAuthHandlerVtable vtable
 *         vtable.authenticate = _server_authenticate
 */

static  arrow::py::flight::PyServerAuthHandler *__pyx_f_7pyarrow_7_flight_17ServerAuthHandler_to_handler(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self) {
  arrow::py::flight::PyServerAuthHandlerVtable __pyx_v_vtable;
   arrow::py::flight::PyServerAuthHandler *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_handler", 0);

  /* "pyarrow/_flight.pyx":1858
 *     cdef PyServerAuthHandler* to_handler(self):
 *         cdef PyServerAuthHandlerVtable vtable
 *         vtable.authenticate = _server_authenticate             # <<<<<<<<<<<<<<
 *         vtable.is_valid = _is_valid
 *         return new PyServerAuthHandler(self, vtable)
 */
  __pyx_v_vtable.authenticate = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_server_authenticate> )__pyx_f_7pyarrow_7_flight__server_authenticate);

  /* "pyarrow/_flight.pyx":1859
 *         cdef PyServerAuthHandlerVtable vtable
 *         vtable.authenticate = _server_authenticate
 *         vtable.is_valid = _is_valid             # <<<<<<<<<<<<<<
 *         return new PyServerAuthHandler(self, vtable)
 * 
 */
  __pyx_v_vtable.is_valid = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_is_valid> )__pyx_f_7pyarrow_7_flight__is_valid);

  /* "pyarrow/_flight.pyx":1860
 *         vtable.authenticate = _server_authenticate
 *         vtable.is_valid = _is_valid
 *         return new PyServerAuthHandler(self, vtable)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = new  arrow::py::flight::PyServerAuthHandler(((PyObject *)__pyx_v_self), __pyx_v_vtable);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1856
 *         raise NotImplementedError
 * 
 *     cdef PyServerAuthHandler* to_handler(self):             # <<<<<<<<<<<<<<
 *         cdef PyServerAuthHandlerVtable vtable
 *         vtable.authenticate = _server_authenticate
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_4__reduce_cython__[] = "ServerAuthHandler.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_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_7pyarrow_7_flight_17ServerAuthHandler_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ServerAuthHandler); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerAuthHandler__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ServerAuthHandler); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ServerAuthHandler.__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_ServerAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerAuthHandler__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_6__setstate_cython__[] = "ServerAuthHandler.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_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_7pyarrow_7_flight_17ServerAuthHandler_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ServerAuthHandler_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ServerAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerAuthHandler__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerAuthHandler__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ServerAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerAuthHandler__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("pyarrow._flight.ServerAuthHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1866
 *     """Authentication plugin for a client."""
 * 
 *     def authenticate(self, outgoing, incoming):             # <<<<<<<<<<<<<<
 *         """Conduct the handshake with the server.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_1authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_authenticate[] = "ClientAuthHandler.authenticate(self, outgoing, incoming)\nConduct the handshake with the server.\n\n        Parameters\n        ----------\n        outgoing : ClientAuthSender\n            A channel to send messages to the server.\n        incoming : ClientAuthReader\n            A channel to read messages from the server.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_1authenticate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_outgoing = 0;
  CYTHON_UNUSED PyObject *__pyx_v_incoming = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("authenticate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_outgoing,&__pyx_n_s_incoming,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_outgoing)) != 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_incoming)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("authenticate", 1, 2, 2, 1); __PYX_ERR(0, 1866, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "authenticate") < 0)) __PYX_ERR(0, 1866, __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_outgoing = values[0];
    __pyx_v_incoming = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("authenticate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthHandler.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_authenticate(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_self), __pyx_v_outgoing, __pyx_v_incoming);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_authenticate(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_outgoing, CYTHON_UNUSED PyObject *__pyx_v_incoming) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("authenticate", 0);

  /* "pyarrow/_flight.pyx":1876
 *             A channel to read messages from the server.
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def get_token(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1876, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1866
 *     """Authentication plugin for a client."""
 * 
 *     def authenticate(self, outgoing, incoming):             # <<<<<<<<<<<<<<
 *         """Conduct the handshake with the server.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthHandler.authenticate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1878
 *         raise NotImplementedError
 * 
 *     def get_token(self):             # <<<<<<<<<<<<<<
 *         """Get the auth token for a call."""
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_3get_token(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_2get_token[] = "ClientAuthHandler.get_token(self)\nGet the auth token for a call.";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_3get_token(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_token (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_2get_token(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_2get_token(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_token", 0);

  /* "pyarrow/_flight.pyx":1880
 *     def get_token(self):
 *         """Get the auth token for a call."""
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     cdef PyClientAuthHandler* to_handler(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1880, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":1878
 *         raise NotImplementedError
 * 
 *     def get_token(self):             # <<<<<<<<<<<<<<
 *         """Get the auth token for a call."""
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthHandler.get_token", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1882
 *         raise NotImplementedError
 * 
 *     cdef PyClientAuthHandler* to_handler(self):             # <<<<<<<<<<<<<<
 *         cdef PyClientAuthHandlerVtable vtable
 *         vtable.authenticate = _client_authenticate
 */

static  arrow::py::flight::PyClientAuthHandler *__pyx_f_7pyarrow_7_flight_17ClientAuthHandler_to_handler(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self) {
  arrow::py::flight::PyClientAuthHandlerVtable __pyx_v_vtable;
   arrow::py::flight::PyClientAuthHandler *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_handler", 0);

  /* "pyarrow/_flight.pyx":1884
 *     cdef PyClientAuthHandler* to_handler(self):
 *         cdef PyClientAuthHandlerVtable vtable
 *         vtable.authenticate = _client_authenticate             # <<<<<<<<<<<<<<
 *         vtable.get_token = _get_token
 *         return new PyClientAuthHandler(self, vtable)
 */
  __pyx_v_vtable.authenticate = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_authenticate> )__pyx_f_7pyarrow_7_flight__client_authenticate);

  /* "pyarrow/_flight.pyx":1885
 *         cdef PyClientAuthHandlerVtable vtable
 *         vtable.authenticate = _client_authenticate
 *         vtable.get_token = _get_token             # <<<<<<<<<<<<<<
 *         return new PyClientAuthHandler(self, vtable)
 * 
 */
  __pyx_v_vtable.get_token = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_token> )__pyx_f_7pyarrow_7_flight__get_token);

  /* "pyarrow/_flight.pyx":1886
 *         vtable.authenticate = _client_authenticate
 *         vtable.get_token = _get_token
 *         return new PyClientAuthHandler(self, vtable)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = new  arrow::py::flight::PyClientAuthHandler(((PyObject *)__pyx_v_self), __pyx_v_vtable);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":1882
 *         raise NotImplementedError
 * 
 *     cdef PyClientAuthHandler* to_handler(self):             # <<<<<<<<<<<<<<
 *         cdef PyClientAuthHandlerVtable vtable
 *         vtable.authenticate = _client_authenticate
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_4__reduce_cython__[] = "ClientAuthHandler.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_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_7pyarrow_7_flight_17ClientAuthHandler_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ClientAuthHandler); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientAuthHandler__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ClientAuthHandler); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ClientAuthHandler.__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_ClientAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientAuthHandler__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_6__setstate_cython__[] = "ClientAuthHandler.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_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_7pyarrow_7_flight_17ClientAuthHandler_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_17ClientAuthHandler_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ClientAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientAuthHandler__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientAuthHandler__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ClientAuthHandler, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientAuthHandler__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("pyarrow._flight.ClientAuthHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1896
 * 
 * 
 * cdef wrap_call_info(const CCallInfo& c_info):             # <<<<<<<<<<<<<<
 *     method = wrap_flight_method(c_info.method)
 *     return CallInfo(method=method)
 */

static PyObject *__pyx_f_7pyarrow_7_flight_wrap_call_info( arrow::flight::CallInfo const &__pyx_v_c_info) {
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("wrap_call_info", 0);

  /* "pyarrow/_flight.pyx":1897
 * 
 * cdef wrap_call_info(const CCallInfo& c_info):
 *     method = wrap_flight_method(c_info.method)             # <<<<<<<<<<<<<<
 *     return CallInfo(method=method)
 * 
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_wrap_flight_method(__pyx_v_c_info.method); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_method = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":1898
 * cdef wrap_call_info(const CCallInfo& c_info):
 *     method = wrap_flight_method(c_info.method)
 *     return CallInfo(method=method)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CallInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_method, __pyx_v_method) < 0) __PYX_ERR(0, 1898, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1898, __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;

  /* "pyarrow/_flight.pyx":1896
 * 
 * 
 * cdef wrap_call_info(const CCallInfo& c_info):             # <<<<<<<<<<<<<<
 *     method = wrap_flight_method(c_info.method)
 *     return CallInfo(method=method)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyarrow._flight.wrap_call_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1910
 *     """
 * 
 *     def start_call(self, info):             # <<<<<<<<<<<<<<
 *         """Called at the start of an RPC.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_1start_call(PyObject *__pyx_v_self, PyObject *__pyx_v_info); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_start_call[] = "ClientMiddlewareFactory.start_call(self, info)\nCalled at the start of an RPC.\n\n        This must be thread-safe and must not raise exceptions.\n\n        Parameters\n        ----------\n        info : CallInfo\n            Information about the call.\n\n        Returns\n        -------\n        instance : ClientMiddleware\n            An instance of ClientMiddleware (the instance to use for\n            the call), or None if this call is not intercepted.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_1start_call(PyObject *__pyx_v_self, PyObject *__pyx_v_info) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_call (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_start_call(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *)__pyx_v_self), ((PyObject *)__pyx_v_info));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_start_call(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_info) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_call", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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_7pyarrow_7_flight_23ClientMiddlewareFactory_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_2__reduce_cython__[] = "ClientMiddlewareFactory.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_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_7pyarrow_7_flight_23ClientMiddlewareFactory_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ClientMiddlewareF); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientMiddlewareFactory__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ClientMiddlewareF); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ClientMiddlewareFactory.__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_ClientMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientMiddlewareFactory__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_4__setstate_cython__[] = "ClientMiddlewareFactory.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_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_7pyarrow_7_flight_23ClientMiddlewareFactory_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ClientMiddlewareFactory_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ClientMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientMiddlewareFactory__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddlewareFactory__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ClientMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientMiddlewareFactory__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("pyarrow._flight.ClientMiddlewareFactory.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1937
 *     """
 * 
 *     def sending_headers(self):             # <<<<<<<<<<<<<<
 *         """A callback before headers are sent.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_1sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_sending_headers[] = "ClientMiddleware.sending_headers(self)\nA callback before headers are sent.\n\n        Returns\n        -------\n        headers : dict\n            A dictionary of header values to add to the request, or\n            None if no headers are to be added. The dictionary should\n            have string keys and string or list-of-string values. All\n            values should be ASCII-encodable.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_1sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sending_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientMiddleware_sending_headers(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_sending_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sending_headers", 0);

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

/* "pyarrow/_flight.pyx":1950
 *         """
 * 
 *     def received_headers(self, headers):             # <<<<<<<<<<<<<<
 *         """A callback when headers are received.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_3received_headers(PyObject *__pyx_v_self, PyObject *__pyx_v_headers); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_2received_headers[] = "ClientMiddleware.received_headers(self, headers)\nA callback when headers are received.\n\n        The default implementation does nothing.\n\n        Parameters\n        ----------\n        headers : dict\n            A dictionary of headers from the server. Keys are strings\n            and values are lists of strings.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_3received_headers(PyObject *__pyx_v_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("received_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientMiddleware_2received_headers(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v_self), ((PyObject *)__pyx_v_headers));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_2received_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("received_headers", 0);

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

/* "pyarrow/_flight.pyx":1963
 *         """
 * 
 *     def call_completed(self, exception):             # <<<<<<<<<<<<<<
 *         """A callback when the call finishes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_5call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_4call_completed[] = "ClientMiddleware.call_completed(self, exception)\nA callback when the call finishes.\n\n        The default implementation does nothing.\n\n        Parameters\n        ----------\n        exception : ArrowException\n            If the call errored, this is the equivalent\n            exception. Will be None if the call succeeded.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_5call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientMiddleware_4call_completed(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v_self), ((PyObject *)__pyx_v_exception));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_4call_completed(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call_completed", 0);

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

/* "pyarrow/_flight.pyx":1977
 * 
 *     @staticmethod
 *     cdef void wrap(object py_middleware,             # <<<<<<<<<<<<<<
 *                    unique_ptr[CClientMiddleware]* c_instance):
 *         cdef PyClientMiddlewareVtable vtable
 */

static void __pyx_f_7pyarrow_7_flight_16ClientMiddleware_wrap(PyObject *__pyx_v_py_middleware, std::unique_ptr< arrow::flight::ClientMiddleware>  *__pyx_v_c_instance) {
   arrow::py::flight::PyClientMiddleware::Vtable __pyx_v_vtable;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":1980
 *                    unique_ptr[CClientMiddleware]* c_instance):
 *         cdef PyClientMiddlewareVtable vtable
 *         vtable.sending_headers = _middleware_sending_headers             # <<<<<<<<<<<<<<
 *         vtable.received_headers = _middleware_received_headers
 *         vtable.call_completed = _middleware_call_completed
 */
  __pyx_v_vtable.sending_headers = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_sending_headers> )__pyx_f_7pyarrow_7_flight__middleware_sending_headers);

  /* "pyarrow/_flight.pyx":1981
 *         cdef PyClientMiddlewareVtable vtable
 *         vtable.sending_headers = _middleware_sending_headers
 *         vtable.received_headers = _middleware_received_headers             # <<<<<<<<<<<<<<
 *         vtable.call_completed = _middleware_call_completed
 *         c_instance[0].reset(new CPyClientMiddleware(py_middleware, vtable))
 */
  __pyx_v_vtable.received_headers = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_client_middleware_received_headers> )__pyx_f_7pyarrow_7_flight__middleware_received_headers);

  /* "pyarrow/_flight.pyx":1982
 *         vtable.sending_headers = _middleware_sending_headers
 *         vtable.received_headers = _middleware_received_headers
 *         vtable.call_completed = _middleware_call_completed             # <<<<<<<<<<<<<<
 *         c_instance[0].reset(new CPyClientMiddleware(py_middleware, vtable))
 * 
 */
  __pyx_v_vtable.call_completed = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_call_completed> )__pyx_f_7pyarrow_7_flight__middleware_call_completed);

  /* "pyarrow/_flight.pyx":1983
 *         vtable.received_headers = _middleware_received_headers
 *         vtable.call_completed = _middleware_call_completed
 *         c_instance[0].reset(new CPyClientMiddleware(py_middleware, vtable))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (__pyx_v_c_instance[0]).reset(new  arrow::py::flight::PyClientMiddleware(__pyx_v_py_middleware, __pyx_v_vtable));

  /* "pyarrow/_flight.pyx":1977
 * 
 *     @staticmethod
 *     cdef void wrap(object py_middleware,             # <<<<<<<<<<<<<<
 *                    unique_ptr[CClientMiddleware]* c_instance):
 *         cdef PyClientMiddlewareVtable vtable
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_6__reduce_cython__[] = "ClientMiddleware.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientMiddleware_6__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_6__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ClientMiddleware); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientMiddleware__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ClientMiddleware); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ClientMiddleware.__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_ClientMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientMiddleware__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_8__setstate_cython__[] = "ClientMiddleware.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ClientMiddleware_8__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ClientMiddleware_8__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ClientMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ClientMiddleware__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddleware__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ClientMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ClientMiddleware__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("pyarrow._flight.ClientMiddleware.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":1995
 *     """
 * 
 *     def start_call(self, info, headers):             # <<<<<<<<<<<<<<
 *         """Called at the start of an RPC.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_1start_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_start_call[] = "ServerMiddlewareFactory.start_call(self, info, headers)\nCalled at the start of an RPC.\n\n        This must be thread-safe.\n\n        Parameters\n        ----------\n        info : CallInfo\n            Information about the call.\n\n        headers : dict\n            A dictionary of headers from the client. Keys are strings\n            and values are lists of strings.\n\n        Returns\n        -------\n        instance : ServerMiddleware\n            An instance of ServerMiddleware (the instance to use for\n            the call), or None if this call is not intercepted.\n\n        Raises\n        ------\n        exception : pyarrow.ArrowException\n            If an exception is raised, the call will be rejected with\n            the given error.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_1start_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_info = 0;
  CYTHON_UNUSED PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_call (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_info,&__pyx_n_s_headers,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_info)) != 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_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("start_call", 1, 2, 2, 1); __PYX_ERR(0, 1995, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "start_call") < 0)) __PYX_ERR(0, 1995, __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_info = values[0];
    __pyx_v_headers = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start_call", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1995, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.ServerMiddlewareFactory.start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_start_call(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *)__pyx_v_self), __pyx_v_info, __pyx_v_headers);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_start_call(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_info, CYTHON_UNUSED PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_call", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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_7pyarrow_7_flight_23ServerMiddlewareFactory_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_2__reduce_cython__[] = "ServerMiddlewareFactory.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_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_7pyarrow_7_flight_23ServerMiddlewareFactory_2__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_2__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ServerMiddlewareF); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerMiddlewareFactory__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ServerMiddlewareF); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ServerMiddlewareFactory.__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_ServerMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerMiddlewareFactory__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_4__setstate_cython__[] = "ServerMiddlewareFactory.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_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_7pyarrow_7_flight_23ServerMiddlewareFactory_4__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_23ServerMiddlewareFactory_4__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ServerMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerMiddlewareFactory__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddlewareFactory__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ServerMiddlewareFactory, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerMiddlewareFactory__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("pyarrow._flight.ServerMiddlewareFactory.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2032
 *     """
 * 
 *     def sending_headers(self):             # <<<<<<<<<<<<<<
 *         """A callback before headers are sent.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_1sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_sending_headers[] = "ServerMiddleware.sending_headers(self)\nA callback before headers are sent.\n\n        Returns\n        -------\n        headers : dict\n            A dictionary of header values to add to the response, or\n            None if no headers are to be added. The dictionary should\n            have string keys and string or list-of-string values. All\n            headers should be ASCII-encodable.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_1sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sending_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ServerMiddleware_sending_headers(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_sending_headers(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sending_headers", 0);

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

/* "pyarrow/_flight.pyx":2045
 *         """
 * 
 *     def call_completed(self, exception):             # <<<<<<<<<<<<<<
 *         """A callback when the call finishes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_3call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_2call_completed[] = "ServerMiddleware.call_completed(self, exception)\nA callback when the call finishes.\n\n        Parameters\n        ----------\n        exception : pyarrow.ArrowException\n            If the call errored, this is the equivalent\n            exception. Will be None if the call succeeded.\n\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_3call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16ServerMiddleware_2call_completed(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *)__pyx_v_self), ((PyObject *)__pyx_v_exception));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_2call_completed(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call_completed", 0);

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

/* "pyarrow/_flight.pyx":2057
 * 
 *     @staticmethod
 *     cdef void wrap(object py_middleware,             # <<<<<<<<<<<<<<
 *                    shared_ptr[CServerMiddleware]* c_instance):
 *         cdef PyServerMiddlewareVtable vtable
 */

static void __pyx_f_7pyarrow_7_flight_16ServerMiddleware_wrap(PyObject *__pyx_v_py_middleware, std::shared_ptr< arrow::flight::ServerMiddleware>  *__pyx_v_c_instance) {
   arrow::py::flight::PyServerMiddleware::Vtable __pyx_v_vtable;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap", 0);

  /* "pyarrow/_flight.pyx":2060
 *                    shared_ptr[CServerMiddleware]* c_instance):
 *         cdef PyServerMiddlewareVtable vtable
 *         vtable.sending_headers = _middleware_sending_headers             # <<<<<<<<<<<<<<
 *         vtable.call_completed = _middleware_call_completed
 *         c_instance[0].reset(new CPyServerMiddleware(py_middleware, vtable))
 */
  __pyx_v_vtable.sending_headers = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_sending_headers> )__pyx_f_7pyarrow_7_flight__middleware_sending_headers);

  /* "pyarrow/_flight.pyx":2061
 *         cdef PyServerMiddlewareVtable vtable
 *         vtable.sending_headers = _middleware_sending_headers
 *         vtable.call_completed = _middleware_call_completed             # <<<<<<<<<<<<<<
 *         c_instance[0].reset(new CPyServerMiddleware(py_middleware, vtable))
 * 
 */
  __pyx_v_vtable.call_completed = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_middleware_call_completed> )__pyx_f_7pyarrow_7_flight__middleware_call_completed);

  /* "pyarrow/_flight.pyx":2062
 *         vtable.sending_headers = _middleware_sending_headers
 *         vtable.call_completed = _middleware_call_completed
 *         c_instance[0].reset(new CPyServerMiddleware(py_middleware, vtable))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  (__pyx_v_c_instance[0]).reset(new  arrow::py::flight::PyServerMiddleware(__pyx_v_py_middleware, __pyx_v_vtable));

  /* "pyarrow/_flight.pyx":2057
 * 
 *     @staticmethod
 *     cdef void wrap(object py_middleware,             # <<<<<<<<<<<<<<
 *                    shared_ptr[CServerMiddleware]* c_instance):
 *         cdef PyServerMiddlewareVtable vtable
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_4__reduce_cython__[] = "ServerMiddleware.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_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_7pyarrow_7_flight_16ServerMiddleware_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _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(1, 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(1, 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 = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _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 = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ServerMiddleware); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerMiddleware__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_ServerMiddleware); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight.ServerMiddleware.__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_ServerMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerMiddleware__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_6__setstate_cython__[] = "ServerMiddleware.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_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_7pyarrow_7_flight_16ServerMiddleware_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16ServerMiddleware_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ServerMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ServerMiddleware__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddleware__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_ServerMiddleware, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ServerMiddleware__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("pyarrow._flight.ServerMiddleware.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2071
 *         dict factories
 * 
 *     def __init__(self, dict factories):             # <<<<<<<<<<<<<<
 *         self.factories = factories
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_factories = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factories,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_factories)) != 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(0, 2071, __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_factories = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2071, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareFactoryWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_factories), (&PyDict_Type), 1, "factories", 1))) __PYX_ERR(0, 2071, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper___init__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_v_self), __pyx_v_factories);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper___init__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v_factories) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":2072
 * 
 *     def __init__(self, dict factories):
 *         self.factories = factories             # <<<<<<<<<<<<<<
 * 
 *     def start_call(self, info, headers):
 */
  __Pyx_INCREF(__pyx_v_factories);
  __Pyx_GIVEREF(__pyx_v_factories);
  __Pyx_GOTREF(__pyx_v_self->factories);
  __Pyx_DECREF(__pyx_v_self->factories);
  __pyx_v_self->factories = __pyx_v_factories;

  /* "pyarrow/_flight.pyx":2071
 *         dict factories
 * 
 *     def __init__(self, dict factories):             # <<<<<<<<<<<<<<
 *         self.factories = factories
 * 
 */

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

/* "pyarrow/_flight.pyx":2074
 *         self.factories = factories
 * 
 *     def start_call(self, info, headers):             # <<<<<<<<<<<<<<
 *         instances = {}
 *         for key, factory in self.factories.items():
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_3start_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_2start_call[] = "_ServerMiddlewareFactoryWrapper.start_call(self, info, headers)";
static PyObject *__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_3start_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_info = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_call (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_info,&__pyx_n_s_headers,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_info)) != 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_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("start_call", 1, 2, 2, 1); __PYX_ERR(0, 2074, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "start_call") < 0)) __PYX_ERR(0, 2074, __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_info = values[0];
    __pyx_v_headers = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("start_call", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2074, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareFactoryWrapper.start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_2start_call(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_v_self), __pyx_v_info, __pyx_v_headers);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_2start_call(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v_info, PyObject *__pyx_v_headers) {
  PyObject *__pyx_v_instances = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_factory = NULL;
  PyObject *__pyx_v_instance = NULL;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_wrapper = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("start_call", 0);

  /* "pyarrow/_flight.pyx":2075
 * 
 *     def start_call(self, info, headers):
 *         instances = {}             # <<<<<<<<<<<<<<
 *         for key, factory in self.factories.items():
 *             instance = factory.start_call(info, headers)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_instances = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2076
 *     def start_call(self, info, headers):
 *         instances = {}
 *         for key, factory in self.factories.items():             # <<<<<<<<<<<<<<
 *             instance = factory.start_call(info, headers)
 *             if instance:
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->factories == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 2076, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->factories, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_factory, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyarrow/_flight.pyx":2077
 *         instances = {}
 *         for key, factory in self.factories.items():
 *             instance = factory.start_call(info, headers)             # <<<<<<<<<<<<<<
 *             if instance:
 *                 # TODO: prevent duplicate keys
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_factory, __pyx_n_s_start_call); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2077, __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_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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_info, __pyx_v_headers};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_info, __pyx_v_headers};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2077, __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_info);
      __Pyx_GIVEREF(__pyx_v_info);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_v_info);
      __Pyx_INCREF(__pyx_v_headers);
      __Pyx_GIVEREF(__pyx_v_headers);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_v_headers);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyarrow/_flight.pyx":2078
 *         for key, factory in self.factories.items():
 *             instance = factory.start_call(info, headers)
 *             if instance:             # <<<<<<<<<<<<<<
 *                 # TODO: prevent duplicate keys
 *                 instances[key] = instance
 */
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_instance); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2078, __pyx_L1_error)
    if (__pyx_t_10) {

      /* "pyarrow/_flight.pyx":2080
 *             if instance:
 *                 # TODO: prevent duplicate keys
 *                 instances[key] = instance             # <<<<<<<<<<<<<<
 *         if instances:
 *             wrapper = _ServerMiddlewareWrapper(instances)
 */
      if (unlikely(PyDict_SetItem(__pyx_v_instances, __pyx_v_key, __pyx_v_instance) < 0)) __PYX_ERR(0, 2080, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":2078
 *         for key, factory in self.factories.items():
 *             instance = factory.start_call(info, headers)
 *             if instance:             # <<<<<<<<<<<<<<
 *                 # TODO: prevent duplicate keys
 *                 instances[key] = instance
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2081
 *                 # TODO: prevent duplicate keys
 *                 instances[key] = instance
 *         if instances:             # <<<<<<<<<<<<<<
 *             wrapper = _ServerMiddlewareWrapper(instances)
 *             return wrapper
 */
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_instances); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2081, __pyx_L1_error)
  if (__pyx_t_10) {

    /* "pyarrow/_flight.pyx":2082
 *                 instances[key] = instance
 *         if instances:
 *             wrapper = _ServerMiddlewareWrapper(instances)             # <<<<<<<<<<<<<<
 *             return wrapper
 *         return None
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareWrapper), __pyx_v_instances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_wrapper = ((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":2083
 *         if instances:
 *             wrapper = _ServerMiddlewareWrapper(instances)
 *             return wrapper             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_wrapper));
    __pyx_r = ((PyObject *)__pyx_v_wrapper);
    goto __pyx_L0;

    /* "pyarrow/_flight.pyx":2081
 *                 # TODO: prevent duplicate keys
 *                 instances[key] = instance
 *         if instances:             # <<<<<<<<<<<<<<
 *             wrapper = _ServerMiddlewareWrapper(instances)
 *             return wrapper
 */
  }

  /* "pyarrow/_flight.pyx":2084
 *             wrapper = _ServerMiddlewareWrapper(instances)
 *             return wrapper
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":2074
 *         self.factories = factories
 * 
 *     def start_call(self, info, headers):             # <<<<<<<<<<<<<<
 *         instances = {}
 *         for key, factory in self.factories.items():
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareFactoryWrapper.start_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instances);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_factory);
  __Pyx_XDECREF(__pyx_v_instance);
  __Pyx_XDECREF((PyObject *)__pyx_v_wrapper);
  __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_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_4__reduce_cython__[] = "_ServerMiddlewareFactoryWrapper.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_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_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_4__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_4__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.factories,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->factories);
  __Pyx_GIVEREF(__pyx_v_self->factories);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->factories);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.factories,)
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.factories,)
 *     _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(1, 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(1, 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.factories is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.factories,)
 *     _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.factories is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->factories != ((PyObject*)Py_None));
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.factories is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.factories is not None
 *     if use_setstate:
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__ServerMiddleware); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_16160196);
    __Pyx_GIVEREF(__pyx_int_16160196);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16160196);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.factories is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, None), state
 *     else:
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle__ServerMiddleware); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_16160196);
    __Pyx_GIVEREF(__pyx_int_16160196);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16160196);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareFactoryWrapper.__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__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_6__setstate_cython__[] = "_ServerMiddlewareFactoryWrapper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_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_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_6__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_6__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ServerMiddlewareFactoryWrapper__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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__ServerMiddlewareFactoryWrapper, (type(self), 0x0f695c4, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ServerMiddlewareFactoryWrapper__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("pyarrow._flight._ServerMiddlewareFactoryWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2091
 *         dict middleware
 * 
 *     def __init__(self, dict middleware):             # <<<<<<<<<<<<<<
 *         self.middleware = middleware
 * 
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_middleware = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_middleware,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_middleware)) != 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(0, 2091, __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_middleware = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2091, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_middleware), (&PyDict_Type), 1, "middleware", 1))) __PYX_ERR(0, 2091, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper___init__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v_self), __pyx_v_middleware);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper___init__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v_middleware) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyarrow/_flight.pyx":2092
 * 
 *     def __init__(self, dict middleware):
 *         self.middleware = middleware             # <<<<<<<<<<<<<<
 * 
 *     def sending_headers(self):
 */
  __Pyx_INCREF(__pyx_v_middleware);
  __Pyx_GIVEREF(__pyx_v_middleware);
  __Pyx_GOTREF(__pyx_v_self->middleware);
  __Pyx_DECREF(__pyx_v_self->middleware);
  __pyx_v_self->middleware = __pyx_v_middleware;

  /* "pyarrow/_flight.pyx":2091
 *         dict middleware
 * 
 *     def __init__(self, dict middleware):             # <<<<<<<<<<<<<<
 *         self.middleware = middleware
 * 
 */

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

/* "pyarrow/_flight.pyx":2094
 *         self.middleware = middleware
 * 
 *     def sending_headers(self):             # <<<<<<<<<<<<<<
 *         headers = collections.defaultdict(list)
 *         for instance in self.middleware.values():
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_3sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_2sending_headers[] = "_ServerMiddlewareWrapper.sending_headers(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_3sending_headers(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sending_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_2sending_headers(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_2sending_headers(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self) {
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_instance = NULL;
  PyObject *__pyx_v_more_headers = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_values = 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;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("sending_headers", 0);

  /* "pyarrow/_flight.pyx":2095
 * 
 *     def sending_headers(self):
 *         headers = collections.defaultdict(list)             # <<<<<<<<<<<<<<
 *         for instance in self.middleware.values():
 *             more_headers = instance.sending_headers()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2095, __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, ((PyObject *)(&PyList_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)(&PyList_Type)));
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_headers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2096
 *     def sending_headers(self):
 *         headers = collections.defaultdict(list)
 *         for instance in self.middleware.values():             # <<<<<<<<<<<<<<
 *             more_headers = instance.sending_headers()
 *             if not more_headers:
 */
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->middleware == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
    __PYX_ERR(0, 2096, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_self->middleware, 1, __pyx_n_s_values, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_5, &__pyx_t_4, NULL, &__pyx_t_3, NULL, __pyx_t_6);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyarrow/_flight.pyx":2097
 *         headers = collections.defaultdict(list)
 *         for instance in self.middleware.values():
 *             more_headers = instance.sending_headers()             # <<<<<<<<<<<<<<
 *             if not more_headers:
 *                 continue
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_instance, __pyx_n_s_sending_headers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_more_headers, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pyarrow/_flight.pyx":2098
 *         for instance in self.middleware.values():
 *             more_headers = instance.sending_headers()
 *             if not more_headers:             # <<<<<<<<<<<<<<
 *                 continue
 *             # Manually merge with existing headers (since headers are
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_more_headers); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2098, __pyx_L1_error)
    __pyx_t_10 = ((!__pyx_t_9) != 0);
    if (__pyx_t_10) {

      /* "pyarrow/_flight.pyx":2099
 *             more_headers = instance.sending_headers()
 *             if not more_headers:
 *                 continue             # <<<<<<<<<<<<<<
 *             # Manually merge with existing headers (since headers are
 *             # multi-valued)
 */
      goto __pyx_L3_continue;

      /* "pyarrow/_flight.pyx":2098
 *         for instance in self.middleware.values():
 *             more_headers = instance.sending_headers()
 *             if not more_headers:             # <<<<<<<<<<<<<<
 *                 continue
 *             # Manually merge with existing headers (since headers are
 */
    }

    /* "pyarrow/_flight.pyx":2102
 *             # Manually merge with existing headers (since headers are
 *             # multi-valued)
 *             for key, values in more_headers.items():             # <<<<<<<<<<<<<<
 *                 if isinstance(values, (six.text_type, six.binary_type)):
 *                     values = (values,)
 */
    __pyx_t_11 = 0;
    if (unlikely(__pyx_v_more_headers == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 2102, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_more_headers, 0, __pyx_n_s_items, (&__pyx_t_12), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = 0;
    while (1) {
      __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_12, &__pyx_t_11, &__pyx_t_2, &__pyx_t_8, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "pyarrow/_flight.pyx":2103
 *             # multi-valued)
 *             for key, values in more_headers.items():
 *                 if isinstance(values, (six.text_type, six.binary_type)):             # <<<<<<<<<<<<<<
 *                     values = (values,)
 *                 headers[key].extend(values)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_six); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_text_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_six); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_binary_type); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = PyObject_IsInstance(__pyx_v_values, __pyx_t_2); 
      __pyx_t_15 = (__pyx_t_9 != 0);
      if (!__pyx_t_15) {
      } else {
        __pyx_t_10 = __pyx_t_15;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_15 = PyObject_IsInstance(__pyx_v_values, __pyx_t_14); 
      __pyx_t_9 = (__pyx_t_15 != 0);
      __pyx_t_10 = __pyx_t_9;
      __pyx_L9_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = (__pyx_t_10 != 0);
      if (__pyx_t_9) {

        /* "pyarrow/_flight.pyx":2104
 *             for key, values in more_headers.items():
 *                 if isinstance(values, (six.text_type, six.binary_type)):
 *                     values = (values,)             # <<<<<<<<<<<<<<
 *                 headers[key].extend(values)
 *         return headers
 */
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_values);
        __Pyx_GIVEREF(__pyx_v_values);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_values);
        __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "pyarrow/_flight.pyx":2103
 *             # multi-valued)
 *             for key, values in more_headers.items():
 *                 if isinstance(values, (six.text_type, six.binary_type)):             # <<<<<<<<<<<<<<
 *                     values = (values,)
 *                 headers[key].extend(values)
 */
      }

      /* "pyarrow/_flight.pyx":2105
 *                 if isinstance(values, (six.text_type, six.binary_type)):
 *                     values = (values,)
 *                 headers[key].extend(values)             # <<<<<<<<<<<<<<
 *         return headers
 * 
 */
      __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_headers, __pyx_v_key); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_extend); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_14, __pyx_v_values) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_values);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2106
 *                     values = (values,)
 *                 headers[key].extend(values)
 *         return headers             # <<<<<<<<<<<<<<
 * 
 *     def call_completed(self, exception):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_headers);
  __pyx_r = __pyx_v_headers;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":2094
 *         self.middleware = middleware
 * 
 *     def sending_headers(self):             # <<<<<<<<<<<<<<
 *         headers = collections.defaultdict(list)
 *         for instance in self.middleware.values():
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareWrapper.sending_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_instance);
  __Pyx_XDECREF(__pyx_v_more_headers);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2108
 *         return headers
 * 
 *     def call_completed(self, exception):             # <<<<<<<<<<<<<<
 *         for instance in self.middleware.values():
 *             instance.call_completed(exception)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_5call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_4call_completed[] = "_ServerMiddlewareWrapper.call_completed(self, exception)";
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_5call_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_4call_completed(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v_self), ((PyObject *)__pyx_v_exception));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_4call_completed(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_v_instance = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("call_completed", 0);

  /* "pyarrow/_flight.pyx":2109
 * 
 *     def call_completed(self, exception):
 *         for instance in self.middleware.values():             # <<<<<<<<<<<<<<
 *             instance.call_completed(exception)
 * 
 */
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->middleware == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
    __PYX_ERR(0, 2109, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->middleware, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_6 == 0)) break;
    if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyarrow/_flight.pyx":2110
 *     def call_completed(self, exception):
 *         for instance in self.middleware.values():
 *             instance.call_completed(exception)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_instance, __pyx_n_s_call_completed); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_exception) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_exception);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2108
 *         return headers
 * 
 *     def call_completed(self, exception):             # <<<<<<<<<<<<<<
 *         for instance in self.middleware.values():
 *             instance.call_completed(exception)
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareWrapper.call_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_instance);
  __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_7pyarrow_7_flight_24_ServerMiddlewareWrapper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_6__reduce_cython__[] = "_ServerMiddlewareWrapper.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_6__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_6__reduce_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.middleware,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->middleware);
  __Pyx_GIVEREF(__pyx_v_self->middleware);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->middleware);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.middleware,)
 *     _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(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.middleware,)
 *     _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(1, 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(1, 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.middleware is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.middleware,)
 *     _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.middleware is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->middleware != ((PyObject*)Py_None));
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.middleware is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = self.middleware is not None
 *     if use_setstate:
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__ServerMiddleware_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_186650374);
    __Pyx_GIVEREF(__pyx_int_186650374);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_186650374);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.middleware is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, None), state
 *     else:
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ServerMiddlewareWrapper__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle__ServerMiddleware_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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_186650374);
    __Pyx_GIVEREF(__pyx_int_186650374);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_186650374);
    __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(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 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_5);
  __Pyx_AddTraceback("pyarrow._flight._ServerMiddlewareWrapper.__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__ServerMiddlewareWrapper, (type(self), 0xb200f06, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ServerMiddlewareWrapper__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_8__setstate_cython__[] = "_ServerMiddlewareWrapper.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_8__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_24_ServerMiddlewareWrapper_8__setstate_cython__(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__ServerMiddlewareWrapper, (type(self), 0xb200f06, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ServerMiddlewareWrapper__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(1, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareWrapper__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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__ServerMiddlewareWrapper, (type(self), 0xb200f06, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ServerMiddlewareWrapper__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("pyarrow._flight._ServerMiddlewareWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2139
 *         unique_ptr[PyFlightServer] server
 * 
 *     def __init__(self, location=None, auth_handler=None,             # <<<<<<<<<<<<<<
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):
 */

/* Python wrapper */
static int __pyx_pw_7pyarrow_7_flight_16FlightServerBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7pyarrow_7_flight_16FlightServerBase_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_location = 0;
  PyObject *__pyx_v_auth_handler = 0;
  PyObject *__pyx_v_tls_certificates = 0;
  PyObject *__pyx_v_middleware = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_location,&__pyx_n_s_auth_handler,&__pyx_n_s_tls_certificates,&__pyx_n_s_middleware,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);

    /* "pyarrow/_flight.pyx":2140
 * 
 *     def __init__(self, location=None, auth_handler=None,
 *                  tls_certificates=None, middleware=None):             # <<<<<<<<<<<<<<
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_location);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auth_handler);
          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_tls_certificates);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_middleware);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2139, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_location = values[0];
    __pyx_v_auth_handler = values[1];
    __pyx_v_tls_certificates = values[2];
    __pyx_v_middleware = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2139, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase___init__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_location, __pyx_v_auth_handler, __pyx_v_tls_certificates, __pyx_v_middleware);

  /* "pyarrow/_flight.pyx":2139
 *         unique_ptr[PyFlightServer] server
 * 
 *     def __init__(self, location=None, auth_handler=None,             # <<<<<<<<<<<<<<
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):
 */

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

static int __pyx_pf_7pyarrow_7_flight_16FlightServerBase___init__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, PyObject *__pyx_v_location, PyObject *__pyx_v_auth_handler, PyObject *__pyx_v_tls_certificates, PyObject *__pyx_v_middleware) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_port = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_location);

  /* "pyarrow/_flight.pyx":2141
 *     def __init__(self, location=None, auth_handler=None,
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):             # <<<<<<<<<<<<<<
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_six); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_location, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "pyarrow/_flight.pyx":2142
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):
 *             location = Location(location)             # <<<<<<<<<<<<<<
 *         elif isinstance(location, (tuple, type(None))):
 *             if location is None:
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_v_location); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_location, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pyarrow/_flight.pyx":2141
 *     def __init__(self, location=None, auth_handler=None,
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):             # <<<<<<<<<<<<<<
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":2143
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):             # <<<<<<<<<<<<<<
 *             if location is None:
 *                 location = ('localhost', 0)
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(Py_None)));
  __pyx_t_2 = ((PyObject *)Py_TYPE(Py_None));
  __pyx_t_3 = PyTuple_Check(__pyx_v_location); 
  __pyx_t_5 = (__pyx_t_3 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_location, __pyx_t_2); 
  __pyx_t_3 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":2144
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):
 *             if location is None:             # <<<<<<<<<<<<<<
 *                 location = ('localhost', 0)
 *             host, port = location
 */
    __pyx_t_3 = (__pyx_v_location == Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "pyarrow/_flight.pyx":2145
 *         elif isinstance(location, (tuple, type(None))):
 *             if location is None:
 *                 location = ('localhost', 0)             # <<<<<<<<<<<<<<
 *             host, port = location
 *             if tls_certificates:
 */
      __Pyx_INCREF(__pyx_tuple__61);
      __Pyx_DECREF_SET(__pyx_v_location, __pyx_tuple__61);

      /* "pyarrow/_flight.pyx":2144
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):
 *             if location is None:             # <<<<<<<<<<<<<<
 *                 location = ('localhost', 0)
 *             host, port = location
 */
    }

    /* "pyarrow/_flight.pyx":2146
 *             if location is None:
 *                 location = ('localhost', 0)
 *             host, port = location             # <<<<<<<<<<<<<<
 *             if tls_certificates:
 *                 location = Location.for_grpc_tls(host, port)
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_location))) || (PyList_CheckExact(__pyx_v_location))) {
      PyObject* sequence = __pyx_v_location;
      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, 2146, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_location); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 2146, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2146, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_host = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_port = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pyarrow/_flight.pyx":2147
 *                 location = ('localhost', 0)
 *             host, port = location
 *             if tls_certificates:             # <<<<<<<<<<<<<<
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_tls_certificates); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2147, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "pyarrow/_flight.pyx":2148
 *             host, port = location
 *             if tls_certificates:
 *                 location = Location.for_grpc_tls(host, port)             # <<<<<<<<<<<<<<
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_n_s_for_grpc_tls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2148, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 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_6, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2148, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2148, __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_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_port);
        __Pyx_GIVEREF(__pyx_v_port);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_port);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2148, __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_DECREF_SET(__pyx_v_location, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pyarrow/_flight.pyx":2147
 *                 location = ('localhost', 0)
 *             host, port = location
 *             if tls_certificates:             # <<<<<<<<<<<<<<
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 */
      goto __pyx_L9;
    }

    /* "pyarrow/_flight.pyx":2150
 *                 location = Location.for_grpc_tls(host, port)
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)             # <<<<<<<<<<<<<<
 *         elif not isinstance(location, Location):
 *             raise TypeError('`location` argument must be a string, tuple or a '
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location), __pyx_n_s_for_grpc_tcp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_host, __pyx_v_port};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_port);
        __Pyx_GIVEREF(__pyx_v_port);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_port);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_location, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L9:;

    /* "pyarrow/_flight.pyx":2143
 *         if isinstance(location, six.string_types):
 *             location = Location(location)
 *         elif isinstance(location, (tuple, type(None))):             # <<<<<<<<<<<<<<
 *             if location is None:
 *                 location = ('localhost', 0)
 */
    goto __pyx_L3;
  }

  /* "pyarrow/_flight.pyx":2151
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 */
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location); 
  __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pyarrow/_flight.pyx":2152
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):
 *             raise TypeError('`location` argument must be a string, tuple or a '             # <<<<<<<<<<<<<<
 *                             'Location instance')
 *         self.init(location, auth_handler, tls_certificates, middleware)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2152, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":2151
 *             else:
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):             # <<<<<<<<<<<<<<
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 */
  }
  __pyx_L3:;

  /* "pyarrow/_flight.pyx":2154
 *             raise TypeError('`location` argument must be a string, tuple or a '
 *                             'Location instance')
 *         self.init(location, auth_handler, tls_certificates, middleware)             # <<<<<<<<<<<<<<
 * 
 *     cdef init(self, Location location, ServerAuthHandler auth_handler,
 */
  if (!(likely(((__pyx_v_location) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_location, __pyx_ptype_7pyarrow_7_flight_Location))))) __PYX_ERR(0, 2154, __pyx_L1_error)
  if (!(likely(((__pyx_v_auth_handler) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_auth_handler, __pyx_ptype_7pyarrow_7_flight_ServerAuthHandler))))) __PYX_ERR(0, 2154, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_tls_certificates))||((__pyx_v_tls_certificates) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_tls_certificates)->tp_name), 0))) __PYX_ERR(0, 2154, __pyx_L1_error)
  if (!(likely(PyDict_CheckExact(__pyx_v_middleware))||((__pyx_v_middleware) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_middleware)->tp_name), 0))) __PYX_ERR(0, 2154, __pyx_L1_error)
  __pyx_t_1 = ((struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self->__pyx_vtab)->init(__pyx_v_self, ((struct __pyx_obj_7pyarrow_7_flight_Location *)__pyx_v_location), ((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_auth_handler), ((PyObject*)__pyx_v_tls_certificates), ((PyObject*)__pyx_v_middleware)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":2139
 *         unique_ptr[PyFlightServer] server
 * 
 *     def __init__(self, location=None, auth_handler=None,             # <<<<<<<<<<<<<<
 *                  tls_certificates=None, middleware=None):
 *         if isinstance(location, six.string_types):
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_port);
  __Pyx_XDECREF(__pyx_v_location);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2156
 *         self.init(location, auth_handler, tls_certificates, middleware)
 * 
 *     cdef init(self, Location location, ServerAuthHandler auth_handler,             # <<<<<<<<<<<<<<
 *               list tls_certificates, dict middleware):
 *         cdef:
 */

static PyObject *__pyx_f_7pyarrow_7_flight_16FlightServerBase_init(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, struct __pyx_obj_7pyarrow_7_flight_Location *__pyx_v_location, struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v_auth_handler, PyObject *__pyx_v_tls_certificates, PyObject *__pyx_v_middleware) {
  arrow::py::flight::PyFlightServerVtable __pyx_v_vtable;
  arrow::py::flight::PyFlightServer *__pyx_v_c_server;
  std::unique_ptr< arrow::flight::FlightServerOptions>  __pyx_v_c_options;
   arrow::flight::CertKeyPair __pyx_v_c_cert;
  std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_server_middleware_start_call>  __pyx_v_start_call;
  std::pair<std::string,std::shared_ptr< arrow::flight::ServerMiddlewareFactory> >  __pyx_v_c_middleware;
  PyObject *__pyx_v_cert = NULL;
  PyObject *__pyx_v_key = NULL;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__pyx_v_py_middleware = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
   arrow::flight::Location __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;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  std::string __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("init", 0);

  /* "pyarrow/_flight.pyx":2159
 *               list tls_certificates, dict middleware):
 *         cdef:
 *             PyFlightServerVtable vtable = PyFlightServerVtable()             # <<<<<<<<<<<<<<
 *             PyFlightServer* c_server
 *             unique_ptr[CFlightServerOptions] c_options
 */
  __pyx_v_vtable = arrow::py::flight::PyFlightServerVtable();

  /* "pyarrow/_flight.pyx":2164
 *             CCertKeyPair c_cert
 *             function[cb_server_middleware_start_call] start_call = \
 *                 &_server_middleware_start_call             # <<<<<<<<<<<<<<
 *             pair[c_string, shared_ptr[CServerMiddlewareFactory]] c_middleware
 * 
 */
  __pyx_v_start_call = (&__pyx_f_7pyarrow_7_flight__server_middleware_start_call);

  /* "pyarrow/_flight.pyx":2167
 *             pair[c_string, shared_ptr[CServerMiddlewareFactory]] c_middleware
 * 
 *         c_options.reset(new CFlightServerOptions(Location.unwrap(location)))             # <<<<<<<<<<<<<<
 * 
 *         if auth_handler:
 */
  __pyx_t_1 = __pyx_f_7pyarrow_7_flight_8Location_unwrap(((PyObject *)__pyx_v_location)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2167, __pyx_L1_error)
  __pyx_v_c_options.reset(new  arrow::flight::FlightServerOptions(__pyx_t_1));

  /* "pyarrow/_flight.pyx":2169
 *         c_options.reset(new CFlightServerOptions(Location.unwrap(location)))
 * 
 *         if auth_handler:             # <<<<<<<<<<<<<<
 *             if not isinstance(auth_handler, ServerAuthHandler):
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_auth_handler)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2169, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "pyarrow/_flight.pyx":2170
 * 
 *         if auth_handler:
 *             if not isinstance(auth_handler, ServerAuthHandler):             # <<<<<<<<<<<<<<
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 *                                 "not a '{}'".format(type(auth_handler)))
 */
    __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_auth_handler), __pyx_ptype_7pyarrow_7_flight_ServerAuthHandler); 
    __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
    if (unlikely(__pyx_t_3)) {

      /* "pyarrow/_flight.pyx":2172
 *             if not isinstance(auth_handler, ServerAuthHandler):
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 *                                 "not a '{}'".format(type(auth_handler)))             # <<<<<<<<<<<<<<
 *             c_options.get().auth_handler.reset(
 *                 (<ServerAuthHandler> auth_handler).to_handler())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_auth_handler_must_be_a_ServerAut, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2172, __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, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_auth_handler)))) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_auth_handler))));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pyarrow/_flight.pyx":2171
 *         if auth_handler:
 *             if not isinstance(auth_handler, ServerAuthHandler):
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "             # <<<<<<<<<<<<<<
 *                                 "not a '{}'".format(type(auth_handler)))
 *             c_options.get().auth_handler.reset(
 */
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 2171, __pyx_L1_error)

      /* "pyarrow/_flight.pyx":2170
 * 
 *         if auth_handler:
 *             if not isinstance(auth_handler, ServerAuthHandler):             # <<<<<<<<<<<<<<
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 *                                 "not a '{}'".format(type(auth_handler)))
 */
    }

    /* "pyarrow/_flight.pyx":2173
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 *                                 "not a '{}'".format(type(auth_handler)))
 *             c_options.get().auth_handler.reset(             # <<<<<<<<<<<<<<
 *                 (<ServerAuthHandler> auth_handler).to_handler())
 * 
 */
    __pyx_v_c_options.get()->auth_handler.reset(((struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthHandler *)((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_auth_handler)->__pyx_vtab)->to_handler(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v_auth_handler)));

    /* "pyarrow/_flight.pyx":2169
 *         c_options.reset(new CFlightServerOptions(Location.unwrap(location)))
 * 
 *         if auth_handler:             # <<<<<<<<<<<<<<
 *             if not isinstance(auth_handler, ServerAuthHandler):
 *                 raise TypeError("auth_handler must be a ServerAuthHandler, "
 */
  }

  /* "pyarrow/_flight.pyx":2176
 *                 (<ServerAuthHandler> auth_handler).to_handler())
 * 
 *         if tls_certificates:             # <<<<<<<<<<<<<<
 *             for cert, key in tls_certificates:
 *                 c_cert.pem_cert = tobytes(cert)
 */
  __pyx_t_3 = (__pyx_v_tls_certificates != Py_None)&&(PyList_GET_SIZE(__pyx_v_tls_certificates) != 0);
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":2177
 * 
 *         if tls_certificates:
 *             for cert, key in tls_certificates:             # <<<<<<<<<<<<<<
 *                 c_cert.pem_cert = tobytes(cert)
 *                 c_cert.pem_key = tobytes(key)
 */
    if (unlikely(__pyx_v_tls_certificates == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 2177, __pyx_L1_error)
    }
    __pyx_t_5 = __pyx_v_tls_certificates; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
    for (;;) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 2177, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2177, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 2177, __pyx_L1_error)
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 2177, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_cert, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "pyarrow/_flight.pyx":2178
 *         if tls_certificates:
 *             for cert, key in tls_certificates:
 *                 c_cert.pem_cert = tobytes(cert)             # <<<<<<<<<<<<<<
 *                 c_cert.pem_key = tobytes(key)
 *                 c_options.get().tls_certificates.push_back(c_cert)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_cert) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_cert);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2178, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_c_cert.pem_cert = __pyx_t_11;

      /* "pyarrow/_flight.pyx":2179
 *             for cert, key in tls_certificates:
 *                 c_cert.pem_cert = tobytes(cert)
 *                 c_cert.pem_key = tobytes(key)             # <<<<<<<<<<<<<<
 *                 c_options.get().tls_certificates.push_back(c_cert)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_key);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2179, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_c_cert.pem_key = __pyx_t_11;

      /* "pyarrow/_flight.pyx":2180
 *                 c_cert.pem_cert = tobytes(cert)
 *                 c_cert.pem_key = tobytes(key)
 *                 c_options.get().tls_certificates.push_back(c_cert)             # <<<<<<<<<<<<<<
 * 
 *         if middleware:
 */
      try {
        __pyx_v_c_options.get()->tls_certificates.push_back(__pyx_v_c_cert);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 2180, __pyx_L1_error)
      }

      /* "pyarrow/_flight.pyx":2177
 * 
 *         if tls_certificates:
 *             for cert, key in tls_certificates:             # <<<<<<<<<<<<<<
 *                 c_cert.pem_cert = tobytes(cert)
 *                 c_cert.pem_key = tobytes(key)
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyarrow/_flight.pyx":2176
 *                 (<ServerAuthHandler> auth_handler).to_handler())
 * 
 *         if tls_certificates:             # <<<<<<<<<<<<<<
 *             for cert, key in tls_certificates:
 *                 c_cert.pem_cert = tobytes(cert)
 */
  }

  /* "pyarrow/_flight.pyx":2182
 *                 c_options.get().tls_certificates.push_back(c_cert)
 * 
 *         if middleware:             # <<<<<<<<<<<<<<
 *             py_middleware = _ServerMiddlewareFactoryWrapper(middleware)
 *             c_middleware.first = CPyServerMiddlewareName
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_middleware); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2182, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pyarrow/_flight.pyx":2183
 * 
 *         if middleware:
 *             py_middleware = _ServerMiddlewareFactoryWrapper(middleware)             # <<<<<<<<<<<<<<
 *             c_middleware.first = CPyServerMiddlewareName
 *             c_middleware.second.reset(new CPyServerMiddlewareFactory(
 */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper), __pyx_v_middleware); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_py_middleware = ((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyarrow/_flight.pyx":2184
 *         if middleware:
 *             py_middleware = _ServerMiddlewareFactoryWrapper(middleware)
 *             c_middleware.first = CPyServerMiddlewareName             # <<<<<<<<<<<<<<
 *             c_middleware.second.reset(new CPyServerMiddlewareFactory(
 *                 py_middleware,
 */
    __pyx_v_c_middleware.first =  arrow::py::flight::kPyServerMiddlewareName;

    /* "pyarrow/_flight.pyx":2185
 *             py_middleware = _ServerMiddlewareFactoryWrapper(middleware)
 *             c_middleware.first = CPyServerMiddlewareName
 *             c_middleware.second.reset(new CPyServerMiddlewareFactory(             # <<<<<<<<<<<<<<
 *                 py_middleware,
 *                 start_call))
 */
    __pyx_v_c_middleware.second.reset(new  arrow::py::flight::PyServerMiddlewareFactory(((PyObject *)__pyx_v_py_middleware), __pyx_v_start_call));

    /* "pyarrow/_flight.pyx":2188
 *                 py_middleware,
 *                 start_call))
 *             c_options.get().middleware.push_back(c_middleware)             # <<<<<<<<<<<<<<
 * 
 *         vtable.list_flights = &_list_flights
 */
    try {
      __pyx_v_c_options.get()->middleware.push_back(__pyx_v_c_middleware);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 2188, __pyx_L1_error)
    }

    /* "pyarrow/_flight.pyx":2182
 *                 c_options.get().tls_certificates.push_back(c_cert)
 * 
 *         if middleware:             # <<<<<<<<<<<<<<
 *             py_middleware = _ServerMiddlewareFactoryWrapper(middleware)
 *             c_middleware.first = CPyServerMiddlewareName
 */
  }

  /* "pyarrow/_flight.pyx":2190
 *             c_options.get().middleware.push_back(c_middleware)
 * 
 *         vtable.list_flights = &_list_flights             # <<<<<<<<<<<<<<
 *         vtable.get_flight_info = &_get_flight_info
 *         vtable.get_schema = &_get_schema
 */
  __pyx_v_vtable.list_flights = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_list_flights> )(&__pyx_f_7pyarrow_7_flight__list_flights));

  /* "pyarrow/_flight.pyx":2191
 * 
 *         vtable.list_flights = &_list_flights
 *         vtable.get_flight_info = &_get_flight_info             # <<<<<<<<<<<<<<
 *         vtable.get_schema = &_get_schema
 *         vtable.do_put = &_do_put
 */
  __pyx_v_vtable.get_flight_info = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_flight_info> )(&__pyx_f_7pyarrow_7_flight__get_flight_info));

  /* "pyarrow/_flight.pyx":2192
 *         vtable.list_flights = &_list_flights
 *         vtable.get_flight_info = &_get_flight_info
 *         vtable.get_schema = &_get_schema             # <<<<<<<<<<<<<<
 *         vtable.do_put = &_do_put
 *         vtable.do_get = &_do_get
 */
  __pyx_v_vtable.get_schema = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_get_schema> )(&__pyx_f_7pyarrow_7_flight__get_schema));

  /* "pyarrow/_flight.pyx":2193
 *         vtable.get_flight_info = &_get_flight_info
 *         vtable.get_schema = &_get_schema
 *         vtable.do_put = &_do_put             # <<<<<<<<<<<<<<
 *         vtable.do_get = &_do_get
 *         vtable.list_actions = &_list_actions
 */
  __pyx_v_vtable.do_put = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_put> )(&__pyx_f_7pyarrow_7_flight__do_put));

  /* "pyarrow/_flight.pyx":2194
 *         vtable.get_schema = &_get_schema
 *         vtable.do_put = &_do_put
 *         vtable.do_get = &_do_get             # <<<<<<<<<<<<<<
 *         vtable.list_actions = &_list_actions
 *         vtable.do_action = &_do_action
 */
  __pyx_v_vtable.do_get = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_get> )(&__pyx_f_7pyarrow_7_flight__do_get));

  /* "pyarrow/_flight.pyx":2195
 *         vtable.do_put = &_do_put
 *         vtable.do_get = &_do_get
 *         vtable.list_actions = &_list_actions             # <<<<<<<<<<<<<<
 *         vtable.do_action = &_do_action
 * 
 */
  __pyx_v_vtable.list_actions = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_list_actions> )(&__pyx_f_7pyarrow_7_flight__list_actions));

  /* "pyarrow/_flight.pyx":2196
 *         vtable.do_get = &_do_get
 *         vtable.list_actions = &_list_actions
 *         vtable.do_action = &_do_action             # <<<<<<<<<<<<<<
 * 
 *         c_server = new PyFlightServer(self, vtable)
 */
  __pyx_v_vtable.do_action = ((std::function<__pyx_t_7pyarrow_8includes_15libarrow_flight_cb_do_action> )(&__pyx_f_7pyarrow_7_flight__do_action));

  /* "pyarrow/_flight.pyx":2198
 *         vtable.do_action = &_do_action
 * 
 *         c_server = new PyFlightServer(self, vtable)             # <<<<<<<<<<<<<<
 *         self.server.reset(c_server)
 *         with nogil:
 */
  __pyx_v_c_server = new arrow::py::flight::PyFlightServer(((PyObject *)__pyx_v_self), __pyx_v_vtable);

  /* "pyarrow/_flight.pyx":2199
 * 
 *         c_server = new PyFlightServer(self, vtable)
 *         self.server.reset(c_server)             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(c_server.Init(deref(c_options)))
 */
  __pyx_v_self->server.reset(__pyx_v_c_server);

  /* "pyarrow/_flight.pyx":2200
 *         c_server = new PyFlightServer(self, vtable)
 *         self.server.reset(c_server)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(c_server.Init(deref(c_options)))
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":2201
 *         self.server.reset(c_server)
 *         with nogil:
 *             check_flight_status(c_server.Init(deref(c_options)))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
        __pyx_t_12 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_c_server->Init((*__pyx_v_c_options))); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 2201, __pyx_L12_error)
      }

      /* "pyarrow/_flight.pyx":2200
 *         c_server = new PyFlightServer(self, vtable)
 *         self.server.reset(c_server)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(c_server.Init(deref(c_options)))
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L13;
        }
        __pyx_L12_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L13:;
      }
  }

  /* "pyarrow/_flight.pyx":2156
 *         self.init(location, auth_handler, tls_certificates, middleware)
 * 
 *     cdef init(self, Location location, ServerAuthHandler auth_handler,             # <<<<<<<<<<<<<<
 *               list tls_certificates, dict middleware):
 *         cdef:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cert);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF((PyObject *)__pyx_v_py_middleware);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2204
 * 
 *     @property
 *     def port(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the port that this server is listening on.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_4port_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_4port_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_4port___get__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_4port___get__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "pyarrow/_flight.pyx":2212
 *         socket).
 *         """
 *         return self.server.get().port()             # <<<<<<<<<<<<<<
 * 
 *     def list_flights(self, context, criteria):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->server.get()->port()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":2204
 * 
 *     @property
 *     def port(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the port that this server is listening on.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.port.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2214
 *         return self.server.get().port()
 * 
 *     def list_flights(self, context, criteria):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_3list_flights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_2list_flights[] = "FlightServerBase.list_flights(self, context, criteria)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_3list_flights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_criteria = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_flights (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_criteria,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_context)) != 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_criteria)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("list_flights", 1, 2, 2, 1); __PYX_ERR(0, 2214, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "list_flights") < 0)) __PYX_ERR(0, 2214, __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_context = values[0];
    __pyx_v_criteria = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("list_flights", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2214, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.list_flights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_2list_flights(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_criteria);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_2list_flights(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_criteria) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_flights", 0);

  /* "pyarrow/_flight.pyx":2215
 * 
 *     def list_flights(self, context, criteria):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def get_flight_info(self, context, descriptor):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2215, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2214
 *         return self.server.get().port()
 * 
 *     def list_flights(self, context, criteria):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.list_flights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2217
 *         raise NotImplementedError
 * 
 *     def get_flight_info(self, context, descriptor):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_5get_flight_info(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_4get_flight_info[] = "FlightServerBase.get_flight_info(self, context, descriptor)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_5get_flight_info(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_descriptor = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_flight_info (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_descriptor,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_context)) != 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_descriptor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_flight_info", 1, 2, 2, 1); __PYX_ERR(0, 2217, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_flight_info") < 0)) __PYX_ERR(0, 2217, __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_context = values[0];
    __pyx_v_descriptor = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_flight_info", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2217, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_4get_flight_info(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_descriptor);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_4get_flight_info(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_flight_info", 0);

  /* "pyarrow/_flight.pyx":2218
 * 
 *     def get_flight_info(self, context, descriptor):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def get_schema(self, context, descriptor):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2218, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2217
 *         raise NotImplementedError
 * 
 *     def get_flight_info(self, context, descriptor):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.get_flight_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2220
 *         raise NotImplementedError
 * 
 *     def get_schema(self, context, descriptor):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_7get_schema(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_6get_schema[] = "FlightServerBase.get_schema(self, context, descriptor)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_7get_schema(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_descriptor = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_descriptor,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_context)) != 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_descriptor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_schema", 1, 2, 2, 1); __PYX_ERR(0, 2220, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_schema") < 0)) __PYX_ERR(0, 2220, __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_context = values[0];
    __pyx_v_descriptor = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_schema", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.get_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_6get_schema(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_descriptor);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_6get_schema(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_schema", 0);

  /* "pyarrow/_flight.pyx":2221
 * 
 *     def get_schema(self, context, descriptor):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def do_put(self, context, descriptor, reader,
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2221, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2220
 *         raise NotImplementedError
 * 
 *     def get_schema(self, context, descriptor):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.get_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2223
 *         raise NotImplementedError
 * 
 *     def do_put(self, context, descriptor, reader,             # <<<<<<<<<<<<<<
 *                writer: FlightMetadataWriter):
 *         raise NotImplementedError
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_9do_put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_8do_put[] = "FlightServerBase.do_put(self, context, descriptor, reader, FlightMetadataWriter writer: FlightMetadataWriter)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_9do_put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_descriptor = 0;
  CYTHON_UNUSED PyObject *__pyx_v_reader = 0;
  CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_writer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_put (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_descriptor,&__pyx_n_s_reader,&__pyx_n_s_writer,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_context)) != 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_descriptor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_put", 1, 4, 4, 1); __PYX_ERR(0, 2223, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reader)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_put", 1, 4, 4, 2); __PYX_ERR(0, 2223, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_writer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_put", 1, 4, 4, 3); __PYX_ERR(0, 2223, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_put") < 0)) __PYX_ERR(0, 2223, __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_context = values[0];
    __pyx_v_descriptor = values[1];
    __pyx_v_reader = values[2];
    __pyx_v_writer = ((struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_put", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2223, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_writer), __pyx_ptype_7pyarrow_7_flight_FlightMetadataWriter, 1, "writer", 0))) __PYX_ERR(0, 2224, __pyx_L1_error)
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_8do_put(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_descriptor, __pyx_v_reader, __pyx_v_writer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_8do_put(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_descriptor, CYTHON_UNUSED PyObject *__pyx_v_reader, CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *__pyx_v_writer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_put", 0);

  /* "pyarrow/_flight.pyx":2225
 *     def do_put(self, context, descriptor, reader,
 *                writer: FlightMetadataWriter):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def do_get(self, context, ticket):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2225, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2223
 *         raise NotImplementedError
 * 
 *     def do_put(self, context, descriptor, reader,             # <<<<<<<<<<<<<<
 *                writer: FlightMetadataWriter):
 *         raise NotImplementedError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2227
 *         raise NotImplementedError
 * 
 *     def do_get(self, context, ticket):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_11do_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_10do_get[] = "FlightServerBase.do_get(self, context, ticket)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_11do_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_ticket = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_ticket,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_context)) != 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_ticket)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_get", 1, 2, 2, 1); __PYX_ERR(0, 2227, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_get") < 0)) __PYX_ERR(0, 2227, __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_context = values[0];
    __pyx_v_ticket = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_get", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2227, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_10do_get(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_ticket);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_10do_get(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_ticket) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_get", 0);

  /* "pyarrow/_flight.pyx":2228
 * 
 *     def do_get(self, context, ticket):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def list_actions(self, context):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2228, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2227
 *         raise NotImplementedError
 * 
 *     def do_get(self, context, ticket):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2230
 *         raise NotImplementedError
 * 
 *     def list_actions(self, context):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_13list_actions(PyObject *__pyx_v_self, PyObject *__pyx_v_context); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_12list_actions[] = "FlightServerBase.list_actions(self, context)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_13list_actions(PyObject *__pyx_v_self, PyObject *__pyx_v_context) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_actions (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_12list_actions(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), ((PyObject *)__pyx_v_context));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_12list_actions(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list_actions", 0);

  /* "pyarrow/_flight.pyx":2231
 * 
 *     def list_actions(self, context):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def do_action(self, context, action):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2231, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2230
 *         raise NotImplementedError
 * 
 *     def list_actions(self, context):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.list_actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2233
 *         raise NotImplementedError
 * 
 *     def do_action(self, context, action):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_15do_action(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_14do_action[] = "FlightServerBase.do_action(self, context, action)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_15do_action(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
  CYTHON_UNUSED PyObject *__pyx_v_action = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_action (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_action,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_context)) != 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_action)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_action", 1, 2, 2, 1); __PYX_ERR(0, 2233, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_action") < 0)) __PYX_ERR(0, 2233, __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_context = values[0];
    __pyx_v_action = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_action", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2233, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_14do_action(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_context, __pyx_v_action);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_14do_action(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_action) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_action", 0);

  /* "pyarrow/_flight.pyx":2234
 * 
 *     def do_action(self, context, action):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def serve(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 2234, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2233
 *         raise NotImplementedError
 * 
 *     def do_action(self, context, action):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.do_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2236
 *         raise NotImplementedError
 * 
 *     def serve(self):             # <<<<<<<<<<<<<<
 *         """Start serving.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_17serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_16serve[] = "FlightServerBase.serve(self)\nStart serving.\n\n        This method only returns if shutdown() is called or a signal a\n        received.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_17serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serve (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_16serve(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_16serve(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  arrow::Status __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("serve", 0);

  /* "pyarrow/_flight.pyx":2242
 *         received.
 *         """
 *         if self.server.get() == nullptr:             # <<<<<<<<<<<<<<
 *             raise ValueError("run() on uninitialized FlightServerBase")
 *         with nogil:
 */
  __pyx_t_1 = ((__pyx_v_self->server.get() == nullptr) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pyarrow/_flight.pyx":2243
 *         """
 *         if self.server.get() == nullptr:
 *             raise ValueError("run() on uninitialized FlightServerBase")             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(self.server.get().ServeWithSignals())
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 2243, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":2242
 *         received.
 *         """
 *         if self.server.get() == nullptr:             # <<<<<<<<<<<<<<
 *             raise ValueError("run() on uninitialized FlightServerBase")
 *         with nogil:
 */
  }

  /* "pyarrow/_flight.pyx":2244
 *         if self.server.get() == nullptr:
 *             raise ValueError("run() on uninitialized FlightServerBase")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.server.get().ServeWithSignals())
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":2245
 *             raise ValueError("run() on uninitialized FlightServerBase")
 *         with nogil:
 *             check_flight_status(self.server.get().ServeWithSignals())             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
        __pyx_t_3 = __pyx_v_self->server.get()->ServeWithSignals(); if (unlikely(__Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 2245, __pyx_L5_error)
        __pyx_t_4 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 2245, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":2244
 *         if self.server.get() == nullptr:
 *             raise ValueError("run() on uninitialized FlightServerBase")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.server.get().ServeWithSignals())
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":2236
 *         raise NotImplementedError
 * 
 *     def serve(self):             # <<<<<<<<<<<<<<
 *         """Start serving.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.serve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2247
 *             check_flight_status(self.server.get().ServeWithSignals())
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         warnings.warn("The 'FlightServer.run' method is deprecated, use "
 *                       "FlightServer.serve method instead")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_19run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_18run[] = "FlightServerBase.run(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_19run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_18run(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_18run(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("run", 0);

  /* "pyarrow/_flight.pyx":2248
 * 
 *     def run(self):
 *         warnings.warn("The 'FlightServer.run' method is deprecated, use "             # <<<<<<<<<<<<<<
 *                       "FlightServer.serve method instead")
 *         self.serve()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2248, __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_The_FlightServer_run_method_is_d) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_The_FlightServer_run_method_is_d);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2248, __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;

  /* "pyarrow/_flight.pyx":2250
 *         warnings.warn("The 'FlightServer.run' method is deprecated, use "
 *                       "FlightServer.serve method instead")
 *         self.serve()             # <<<<<<<<<<<<<<
 * 
 *     def shutdown(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_serve); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2250, __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;

  /* "pyarrow/_flight.pyx":2247
 *             check_flight_status(self.server.get().ServeWithSignals())
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         warnings.warn("The 'FlightServer.run' method is deprecated, use "
 *                       "FlightServer.serve method instead")
 */

  /* 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("pyarrow._flight.FlightServerBase.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2252
 *         self.serve()
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """Shut down the server, blocking until current requests finish.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_21shutdown(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_20shutdown[] = "FlightServerBase.shutdown(self)\nShut down the server, blocking until current requests finish.\n\n        Do not call this directly from the implementation of a Flight\n        method, as then the server will block forever waiting for that\n        request to finish. Instead, call this method from a background\n        thread.\n        ";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_21shutdown(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_20shutdown(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_20shutdown(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("shutdown", 0);

  /* "pyarrow/_flight.pyx":2264
 *         # methods will never get to run, so this will hang
 *         # indefinitely.
 *         if self.server.get() == nullptr:             # <<<<<<<<<<<<<<
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")
 *         with nogil:
 */
  __pyx_t_1 = ((__pyx_v_self->server.get() == nullptr) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pyarrow/_flight.pyx":2265
 *         # indefinitely.
 *         if self.server.get() == nullptr:
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(self.server.get().Shutdown())
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 2265, __pyx_L1_error)

    /* "pyarrow/_flight.pyx":2264
 *         # methods will never get to run, so this will hang
 *         # indefinitely.
 *         if self.server.get() == nullptr:             # <<<<<<<<<<<<<<
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")
 *         with nogil:
 */
  }

  /* "pyarrow/_flight.pyx":2266
 *         if self.server.get() == nullptr:
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.server.get().Shutdown())
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":2267
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")
 *         with nogil:
 *             check_flight_status(self.server.get().Shutdown())             # <<<<<<<<<<<<<<
 * 
 *     def wait(self):
 */
        __pyx_t_3 = __pyx_f_7pyarrow_7_flight_check_flight_status(__pyx_v_self->server.get()->Shutdown()); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2267, __pyx_L5_error)
      }

      /* "pyarrow/_flight.pyx":2266
 *         if self.server.get() == nullptr:
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")
 *         with nogil:             # <<<<<<<<<<<<<<
 *             check_flight_status(self.server.get().Shutdown())
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L5_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
  }

  /* "pyarrow/_flight.pyx":2252
 *         self.serve()
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """Shut down the server, blocking until current requests finish.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyarrow/_flight.pyx":2269
 *             check_flight_status(self.server.get().Shutdown())
 * 
 *     def wait(self):             # <<<<<<<<<<<<<<
 *         """Block until server is terminated with shutdown."""
 *         with nogil:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_23wait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_22wait[] = "FlightServerBase.wait(self)\nBlock until server is terminated with shutdown.";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_23wait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wait (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_22wait(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_22wait(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wait", 0);

  /* "pyarrow/_flight.pyx":2271
 *     def wait(self):
 *         """Block until server is terminated with shutdown."""
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self.server.get().Wait()
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "pyarrow/_flight.pyx":2272
 *         """Block until server is terminated with shutdown."""
 *         with nogil:
 *             self.server.get().Wait()             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
        (void)(__pyx_v_self->server.get()->Wait());
      }

      /* "pyarrow/_flight.pyx":2271
 *     def wait(self):
 *         """Block until server is terminated with shutdown."""
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self.server.get().Wait()
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "pyarrow/_flight.pyx":2269
 *             check_flight_status(self.server.get().Shutdown())
 * 
 *     def wait(self):             # <<<<<<<<<<<<<<
 *         """Block until server is terminated with shutdown."""
 *         with nogil:
 */

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

/* "pyarrow/_flight.pyx":2274
 *             self.server.get().Wait()
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_25__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_24__enter__[] = "FlightServerBase.__enter__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_25__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_24__enter__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_24__enter__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "pyarrow/_flight.pyx":2275
 * 
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pyarrow/_flight.pyx":2274
 *             self.server.get().Wait()
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "pyarrow/_flight.pyx":2277
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *         self.shutdown()
 *         self.wait()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_27__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_26__exit__[] = "FlightServerBase.__exit__(self, exc_type, exc_value, traceback)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_27__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_value,&__pyx_n_s_traceback,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_exc_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_exc_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 2277, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 2277, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 2277, __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_exc_type = values[0];
    __pyx_v_exc_value = values[1];
    __pyx_v_traceback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16FlightServerBase_26__exit__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_26__exit__(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "pyarrow/_flight.pyx":2278
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):
 *         self.shutdown()             # <<<<<<<<<<<<<<
 *         self.wait()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shutdown); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2278, __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;

  /* "pyarrow/_flight.pyx":2279
 *     def __exit__(self, exc_type, exc_value, traceback):
 *         self.shutdown()
 *         self.wait()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_wait); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2279, __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;

  /* "pyarrow/_flight.pyx":2277
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
 *         self.shutdown()
 *         self.wait()
 */

  /* 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("pyarrow._flight.FlightServerBase.__exit__", __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("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_28__reduce_cython__[] = "FlightServerBase.__reduce_cython__(self)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_29__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_7pyarrow_7_flight_16FlightServerBase_28__reduce_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyarrow._flight.FlightServerBase.__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("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16FlightServerBase_30__setstate_cython__[] = "FlightServerBase.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_7pyarrow_7_flight_16FlightServerBase_31__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_7pyarrow_7_flight_16FlightServerBase_30__setstate_cython__(((struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7pyarrow_7_flight_16FlightServerBase_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 */

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

/* "pyarrow/_flight.pyx":2282
 * 
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *             middleware=None):
 *     """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_3connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_2connect[] = "connect(location, tls_root_certs=None, override_hostname=None, middleware=None)\n\n    Connect to the Flight server\n\n    Parameters\n    ----------\n    location : str, tuple or Location\n        Location to connect to. Either a gRPC URI like `grpc://localhost:port`,\n        a tuple of (host, port) pair, or a Location instance.\n    tls_root_certs : bytes or None\n        PEM-encoded\n    override_hostname : str or None\n        Override the hostname checked by TLS. Insecure, use with caution.\n    middleware : list or None\n        A list of ClientMiddlewareFactory instances to apply.\n\n    Returns\n    -------\n    client : FlightClient\n    ";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_3connect = {"connect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_3connect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_2connect};
static PyObject *__pyx_pw_7pyarrow_7_flight_3connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_location = 0;
  PyObject *__pyx_v_tls_root_certs = 0;
  PyObject *__pyx_v_override_hostname = 0;
  PyObject *__pyx_v_middleware = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_location,&__pyx_n_s_tls_root_certs,&__pyx_n_s_override_hostname,&__pyx_n_s_middleware,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);

    /* "pyarrow/_flight.pyx":2283
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,
 *             middleware=None):             # <<<<<<<<<<<<<<
 *     """
 *     Connect to the Flight server
 */
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_location)) != 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_tls_root_certs);
          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_override_hostname);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_middleware);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connect") < 0)) __PYX_ERR(0, 2282, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_location = values[0];
    __pyx_v_tls_root_certs = values[1];
    __pyx_v_override_hostname = values[2];
    __pyx_v_middleware = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connect", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2282, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_2connect(__pyx_self, __pyx_v_location, __pyx_v_tls_root_certs, __pyx_v_override_hostname, __pyx_v_middleware);

  /* "pyarrow/_flight.pyx":2282
 * 
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *             middleware=None):
 *     """
 */

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

static PyObject *__pyx_pf_7pyarrow_7_flight_2connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_location, PyObject *__pyx_v_tls_root_certs, PyObject *__pyx_v_override_hostname, PyObject *__pyx_v_middleware) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "pyarrow/_flight.pyx":2303
 *     client : FlightClient
 *     """
 *     return FlightClient(location, tls_root_certs=tls_root_certs,             # <<<<<<<<<<<<<<
 *                         override_hostname=override_hostname,
 *                         middleware=middleware)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_location);
  __Pyx_GIVEREF(__pyx_v_location);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_location);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tls_root_certs, __pyx_v_tls_root_certs) < 0) __PYX_ERR(0, 2303, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2304
 *     """
 *     return FlightClient(location, tls_root_certs=tls_root_certs,
 *                         override_hostname=override_hostname,             # <<<<<<<<<<<<<<
 *                         middleware=middleware)
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_override_hostname, __pyx_v_override_hostname) < 0) __PYX_ERR(0, 2303, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2305
 *     return FlightClient(location, tls_root_certs=tls_root_certs,
 *                         override_hostname=override_hostname,
 *                         middleware=middleware)             # <<<<<<<<<<<<<<
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_middleware, __pyx_v_middleware) < 0) __PYX_ERR(0, 2303, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2303
 *     client : FlightClient
 *     """
 *     return FlightClient(location, tls_root_certs=tls_root_certs,             # <<<<<<<<<<<<<<
 *                         override_hostname=override_hostname,
 *                         middleware=middleware)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightClient), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2303, __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;

  /* "pyarrow/_flight.pyx":2282
 * 
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *             middleware=None):
 *     """
 */

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

/* "(tree fragment)":1
 * def __pyx_unpickle_FlightError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_5__pyx_unpickle_FlightError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_4__pyx_unpickle_FlightError[] = "__pyx_unpickle_FlightError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_5__pyx_unpickle_FlightError = {"__pyx_unpickle_FlightError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_5__pyx_unpickle_FlightError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_4__pyx_unpickle_FlightError};
static PyObject *__pyx_pw_7pyarrow_7_flight_5__pyx_unpickle_FlightError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightError (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_FlightError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_4__pyx_unpickle_FlightError(__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_7pyarrow_7_flight_4__pyx_unpickle_FlightError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __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 = FlightError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightError(__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("pyarrow._flight.__pyx_unpickle_FlightError", __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_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightError__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_FlightInternalError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_7__pyx_unpickle_FlightInternalError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_6__pyx_unpickle_FlightInternalError[] = "__pyx_unpickle_FlightInternalError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_7__pyx_unpickle_FlightInternalError = {"__pyx_unpickle_FlightInternalError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_7__pyx_unpickle_FlightInternalError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_6__pyx_unpickle_FlightInternalError};
static PyObject *__pyx_pw_7pyarrow_7_flight_7__pyx_unpickle_FlightInternalError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightInternalError (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_FlightInternalError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightInternalError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightInternalError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightInternalError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightInternalError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_6__pyx_unpickle_FlightInternalError(__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_7pyarrow_7_flight_6__pyx_unpickle_FlightInternalError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightInternalError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightInternalError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightInternalError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightInternalError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightInternalError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightInternalError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __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 = FlightInternalError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightInternalError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightInternalError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightInternalError(__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("pyarrow._flight.__pyx_unpickle_FlightInternalError", __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_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightInternalError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightInternalError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightInternalError__set_state(<FlightInternalError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightInternalError__set_state(FlightInternalError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightInternalError__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_FlightTimedOutError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_9__pyx_unpickle_FlightTimedOutError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_8__pyx_unpickle_FlightTimedOutError[] = "__pyx_unpickle_FlightTimedOutError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_9__pyx_unpickle_FlightTimedOutError = {"__pyx_unpickle_FlightTimedOutError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_9__pyx_unpickle_FlightTimedOutError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8__pyx_unpickle_FlightTimedOutError};
static PyObject *__pyx_pw_7pyarrow_7_flight_9__pyx_unpickle_FlightTimedOutError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightTimedOutError (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_FlightTimedOutError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightTimedOutError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightTimedOutError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightTimedOutError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightTimedOutError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_8__pyx_unpickle_FlightTimedOutError(__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_7pyarrow_7_flight_8__pyx_unpickle_FlightTimedOutError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightTimedOutError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightTimedOutError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightTimedOutError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightTimedOutError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightTimedOutError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightTimedOutError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __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 = FlightTimedOutError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightTimedOutError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightTimedOutError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightTimedOutError(__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("pyarrow._flight.__pyx_unpickle_FlightTimedOutError", __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_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightTimedOutError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightTimedOutError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightTimedOutError__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_FlightCancelledError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_11__pyx_unpickle_FlightCancelledError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_10__pyx_unpickle_FlightCancelledError[] = "__pyx_unpickle_FlightCancelledError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_11__pyx_unpickle_FlightCancelledError = {"__pyx_unpickle_FlightCancelledError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_11__pyx_unpickle_FlightCancelledError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_10__pyx_unpickle_FlightCancelledError};
static PyObject *__pyx_pw_7pyarrow_7_flight_11__pyx_unpickle_FlightCancelledError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightCancelledError (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_FlightCancelledError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightCancelledError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightCancelledError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightCancelledError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightCancelledError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_10__pyx_unpickle_FlightCancelledError(__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_7pyarrow_7_flight_10__pyx_unpickle_FlightCancelledError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightCancelledError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightCancelledError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightCancelledError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightCancelledError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightCancelledError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightCancelledError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __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 = FlightCancelledError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightCancelledError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightCancelledError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightCancelledError(__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("pyarrow._flight.__pyx_unpickle_FlightCancelledError", __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_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightCancelledError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightCancelledError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightCancelledError__set_state(<FlightCancelledError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightCancelledError__set_state(FlightCancelledError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightCancelledError__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_FlightServerError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_13__pyx_unpickle_FlightServerError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_12__pyx_unpickle_FlightServerError[] = "__pyx_unpickle_FlightServerError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_13__pyx_unpickle_FlightServerError = {"__pyx_unpickle_FlightServerError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_13__pyx_unpickle_FlightServerError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12__pyx_unpickle_FlightServerError};
static PyObject *__pyx_pw_7pyarrow_7_flight_13__pyx_unpickle_FlightServerError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightServerError (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_FlightServerError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightServerError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightServerError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightServerError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightServerError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_12__pyx_unpickle_FlightServerError(__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_7pyarrow_7_flight_12__pyx_unpickle_FlightServerError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightServerError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightServerError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightServerError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightServerError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightServerError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightServerError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __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 = FlightServerError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightServerError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightServerError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightServerError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightServerError(__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("pyarrow._flight.__pyx_unpickle_FlightServerError", __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_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightServerError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightServerError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightServerError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightServerError__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_FlightUnauthenticatedError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_15__pyx_unpickle_FlightUnauthenticatedError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_14__pyx_unpickle_FlightUnauthenticatedError[] = "__pyx_unpickle_FlightUnauthenticatedError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_15__pyx_unpickle_FlightUnauthenticatedError = {"__pyx_unpickle_FlightUnauthenticatedError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_15__pyx_unpickle_FlightUnauthenticatedError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_14__pyx_unpickle_FlightUnauthenticatedError};
static PyObject *__pyx_pw_7pyarrow_7_flight_15__pyx_unpickle_FlightUnauthenticatedError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthenticatedError (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_FlightUnauthenticatedError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightUnauthenticatedError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightUnauthenticatedError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightUnauthenticatedError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnauthenticatedError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_14__pyx_unpickle_FlightUnauthenticatedError(__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_7pyarrow_7_flight_14__pyx_unpickle_FlightUnauthenticatedError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthenticatedError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthenticatedError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightUnauthenticatedError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthenticatedError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnauthenticatedError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthenticatedError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __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 = FlightUnauthenticatedError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthenticatedError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthenticatedError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightUnauthenticatedError(__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("pyarrow._flight.__pyx_unpickle_FlightUnauthenticatedError", __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_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthenticatedError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthenticatedError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightUnauthenticatedError__set_state(<FlightUnauthenticatedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthenticatedError__set_state(FlightUnauthenticatedError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnauthenticatedError__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_FlightUnauthorizedError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_17__pyx_unpickle_FlightUnauthorizedError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_16__pyx_unpickle_FlightUnauthorizedError[] = "__pyx_unpickle_FlightUnauthorizedError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_17__pyx_unpickle_FlightUnauthorizedError = {"__pyx_unpickle_FlightUnauthorizedError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_17__pyx_unpickle_FlightUnauthorizedError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16__pyx_unpickle_FlightUnauthorizedError};
static PyObject *__pyx_pw_7pyarrow_7_flight_17__pyx_unpickle_FlightUnauthorizedError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthorizedError (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_FlightUnauthorizedError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightUnauthorizedError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightUnauthorizedError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightUnauthorizedError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnauthorizedError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_16__pyx_unpickle_FlightUnauthorizedError(__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_7pyarrow_7_flight_16__pyx_unpickle_FlightUnauthorizedError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthorizedError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthorizedError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightUnauthorizedError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthorizedError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnauthorizedError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthorizedError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __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 = FlightUnauthorizedError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthorizedError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnauthorizedError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightUnauthorizedError(__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("pyarrow._flight.__pyx_unpickle_FlightUnauthorizedError", __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_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnauthorizedError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnauthorizedError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnauthorizedError__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_FlightUnavailableError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_19__pyx_unpickle_FlightUnavailableError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_18__pyx_unpickle_FlightUnavailableError[] = "__pyx_unpickle_FlightUnavailableError(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_19__pyx_unpickle_FlightUnavailableError = {"__pyx_unpickle_FlightUnavailableError", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_19__pyx_unpickle_FlightUnavailableError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_18__pyx_unpickle_FlightUnavailableError};
static PyObject *__pyx_pw_7pyarrow_7_flight_19__pyx_unpickle_FlightUnavailableError(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnavailableError (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_FlightUnavailableError", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightUnavailableError", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightUnavailableError") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightUnavailableError", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnavailableError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_18__pyx_unpickle_FlightUnavailableError(__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_7pyarrow_7_flight_18__pyx_unpickle_FlightUnavailableError(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnavailableError", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnavailableError.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightUnavailableError.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnavailableError.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightUnavailableError), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnavailableError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __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 = FlightUnavailableError.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnavailableError__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightUnavailableError.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightUnavailableError(__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("pyarrow._flight.__pyx_unpickle_FlightUnavailableError", __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_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightUnavailableError__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightUnavailableError__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_result->__pyx_base.__dict__, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 13, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __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_5 = (__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_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightUnavailableError__set_state(<FlightUnavailableError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnavailableError__set_state(FlightUnavailableError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightUnavailableError__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_FlightDataStream(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_21__pyx_unpickle_FlightDataStream(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_20__pyx_unpickle_FlightDataStream[] = "__pyx_unpickle_FlightDataStream(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_21__pyx_unpickle_FlightDataStream = {"__pyx_unpickle_FlightDataStream", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_21__pyx_unpickle_FlightDataStream, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_20__pyx_unpickle_FlightDataStream};
static PyObject *__pyx_pw_7pyarrow_7_flight_21__pyx_unpickle_FlightDataStream(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightDataStream (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_FlightDataStream", 1, 3, 3, 1); __PYX_ERR(1, 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_FlightDataStream", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_FlightDataStream") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_FlightDataStream", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightDataStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_20__pyx_unpickle_FlightDataStream(__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_7pyarrow_7_flight_20__pyx_unpickle_FlightDataStream(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightDataStream", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightDataStream.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = FlightDataStream.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightDataStream.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDataStream), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightDataStream.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __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 = FlightDataStream.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightDataStream__set_state(((struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = FlightDataStream.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_FlightDataStream(__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("pyarrow._flight.__pyx_unpickle_FlightDataStream", __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_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_FlightDataStream__set_state(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_FlightDataStream__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_FlightDataStream__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_RecordBatchStream(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_23__pyx_unpickle_RecordBatchStream(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_22__pyx_unpickle_RecordBatchStream[] = "__pyx_unpickle_RecordBatchStream(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_23__pyx_unpickle_RecordBatchStream = {"__pyx_unpickle_RecordBatchStream", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_23__pyx_unpickle_RecordBatchStream, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_22__pyx_unpickle_RecordBatchStream};
static PyObject *__pyx_pw_7pyarrow_7_flight_23__pyx_unpickle_RecordBatchStream(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_RecordBatchStream (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_RecordBatchStream", 1, 3, 3, 1); __PYX_ERR(1, 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_RecordBatchStream", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_RecordBatchStream") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_RecordBatchStream", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_RecordBatchStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_22__pyx_unpickle_RecordBatchStream(__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_7pyarrow_7_flight_22__pyx_unpickle_RecordBatchStream(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_RecordBatchStream", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x060e9a6:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x060e9a6 = (data_source))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x060e9a6) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x060e9a6:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x060e9a6 = (data_source))" % __pyx_checksum)
 *     __pyx_result = RecordBatchStream.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0x060e9a6:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x060e9a6 = (data_source))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = RecordBatchStream.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x06, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x060e9a6:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x060e9a6 = (data_source))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x060e9a6 = (data_source))" % __pyx_checksum)
 *     __pyx_result = RecordBatchStream.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_RecordBatchStream), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0x060e9a6 = (data_source))" % __pyx_checksum)
 *     __pyx_result = RecordBatchStream.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __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 = RecordBatchStream.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_RecordBatchStream__set_state(((struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0x060e9a6 = (data_source))" % __pyx_checksum)
 *     __pyx_result = RecordBatchStream.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):
 *     __pyx_result.data_source = __pyx_state[0]
 */
  __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_RecordBatchStream(__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("pyarrow._flight.__pyx_unpickle_RecordBatchStream", __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_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.data_source = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_RecordBatchStream__set_state(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *__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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_RecordBatchStream__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):
 *     __pyx_result.data_source = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 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(1, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->data_source);
  __Pyx_DECREF(__pyx_v___pyx_result->data_source);
  __pyx_v___pyx_result->data_source = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):
 *     __pyx_result.data_source = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 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(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 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(1, 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.data_source = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):
 *     __pyx_result.data_source = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_RecordBatchStream__set_state(<RecordBatchStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_RecordBatchStream__set_state(RecordBatchStream __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.data_source = __pyx_state[0]
 *     if len(__pyx_state) > 1 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("pyarrow._flight.__pyx_unpickle_RecordBatchStream__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_ServerAuthHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_25__pyx_unpickle_ServerAuthHandler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_24__pyx_unpickle_ServerAuthHandler[] = "__pyx_unpickle_ServerAuthHandler(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_25__pyx_unpickle_ServerAuthHandler = {"__pyx_unpickle_ServerAuthHandler", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_25__pyx_unpickle_ServerAuthHandler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_24__pyx_unpickle_ServerAuthHandler};
static PyObject *__pyx_pw_7pyarrow_7_flight_25__pyx_unpickle_ServerAuthHandler(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerAuthHandler (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_ServerAuthHandler", 1, 3, 3, 1); __PYX_ERR(1, 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_ServerAuthHandler", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ServerAuthHandler") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ServerAuthHandler", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerAuthHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_24__pyx_unpickle_ServerAuthHandler(__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_7pyarrow_7_flight_24__pyx_unpickle_ServerAuthHandler(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerAuthHandler", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerAuthHandler.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ServerAuthHandler.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerAuthHandler.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ServerAuthHandler), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __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 = ServerAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerAuthHandler__set_state(((struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ServerAuthHandler(__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("pyarrow._flight.__pyx_unpickle_ServerAuthHandler", __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_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerAuthHandler__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerAuthHandler__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerAuthHandler__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_ClientAuthHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_27__pyx_unpickle_ClientAuthHandler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_26__pyx_unpickle_ClientAuthHandler[] = "__pyx_unpickle_ClientAuthHandler(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_27__pyx_unpickle_ClientAuthHandler = {"__pyx_unpickle_ClientAuthHandler", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_27__pyx_unpickle_ClientAuthHandler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_26__pyx_unpickle_ClientAuthHandler};
static PyObject *__pyx_pw_7pyarrow_7_flight_27__pyx_unpickle_ClientAuthHandler(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientAuthHandler (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_ClientAuthHandler", 1, 3, 3, 1); __PYX_ERR(1, 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_ClientAuthHandler", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ClientAuthHandler") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ClientAuthHandler", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientAuthHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_26__pyx_unpickle_ClientAuthHandler(__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_7pyarrow_7_flight_26__pyx_unpickle_ClientAuthHandler(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientAuthHandler", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientAuthHandler.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ClientAuthHandler.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientAuthHandler.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ClientAuthHandler), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __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 = ClientAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientAuthHandler__set_state(((struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientAuthHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ClientAuthHandler(__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("pyarrow._flight.__pyx_unpickle_ClientAuthHandler", __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_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientAuthHandler__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientAuthHandler__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ClientAuthHandler__set_state(<ClientAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientAuthHandler__set_state(ClientAuthHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientAuthHandler__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_ClientMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_29__pyx_unpickle_ClientMiddlewareFactory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_28__pyx_unpickle_ClientMiddlewareFactory[] = "__pyx_unpickle_ClientMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_29__pyx_unpickle_ClientMiddlewareFactory = {"__pyx_unpickle_ClientMiddlewareFactory", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_29__pyx_unpickle_ClientMiddlewareFactory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_28__pyx_unpickle_ClientMiddlewareFactory};
static PyObject *__pyx_pw_7pyarrow_7_flight_29__pyx_unpickle_ClientMiddlewareFactory(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddlewareFactory (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_ClientMiddlewareFactory", 1, 3, 3, 1); __PYX_ERR(1, 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_ClientMiddlewareFactory", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ClientMiddlewareFactory") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ClientMiddlewareFactory", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientMiddlewareFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_28__pyx_unpickle_ClientMiddlewareFactory(__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_7pyarrow_7_flight_28__pyx_unpickle_ClientMiddlewareFactory(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddlewareFactory", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddlewareFactory.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ClientMiddlewareFactory.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddlewareFactory.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ClientMiddlewareFactory), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __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 = ClientMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddlewareFactory__set_state(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ClientMiddlewareFactory(__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("pyarrow._flight.__pyx_unpickle_ClientMiddlewareFactory", __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_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddlewareFactory__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddlewareFactory__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientMiddlewareFactory__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_ClientMiddleware(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_31__pyx_unpickle_ClientMiddleware(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_30__pyx_unpickle_ClientMiddleware[] = "__pyx_unpickle_ClientMiddleware(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_31__pyx_unpickle_ClientMiddleware = {"__pyx_unpickle_ClientMiddleware", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_31__pyx_unpickle_ClientMiddleware, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_30__pyx_unpickle_ClientMiddleware};
static PyObject *__pyx_pw_7pyarrow_7_flight_31__pyx_unpickle_ClientMiddleware(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddleware (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_ClientMiddleware", 1, 3, 3, 1); __PYX_ERR(1, 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_ClientMiddleware", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ClientMiddleware") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ClientMiddleware", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientMiddleware", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_30__pyx_unpickle_ClientMiddleware(__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_7pyarrow_7_flight_30__pyx_unpickle_ClientMiddleware(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddleware", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddleware.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ClientMiddleware.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddleware.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ClientMiddleware), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __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 = ClientMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddleware__set_state(((struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ClientMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ClientMiddleware(__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("pyarrow._flight.__pyx_unpickle_ClientMiddleware", __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_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ClientMiddleware__set_state(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ClientMiddleware__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ClientMiddleware__set_state(<ClientMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddleware__set_state(ClientMiddleware __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ClientMiddleware__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_ServerMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_33__pyx_unpickle_ServerMiddlewareFactory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_32__pyx_unpickle_ServerMiddlewareFactory[] = "__pyx_unpickle_ServerMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_33__pyx_unpickle_ServerMiddlewareFactory = {"__pyx_unpickle_ServerMiddlewareFactory", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_33__pyx_unpickle_ServerMiddlewareFactory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_32__pyx_unpickle_ServerMiddlewareFactory};
static PyObject *__pyx_pw_7pyarrow_7_flight_33__pyx_unpickle_ServerMiddlewareFactory(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddlewareFactory (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_ServerMiddlewareFactory", 1, 3, 3, 1); __PYX_ERR(1, 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_ServerMiddlewareFactory", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ServerMiddlewareFactory") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ServerMiddlewareFactory", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerMiddlewareFactory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_32__pyx_unpickle_ServerMiddlewareFactory(__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_7pyarrow_7_flight_32__pyx_unpickle_ServerMiddlewareFactory(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddlewareFactory", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddlewareFactory.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ServerMiddlewareFactory.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddlewareFactory.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __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 = ServerMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddlewareFactory__set_state(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddlewareFactory.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ServerMiddlewareFactory(__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("pyarrow._flight.__pyx_unpickle_ServerMiddlewareFactory", __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_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddlewareFactory__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddlewareFactory__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerMiddlewareFactory__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_ServerMiddleware(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_35__pyx_unpickle_ServerMiddleware(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_34__pyx_unpickle_ServerMiddleware[] = "__pyx_unpickle_ServerMiddleware(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_35__pyx_unpickle_ServerMiddleware = {"__pyx_unpickle_ServerMiddleware", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_35__pyx_unpickle_ServerMiddleware, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_34__pyx_unpickle_ServerMiddleware};
static PyObject *__pyx_pw_7pyarrow_7_flight_35__pyx_unpickle_ServerMiddleware(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddleware (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_ServerMiddleware", 1, 3, 3, 1); __PYX_ERR(1, 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_ServerMiddleware", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ServerMiddleware") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ServerMiddleware", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerMiddleware", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_34__pyx_unpickle_ServerMiddleware(__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_7pyarrow_7_flight_34__pyx_unpickle_ServerMiddleware(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddleware", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddleware.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = ServerMiddleware.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddleware.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight_ServerMiddleware), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __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 = ServerMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddleware__set_state(((struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = ServerMiddleware.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __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_ServerMiddleware(__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("pyarrow._flight.__pyx_unpickle_ServerMiddleware", __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_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle_ServerMiddleware__set_state(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __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;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ServerMiddleware__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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(1, 13, __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(1, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ServerMiddleware__set_state(<ServerMiddleware> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddleware__set_state(ServerMiddleware __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle_ServerMiddleware__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__ServerMiddlewareFactoryWrapper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_37__pyx_unpickle__ServerMiddlewareFactoryWrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_36__pyx_unpickle__ServerMiddlewareFactoryWrapper[] = "__pyx_unpickle__ServerMiddlewareFactoryWrapper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_37__pyx_unpickle__ServerMiddlewareFactoryWrapper = {"__pyx_unpickle__ServerMiddlewareFactoryWrapper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_37__pyx_unpickle__ServerMiddlewareFactoryWrapper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_36__pyx_unpickle__ServerMiddlewareFactoryWrapper};
static PyObject *__pyx_pw_7pyarrow_7_flight_37__pyx_unpickle__ServerMiddlewareFactoryWrapper(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareFactoryWrapper (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__ServerMiddlewareFactoryWrapper", 1, 3, 3, 1); __PYX_ERR(1, 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__ServerMiddlewareFactoryWrapper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__ServerMiddlewareFactoryWrapper") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__ServerMiddlewareFactoryWrapper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle__ServerMiddlewareFactoryWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_36__pyx_unpickle__ServerMiddlewareFactoryWrapper(__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_7pyarrow_7_flight_36__pyx_unpickle__ServerMiddlewareFactoryWrapper(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareFactoryWrapper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0f695c4:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0f695c4 = (factories))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x0f695c4) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0f695c4:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0f695c4 = (factories))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareFactoryWrapper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0x0f695c4:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0f695c4 = (factories))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = _ServerMiddlewareFactoryWrapper.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x0f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x0f695c4:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0f695c4 = (factories))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x0f695c4 = (factories))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareFactoryWrapper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0x0f695c4 = (factories))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareFactoryWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __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 = _ServerMiddlewareFactoryWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0x0f695c4 = (factories))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareFactoryWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.factories = __pyx_state[0]
 */
  __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__ServerMiddlewareFactoryWrapper(__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("pyarrow._flight.__pyx_unpickle__ServerMiddlewareFactoryWrapper", __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__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *__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;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.factories = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 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(1, 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(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->factories);
  __Pyx_DECREF(__pyx_v___pyx_result->factories);
  __pyx_v___pyx_result->factories = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 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(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 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(1, 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.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 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("pyarrow._flight.__pyx_unpickle__ServerMiddlewareFactoryWrapper__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__ServerMiddlewareWrapper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_7pyarrow_7_flight_39__pyx_unpickle__ServerMiddlewareWrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7pyarrow_7_flight_38__pyx_unpickle__ServerMiddlewareWrapper[] = "__pyx_unpickle__ServerMiddlewareWrapper(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_7pyarrow_7_flight_39__pyx_unpickle__ServerMiddlewareWrapper = {"__pyx_unpickle__ServerMiddlewareWrapper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_39__pyx_unpickle__ServerMiddlewareWrapper, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_38__pyx_unpickle__ServerMiddlewareWrapper};
static PyObject *__pyx_pw_7pyarrow_7_flight_39__pyx_unpickle__ServerMiddlewareWrapper(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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareWrapper (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__ServerMiddlewareWrapper", 1, 3, 3, 1); __PYX_ERR(1, 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__ServerMiddlewareWrapper", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__ServerMiddlewareWrapper") < 0)) __PYX_ERR(1, 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(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__ServerMiddlewareWrapper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyarrow._flight.__pyx_unpickle__ServerMiddlewareWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7pyarrow_7_flight_38__pyx_unpickle__ServerMiddlewareWrapper(__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_7pyarrow_7_flight_38__pyx_unpickle__ServerMiddlewareWrapper(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;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareWrapper", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb200f06:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb200f06 = (middleware))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb200f06) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb200f06:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb200f06 = (middleware))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareWrapper.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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(1, 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 != 0xb200f06:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb200f06 = (middleware))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = _ServerMiddlewareWrapper.__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(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 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(1, 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(1, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xb200f06:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb200f06 = (middleware))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb200f06 = (middleware))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareWrapper.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7pyarrow_7_flight__ServerMiddlewareWrapper), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 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(1, 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 0xb200f06 = (middleware))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __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 = _ServerMiddlewareWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __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(1, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareWrapper__set_state(((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 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 0xb200f06 = (middleware))" % __pyx_checksum)
 *     __pyx_result = _ServerMiddlewareWrapper.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.middleware = __pyx_state[0]
 */
  __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__ServerMiddlewareWrapper(__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("pyarrow._flight.__pyx_unpickle__ServerMiddlewareWrapper", __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__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.middleware = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_7pyarrow_7_flight___pyx_unpickle__ServerMiddlewareWrapper__set_state(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *__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;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ServerMiddlewareWrapper__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.middleware = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 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(1, 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(1, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->middleware);
  __Pyx_DECREF(__pyx_v___pyx_result->middleware);
  __pyx_v___pyx_result->middleware = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.middleware = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 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(1, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 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(1, 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.middleware = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 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(1, 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__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):
 *     __pyx_result.middleware = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle__ServerMiddlewareWrapper__set_state(<_ServerMiddlewareWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareWrapper__set_state(_ServerMiddlewareWrapper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.middleware = __pyx_state[0]
 *     if len(__pyx_state) > 1 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("pyarrow._flight.__pyx_unpickle__ServerMiddlewareWrapper__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cpython/datetime.pxd":104
 * # Datetime C API initialization function.
 * # You have to call it before any usage of DateTime CAPI functions.
 * cdef inline void import_datetime():             # <<<<<<<<<<<<<<
 *     PyDateTime_IMPORT
 * 
 */

static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("import_datetime", 0);

  /* "cpython/datetime.pxd":105
 * # You have to call it before any usage of DateTime CAPI functions.
 * cdef inline void import_datetime():
 *     PyDateTime_IMPORT             # <<<<<<<<<<<<<<
 * 
 * # Create date object using DateTime CAPI factory function.
 */
  (void)(PyDateTime_IMPORT);

  /* "cpython/datetime.pxd":104
 * # Datetime C API initialization function.
 * # You have to call it before any usage of DateTime CAPI functions.
 * cdef inline void import_datetime():             # <<<<<<<<<<<<<<
 *     PyDateTime_IMPORT
 * 
 */

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

/* "cpython/datetime.pxd":109
 * # Create date object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object date_new(int year, int month, int day):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_date_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("date_new", 0);

  /* "cpython/datetime.pxd":110
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object date_new(int year, int month, int day):
 *     return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType)             # <<<<<<<<<<<<<<
 * 
 * # Create time object using DateTime CAPI factory function
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDateTimeAPI->Date_FromDate(__pyx_v_year, __pyx_v_month, __pyx_v_day, PyDateTimeAPI->DateType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":109
 * # Create date object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object date_new(int year, int month, int day):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType)
 * 
 */

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

/* "cpython/datetime.pxd":114
 * # Create time object using DateTime CAPI factory function
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_new(int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("time_new", 0);

  /* "cpython/datetime.pxd":115
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz):
 *     return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType)             # <<<<<<<<<<<<<<
 * 
 * # Create datetime object using DateTime CAPI factory function.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDateTimeAPI->Time_FromTime(__pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->TimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":114
 * # Create time object using DateTime CAPI factory function
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType)
 * 
 */

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

/* "cpython/datetime.pxd":119
 * # Create datetime object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day, int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("datetime_new", 0);

  /* "cpython/datetime.pxd":120
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz):
 *     return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType)             # <<<<<<<<<<<<<<
 * 
 * # Create timedelta object using DateTime CAPI factory function.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDateTimeAPI->DateTime_FromDateAndTime(__pyx_v_year, __pyx_v_month, __pyx_v_day, __pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->DateTimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":119
 * # Create datetime object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType)
 * 
 */

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

/* "cpython/datetime.pxd":124
 * # Create timedelta object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object timedelta_new(int days, int seconds, int useconds):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_timedelta_new(int __pyx_v_days, int __pyx_v_seconds, int __pyx_v_useconds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("timedelta_new", 0);

  /* "cpython/datetime.pxd":125
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object timedelta_new(int days, int seconds, int useconds):
 *     return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType)             # <<<<<<<<<<<<<<
 * 
 * # More recognizable getters for date/time/datetime/timedelta.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDateTimeAPI->Delta_FromDelta(__pyx_v_days, __pyx_v_seconds, __pyx_v_useconds, 1, PyDateTimeAPI->DeltaType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":124
 * # Create timedelta object using DateTime CAPI factory function.
 * # Note, there are no range checks for any of the arguments.
 * cdef inline object timedelta_new(int days, int seconds, int useconds):             # <<<<<<<<<<<<<<
 *     return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType)
 * 
 */

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

/* "cpython/datetime.pxd":133
 * 
 * # Get tzinfo of time
 * cdef inline object time_tzinfo(object o):             # <<<<<<<<<<<<<<
 *     if (<PyDateTime_Time*>o).hastzinfo:
 *         return <object>(<PyDateTime_Time*>o).tzinfo
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_tzinfo(PyObject *__pyx_v_o) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("time_tzinfo", 0);

  /* "cpython/datetime.pxd":134
 * # Get tzinfo of time
 * cdef inline object time_tzinfo(object o):
 *     if (<PyDateTime_Time*>o).hastzinfo:             # <<<<<<<<<<<<<<
 *         return <object>(<PyDateTime_Time*>o).tzinfo
 *     else:
 */
  __pyx_t_1 = (((PyDateTime_Time *)__pyx_v_o)->hastzinfo != 0);
  if (__pyx_t_1) {

    /* "cpython/datetime.pxd":135
 * cdef inline object time_tzinfo(object o):
 *     if (<PyDateTime_Time*>o).hastzinfo:
 *         return <object>(<PyDateTime_Time*>o).tzinfo             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo));
    __pyx_r = ((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo);
    goto __pyx_L0;

    /* "cpython/datetime.pxd":134
 * # Get tzinfo of time
 * cdef inline object time_tzinfo(object o):
 *     if (<PyDateTime_Time*>o).hastzinfo:             # <<<<<<<<<<<<<<
 *         return <object>(<PyDateTime_Time*>o).tzinfo
 *     else:
 */
  }

  /* "cpython/datetime.pxd":137
 *         return <object>(<PyDateTime_Time*>o).tzinfo
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * # Get tzinfo of datetime
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cpython/datetime.pxd":133
 * 
 * # Get tzinfo of time
 * cdef inline object time_tzinfo(object o):             # <<<<<<<<<<<<<<
 *     if (<PyDateTime_Time*>o).hastzinfo:
 *         return <object>(<PyDateTime_Time*>o).tzinfo
 */

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

/* "cpython/datetime.pxd":140
 * 
 * # Get tzinfo of datetime
 * cdef inline object datetime_tzinfo(object o):             # <<<<<<<<<<<<<<
 *     if (<PyDateTime_DateTime*>o).hastzinfo:
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo
 */

static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_tzinfo(PyObject *__pyx_v_o) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("datetime_tzinfo", 0);

  /* "cpython/datetime.pxd":141
 * # Get tzinfo of datetime
 * cdef inline object datetime_tzinfo(object o):
 *     if (<PyDateTime_DateTime*>o).hastzinfo:             # <<<<<<<<<<<<<<
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo
 *     else:
 */
  __pyx_t_1 = (((PyDateTime_DateTime *)__pyx_v_o)->hastzinfo != 0);
  if (__pyx_t_1) {

    /* "cpython/datetime.pxd":142
 * cdef inline object datetime_tzinfo(object o):
 *     if (<PyDateTime_DateTime*>o).hastzinfo:
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo             # <<<<<<<<<<<<<<
 *     else:
 *         return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo));
    __pyx_r = ((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo);
    goto __pyx_L0;

    /* "cpython/datetime.pxd":141
 * # Get tzinfo of datetime
 * cdef inline object datetime_tzinfo(object o):
 *     if (<PyDateTime_DateTime*>o).hastzinfo:             # <<<<<<<<<<<<<<
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo
 *     else:
 */
  }

  /* "cpython/datetime.pxd":144
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * # Get year of date
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cpython/datetime.pxd":140
 * 
 * # Get tzinfo of datetime
 * cdef inline object datetime_tzinfo(object o):             # <<<<<<<<<<<<<<
 *     if (<PyDateTime_DateTime*>o).hastzinfo:
 *         return <object>(<PyDateTime_DateTime*>o).tzinfo
 */

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

/* "cpython/datetime.pxd":147
 * 
 * # Get year of date
 * cdef inline int date_year(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_YEAR(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_year(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("date_year", 0);

  /* "cpython/datetime.pxd":148
 * # Get year of date
 * cdef inline int date_year(object o):
 *     return PyDateTime_GET_YEAR(o)             # <<<<<<<<<<<<<<
 * 
 * # Get month of date
 */
  __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":147
 * 
 * # Get year of date
 * cdef inline int date_year(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_YEAR(o)
 * 
 */

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

/* "cpython/datetime.pxd":151
 * 
 * # Get month of date
 * cdef inline int date_month(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_MONTH(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_month(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("date_month", 0);

  /* "cpython/datetime.pxd":152
 * # Get month of date
 * cdef inline int date_month(object o):
 *     return PyDateTime_GET_MONTH(o)             # <<<<<<<<<<<<<<
 * 
 * # Get day of date
 */
  __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":151
 * 
 * # Get month of date
 * cdef inline int date_month(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_MONTH(o)
 * 
 */

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

/* "cpython/datetime.pxd":155
 * 
 * # Get day of date
 * cdef inline int date_day(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_DAY(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_day(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("date_day", 0);

  /* "cpython/datetime.pxd":156
 * # Get day of date
 * cdef inline int date_day(object o):
 *     return PyDateTime_GET_DAY(o)             # <<<<<<<<<<<<<<
 * 
 * # Get year of datetime
 */
  __pyx_r = PyDateTime_GET_DAY(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":155
 * 
 * # Get day of date
 * cdef inline int date_day(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_DAY(o)
 * 
 */

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

/* "cpython/datetime.pxd":159
 * 
 * # Get year of datetime
 * cdef inline int datetime_year(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_YEAR(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_year(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_year", 0);

  /* "cpython/datetime.pxd":160
 * # Get year of datetime
 * cdef inline int datetime_year(object o):
 *     return PyDateTime_GET_YEAR(o)             # <<<<<<<<<<<<<<
 * 
 * # Get month of datetime
 */
  __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":159
 * 
 * # Get year of datetime
 * cdef inline int datetime_year(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_YEAR(o)
 * 
 */

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

/* "cpython/datetime.pxd":163
 * 
 * # Get month of datetime
 * cdef inline int datetime_month(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_MONTH(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_month(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_month", 0);

  /* "cpython/datetime.pxd":164
 * # Get month of datetime
 * cdef inline int datetime_month(object o):
 *     return PyDateTime_GET_MONTH(o)             # <<<<<<<<<<<<<<
 * 
 * # Get day of datetime
 */
  __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":163
 * 
 * # Get month of datetime
 * cdef inline int datetime_month(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_MONTH(o)
 * 
 */

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

/* "cpython/datetime.pxd":167
 * 
 * # Get day of datetime
 * cdef inline int datetime_day(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_DAY(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_day(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_day", 0);

  /* "cpython/datetime.pxd":168
 * # Get day of datetime
 * cdef inline int datetime_day(object o):
 *     return PyDateTime_GET_DAY(o)             # <<<<<<<<<<<<<<
 * 
 * # Get hour of time
 */
  __pyx_r = PyDateTime_GET_DAY(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":167
 * 
 * # Get day of datetime
 * cdef inline int datetime_day(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_GET_DAY(o)
 * 
 */

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

/* "cpython/datetime.pxd":171
 * 
 * # Get hour of time
 * cdef inline int time_hour(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_HOUR(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_hour(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("time_hour", 0);

  /* "cpython/datetime.pxd":172
 * # Get hour of time
 * cdef inline int time_hour(object o):
 *     return PyDateTime_TIME_GET_HOUR(o)             # <<<<<<<<<<<<<<
 * 
 * # Get minute of time
 */
  __pyx_r = PyDateTime_TIME_GET_HOUR(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":171
 * 
 * # Get hour of time
 * cdef inline int time_hour(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_HOUR(o)
 * 
 */

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

/* "cpython/datetime.pxd":175
 * 
 * # Get minute of time
 * cdef inline int time_minute(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_MINUTE(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_minute(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("time_minute", 0);

  /* "cpython/datetime.pxd":176
 * # Get minute of time
 * cdef inline int time_minute(object o):
 *     return PyDateTime_TIME_GET_MINUTE(o)             # <<<<<<<<<<<<<<
 * 
 * # Get second of time
 */
  __pyx_r = PyDateTime_TIME_GET_MINUTE(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":175
 * 
 * # Get minute of time
 * cdef inline int time_minute(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_MINUTE(o)
 * 
 */

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

/* "cpython/datetime.pxd":179
 * 
 * # Get second of time
 * cdef inline int time_second(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_SECOND(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_second(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("time_second", 0);

  /* "cpython/datetime.pxd":180
 * # Get second of time
 * cdef inline int time_second(object o):
 *     return PyDateTime_TIME_GET_SECOND(o)             # <<<<<<<<<<<<<<
 * 
 * # Get microsecond of time
 */
  __pyx_r = PyDateTime_TIME_GET_SECOND(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":179
 * 
 * # Get second of time
 * cdef inline int time_second(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_SECOND(o)
 * 
 */

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

/* "cpython/datetime.pxd":183
 * 
 * # Get microsecond of time
 * cdef inline int time_microsecond(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_MICROSECOND(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_microsecond(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("time_microsecond", 0);

  /* "cpython/datetime.pxd":184
 * # Get microsecond of time
 * cdef inline int time_microsecond(object o):
 *     return PyDateTime_TIME_GET_MICROSECOND(o)             # <<<<<<<<<<<<<<
 * 
 * # Get hour of datetime
 */
  __pyx_r = PyDateTime_TIME_GET_MICROSECOND(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":183
 * 
 * # Get microsecond of time
 * cdef inline int time_microsecond(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_TIME_GET_MICROSECOND(o)
 * 
 */

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

/* "cpython/datetime.pxd":187
 * 
 * # Get hour of datetime
 * cdef inline int datetime_hour(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_HOUR(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_hour(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_hour", 0);

  /* "cpython/datetime.pxd":188
 * # Get hour of datetime
 * cdef inline int datetime_hour(object o):
 *     return PyDateTime_DATE_GET_HOUR(o)             # <<<<<<<<<<<<<<
 * 
 * # Get minute of datetime
 */
  __pyx_r = PyDateTime_DATE_GET_HOUR(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":187
 * 
 * # Get hour of datetime
 * cdef inline int datetime_hour(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_HOUR(o)
 * 
 */

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

/* "cpython/datetime.pxd":191
 * 
 * # Get minute of datetime
 * cdef inline int datetime_minute(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_MINUTE(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_minute(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_minute", 0);

  /* "cpython/datetime.pxd":192
 * # Get minute of datetime
 * cdef inline int datetime_minute(object o):
 *     return PyDateTime_DATE_GET_MINUTE(o)             # <<<<<<<<<<<<<<
 * 
 * # Get second of datetime
 */
  __pyx_r = PyDateTime_DATE_GET_MINUTE(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":191
 * 
 * # Get minute of datetime
 * cdef inline int datetime_minute(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_MINUTE(o)
 * 
 */

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

/* "cpython/datetime.pxd":195
 * 
 * # Get second of datetime
 * cdef inline int datetime_second(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_SECOND(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_second(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_second", 0);

  /* "cpython/datetime.pxd":196
 * # Get second of datetime
 * cdef inline int datetime_second(object o):
 *     return PyDateTime_DATE_GET_SECOND(o)             # <<<<<<<<<<<<<<
 * 
 * # Get microsecond of datetime
 */
  __pyx_r = PyDateTime_DATE_GET_SECOND(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":195
 * 
 * # Get second of datetime
 * cdef inline int datetime_second(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_SECOND(o)
 * 
 */

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

/* "cpython/datetime.pxd":199
 * 
 * # Get microsecond of datetime
 * cdef inline int datetime_microsecond(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_MICROSECOND(o)
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_microsecond(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_microsecond", 0);

  /* "cpython/datetime.pxd":200
 * # Get microsecond of datetime
 * cdef inline int datetime_microsecond(object o):
 *     return PyDateTime_DATE_GET_MICROSECOND(o)             # <<<<<<<<<<<<<<
 * 
 * # Get days of timedelta
 */
  __pyx_r = PyDateTime_DATE_GET_MICROSECOND(__pyx_v_o);
  goto __pyx_L0;

  /* "cpython/datetime.pxd":199
 * 
 * # Get microsecond of datetime
 * cdef inline int datetime_microsecond(object o):             # <<<<<<<<<<<<<<
 *     return PyDateTime_DATE_GET_MICROSECOND(o)
 * 
 */

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

/* "cpython/datetime.pxd":203
 * 
 * # Get days of timedelta
 * cdef inline int timedelta_days(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).days
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_days(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("timedelta_days", 0);

  /* "cpython/datetime.pxd":204
 * # Get days of timedelta
 * cdef inline int timedelta_days(object o):
 *     return (<PyDateTime_Delta*>o).days             # <<<<<<<<<<<<<<
 * 
 * # Get seconds of timedelta
 */
  __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->days;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":203
 * 
 * # Get days of timedelta
 * cdef inline int timedelta_days(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).days
 * 
 */

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

/* "cpython/datetime.pxd":207
 * 
 * # Get seconds of timedelta
 * cdef inline int timedelta_seconds(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).seconds
 * 
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_seconds(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("timedelta_seconds", 0);

  /* "cpython/datetime.pxd":208
 * # Get seconds of timedelta
 * cdef inline int timedelta_seconds(object o):
 *     return (<PyDateTime_Delta*>o).seconds             # <<<<<<<<<<<<<<
 * 
 * # Get microseconds of timedelta
 */
  __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->seconds;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":207
 * 
 * # Get seconds of timedelta
 * cdef inline int timedelta_seconds(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).seconds
 * 
 */

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

/* "cpython/datetime.pxd":211
 * 
 * # Get microseconds of timedelta
 * cdef inline int timedelta_microseconds(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).microseconds
 */

static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_microseconds(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("timedelta_microseconds", 0);

  /* "cpython/datetime.pxd":212
 * # Get microseconds of timedelta
 * cdef inline int timedelta_microseconds(object o):
 *     return (<PyDateTime_Delta*>o).microseconds             # <<<<<<<<<<<<<<
 */
  __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->microseconds;
  goto __pyx_L0;

  /* "cpython/datetime.pxd":211
 * 
 * # Get microseconds of timedelta
 * cdef inline int timedelta_microseconds(object o):             # <<<<<<<<<<<<<<
 *     return (<PyDateTime_Delta*>o).microseconds
 */

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

/* "pyarrow/includes/common.pxd":106
 *     T GetResultValue[T](CResult[T]) except *
 * 
 * cdef inline object PyObject_to_object(PyObject* o):             # <<<<<<<<<<<<<<
 *     # Cast to "object" increments reference count
 *     cdef object result = <object> o
 */

static CYTHON_INLINE PyObject *__pyx_f_7pyarrow_8includes_6common_PyObject_to_object(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyObject_to_object", 0);

  /* "pyarrow/includes/common.pxd":108
 * cdef inline object PyObject_to_object(PyObject* o):
 *     # Cast to "object" increments reference count
 *     cdef object result = <object> o             # <<<<<<<<<<<<<<
 *     cpython.Py_DECREF(result)
 *     return result
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_o);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pyarrow/includes/common.pxd":109
 *     # Cast to "object" increments reference count
 *     cdef object result = <object> o
 *     cpython.Py_DECREF(result)             # <<<<<<<<<<<<<<
 *     return result
 */
  Py_DECREF(__pyx_v_result);

  /* "pyarrow/includes/common.pxd":110
 *     cdef object result = <object> o
 *     cpython.Py_DECREF(result)
 *     return result             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyarrow/includes/common.pxd":106
 *     T GetResultValue[T](CResult[T]) except *
 * 
 * cdef inline object PyObject_to_object(PyObject* o):             # <<<<<<<<<<<<<<
 *     # Cast to "object" increments reference count
 *     cdef object result = <object> o
 */

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

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

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

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

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

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

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

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

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

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

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

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char const *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":14
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0             # <<<<<<<<<<<<<<
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)
 */
  __pyx_v_length = 0;

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = 0
 *     cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::string>  __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) {
  std::vector<std::string>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::string __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0);

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __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_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __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, 47, __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, 47, __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, 47, __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, 47, __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, 47, __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, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((std::string)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_string")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector<std::string>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_string", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCallOptions __pyx_vtable_7pyarrow_7_flight_FlightCallOptions;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightCallOptions(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *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_7pyarrow_7_flight_FlightCallOptions *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightCallOptions;
  new((void*)&(p->options))  arrow::flight::FlightCallOptions();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightCallOptions(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *p = (struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->options);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightCallOptions[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17FlightCallOptions_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightCallOptions_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17FlightCallOptions_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightCallOptions = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightCallOptions", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightCallOptions, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightCallOptions(timeout=None)\nRPC-layer options for a Flight call.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightCallOptions, /*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_7pyarrow_7_flight_17FlightCallOptions_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightCallOptions, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError __pyx_vtable_7pyarrow_7_flight_FlightError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightError *p;
  PyObject *o = (&((PyTypeObject*)PyExc_Exception)[0])->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightError *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightError;
  p->__dict__ = PyDict_New(); if (unlikely(!p->__dict__)) goto bad;return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightError(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightError *)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);
  if (p->__dict__) PyDict_Clear(p->__dict__);
  Py_CLEAR(p->__dict__);
  PyObject_GC_Track(o);
  (&((PyTypeObject*)PyExc_Exception)[0])->tp_dealloc(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight_FlightError(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight_FlightError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightError *)o;
  if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse); else { e = (&((PyTypeObject*)PyExc_Exception)[0])->tp_traverse(o,v,a); if (e) return e; }
  if (p->__dict__) {
    e = (*v)(p->__dict__, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight_FlightError(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight_FlightError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightError *)o;
  if (!(&((PyTypeObject*)PyExc_Exception)[0])->tp_clear); else (&((PyTypeObject*)PyExc_Exception)[0])->tp_clear(o);
  tmp = ((PyObject*)p->__dict__);
  p->__dict__ = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightError *)o;
  if (unlikely(!p->__dict__)){
    p->__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__dict__);
  return p->__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_11FlightError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_11FlightError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_11FlightError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_11FlightError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightError, __dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightInternalError __pyx_vtable_7pyarrow_7_flight_FlightInternalError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightInternalError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightInternalError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightInternalError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightInternalError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightInternalError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_19FlightInternalError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_19FlightInternalError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_19FlightInternalError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_19FlightInternalError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightInternalError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightInternalError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightInternalError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightInternalError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightInternalError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightInternalError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightInternalError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightInternalError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightTimedOutError __pyx_vtable_7pyarrow_7_flight_FlightTimedOutError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightTimedOutError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightTimedOutError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightTimedOutError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightTimedOutError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_19FlightTimedOutError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_19FlightTimedOutError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_19FlightTimedOutError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightTimedOutError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightTimedOutError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightTimedOutError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightTimedOutError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightTimedOutError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightTimedOutError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightTimedOutError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightTimedOutError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightCancelledError __pyx_vtable_7pyarrow_7_flight_FlightCancelledError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightCancelledError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightCancelledError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightCancelledError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightCancelledError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_20FlightCancelledError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightCancelledError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_20FlightCancelledError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightCancelledError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightCancelledError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightCancelledError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightCancelledError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightCancelledError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightCancelledError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightCancelledError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightCancelledError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerError __pyx_vtable_7pyarrow_7_flight_FlightServerError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightServerError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightServerError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightServerError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightServerError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightServerError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightServerError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightServerError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightServerError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightServerError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17FlightServerError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightServerError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17FlightServerError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightServerError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightServerError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightServerError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightServerError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightServerError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightServerError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightServerError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightServerError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightServerError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthenticatedError __pyx_vtable_7pyarrow_7_flight_FlightUnauthenticatedError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnauthenticatedError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightUnauthenticatedError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightUnauthenticatedError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightUnauthenticatedError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_26FlightUnauthenticatedError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_26FlightUnauthenticatedError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_26FlightUnauthenticatedError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightUnauthenticatedError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightUnauthenticatedError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightUnauthenticatedError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightUnauthenticatedError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightUnauthenticatedError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthenticatedError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightUnauthenticatedError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnauthorizedError __pyx_vtable_7pyarrow_7_flight_FlightUnauthorizedError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnauthorizedError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightUnauthorizedError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightUnauthorizedError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightUnauthorizedError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_23FlightUnauthorizedError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23FlightUnauthorizedError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_23FlightUnauthorizedError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightUnauthorizedError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightUnauthorizedError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightUnauthorizedError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightUnauthorizedError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightUnauthorizedError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightUnauthorizedError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightUnauthorizedError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightUnauthorizedError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightUnavailableError __pyx_vtable_7pyarrow_7_flight_FlightUnavailableError;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightUnavailableError(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightError(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightError*)__pyx_vtabptr_7pyarrow_7_flight_FlightUnavailableError;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightUnavailableError(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *p = (struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightUnavailableError[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_22FlightUnavailableError___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_22FlightUnavailableError_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_22FlightUnavailableError_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightUnavailableError[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightUnavailableError, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightUnavailableError = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightUnavailableError", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightError, /*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_7pyarrow_7_flight_FlightError, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_FlightError, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightUnavailableError, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightUnavailableError, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightUnavailableError, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightUnavailableError, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_Action __pyx_vtable_7pyarrow_7_flight_Action;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_Action(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_Action *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_7pyarrow_7_flight_Action *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_Action;
  new((void*)&(p->action))  arrow::flight::Action();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_Action(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_Action *p = (struct __pyx_obj_7pyarrow_7_flight_Action *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->action);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_6Action_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_6Action_4type_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_6Action_body(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_6Action_4body_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_Action[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Action_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_6Action_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Action_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_6Action_4__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_Action[] = {
  {(char *)"type", __pyx_getprop_7pyarrow_7_flight_6Action_type, 0, (char *)"The action type.", 0},
  {(char *)"body", __pyx_getprop_7pyarrow_7_flight_6Action_body, 0, (char *)"The action body (arguments for the action).", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_Action = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.Action", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_Action), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_Action, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Action(action_type, buf)\nAn action executable on a Flight service.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_Action, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_Action, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_6Action_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_Action, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_Result(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_Result *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_7pyarrow_7_flight_Result *)o);
  new((void*)&(p->result)) std::unique_ptr< arrow::flight::Result> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_Result(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_Result *p = (struct __pyx_obj_7pyarrow_7_flight_Result *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->result);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_6Result_body(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_6Result_4body_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_Result[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Result_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_6Result_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Result_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_6Result_4__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_Result[] = {
  {(char *)"body", __pyx_getprop_7pyarrow_7_flight_6Result_body, 0, (char *)"Get the Buffer containing the result.", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_Result = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.Result", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_Result), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_Result, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Result(buf)\nA result from executing an Action.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_Result, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_Result, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_6Result_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_Result, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_BasicAuth(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_BasicAuth *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_7pyarrow_7_flight_BasicAuth *)o);
  new((void*)&(p->basic_auth)) std::unique_ptr< arrow::flight::BasicAuth> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_BasicAuth(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_BasicAuth *p = (struct __pyx_obj_7pyarrow_7_flight_BasicAuth *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->basic_auth);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_9BasicAuth_username(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_9BasicAuth_8username_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_9BasicAuth_password(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_9BasicAuth_8password_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_BasicAuth[] = {
  {"deserialize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_9BasicAuth_3deserialize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_9BasicAuth_2deserialize},
  {"serialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_9BasicAuth_5serialize, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_9BasicAuth_4serialize},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_9BasicAuth_7__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_9BasicAuth_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_9BasicAuth_9__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_9BasicAuth_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_BasicAuth[] = {
  {(char *)"username", __pyx_getprop_7pyarrow_7_flight_9BasicAuth_username, 0, (char *)"Get the username.", 0},
  {(char *)"password", __pyx_getprop_7pyarrow_7_flight_9BasicAuth_password, 0, (char *)"Get the password.", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_BasicAuth = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.BasicAuth", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_BasicAuth), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_BasicAuth, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "BasicAuth(username=None, password=None)\nA container for basic auth.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_BasicAuth, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_BasicAuth, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_9BasicAuth_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_BasicAuth, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDescriptor __pyx_vtable_7pyarrow_7_flight_FlightDescriptor;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightDescriptor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *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_7pyarrow_7_flight_FlightDescriptor *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightDescriptor;
  new((void*)&(p->descriptor))  arrow::flight::FlightDescriptor();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightDescriptor(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *p = (struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->descriptor);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_richcompare_7pyarrow_7_flight_FlightDescriptor(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_13__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_13__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_descriptor_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15descriptor_type_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_command(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_7command_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_4path_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightDescriptor[] = {
  {"for_path", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_3for_path, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_2for_path},
  {"for_command", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_5for_command, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_4for_command},
  {"serialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_9serialize, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_8serialize},
  {"deserialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_11deserialize, METH_O, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_10deserialize},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_15__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_14__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDescriptor_17__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16FlightDescriptor_16__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightDescriptor[] = {
  {(char *)"descriptor_type", __pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_descriptor_type, 0, (char *)"Get the type of this descriptor.", 0},
  {(char *)"command", __pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_command, 0, (char *)"Get the command for this descriptor.", 0},
  {(char *)"path", __pyx_getprop_7pyarrow_7_flight_16FlightDescriptor_path, 0, (char *)"Get the path for this descriptor.", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightDescriptor = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightDescriptor", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightDescriptor, /*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_7pyarrow_7_flight_16FlightDescriptor_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightDescriptor()\nA description of a data stream available from a Flight service.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_7pyarrow_7_flight_FlightDescriptor, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightDescriptor, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightDescriptor, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_16FlightDescriptor_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightDescriptor, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_Ticket(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_Ticket *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_7pyarrow_7_flight_Ticket *)o);
  new((void*)&(p->ticket))  arrow::flight::Ticket();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_Ticket(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_Ticket *p = (struct __pyx_obj_7pyarrow_7_flight_Ticket *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->ticket);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_richcompare_7pyarrow_7_flight_Ticket(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_7pyarrow_7_flight_6Ticket_7__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_7pyarrow_7_flight_6Ticket_7__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_6Ticket_ticket(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_6Ticket_6ticket_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_Ticket[] = {
  {"serialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Ticket_3serialize, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_6Ticket_2serialize},
  {"deserialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Ticket_5deserialize, METH_O, __pyx_doc_7pyarrow_7_flight_6Ticket_4deserialize},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Ticket_11__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_6Ticket_10__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_6Ticket_13__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_6Ticket_12__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_Ticket[] = {
  {(char *)"ticket", __pyx_getprop_7pyarrow_7_flight_6Ticket_ticket, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_Ticket = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.Ticket", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_Ticket), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_Ticket, /*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_7pyarrow_7_flight_6Ticket_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Ticket(ticket)\nA ticket for requesting a Flight stream.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_7pyarrow_7_flight_Ticket, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_Ticket, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_Ticket, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_6Ticket_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_Ticket, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_Location __pyx_vtable_7pyarrow_7_flight_Location;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_Location(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_Location *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_7pyarrow_7_flight_Location *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_Location;
  new((void*)&(p->location))  arrow::flight::Location();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_Location(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_Location *p = (struct __pyx_obj_7pyarrow_7_flight_Location *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->location);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_richcompare_7pyarrow_7_flight_Location(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_7pyarrow_7_flight_8Location_7__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_7pyarrow_7_flight_8Location_7__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_8Location_uri(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_8Location_3uri_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_Location[] = {
  {"equals", (PyCFunction)__pyx_pw_7pyarrow_7_flight_8Location_5equals, METH_O, __pyx_doc_7pyarrow_7_flight_8Location_4equals},
  {"for_grpc_tcp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_9for_grpc_tcp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_8for_grpc_tcp},
  {"for_grpc_tls", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_11for_grpc_tls, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_10for_grpc_tls},
  {"for_grpc_unix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_8Location_13for_grpc_unix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_8Location_12for_grpc_unix},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_8Location_15__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_8Location_14__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_8Location_17__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_8Location_16__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_Location[] = {
  {(char *)"uri", __pyx_getprop_7pyarrow_7_flight_8Location_uri, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_Location = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.Location", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_Location), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_Location, /*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_7pyarrow_7_flight_8Location_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Location(uri)\nThe location of a Flight service.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_7pyarrow_7_flight_Location, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_Location, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_Location, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_8Location_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_Location, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightEndpoint(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *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_7pyarrow_7_flight_FlightEndpoint *)o);
  new((void*)&(p->endpoint))  arrow::flight::FlightEndpoint();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightEndpoint(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *p = (struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->endpoint);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_richcompare_7pyarrow_7_flight_FlightEndpoint(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_5__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_5__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_14FlightEndpoint_ticket(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_6ticket_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_14FlightEndpoint_locations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9locations_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightEndpoint[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_7__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_14FlightEndpoint_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_14FlightEndpoint_9__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_14FlightEndpoint_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightEndpoint[] = {
  {(char *)"ticket", __pyx_getprop_7pyarrow_7_flight_14FlightEndpoint_ticket, 0, (char *)"Get the ticket in this endpoint.", 0},
  {(char *)"locations", __pyx_getprop_7pyarrow_7_flight_14FlightEndpoint_locations, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightEndpoint = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightEndpoint", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightEndpoint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightEndpoint, /*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_7pyarrow_7_flight_14FlightEndpoint_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightEndpoint(ticket, locations)\nA Flight stream, along with the ticket and locations to access it.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_7pyarrow_7_flight_FlightEndpoint, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightEndpoint, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightEndpoint, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_14FlightEndpoint_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightEndpoint, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_SchemaResult(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_SchemaResult *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_7pyarrow_7_flight_SchemaResult *)o);
  new((void*)&(p->result)) std::unique_ptr< arrow::flight::SchemaResult> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_SchemaResult(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_SchemaResult *p = (struct __pyx_obj_7pyarrow_7_flight_SchemaResult *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->result);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_12SchemaResult_schema(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_12SchemaResult_6schema_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_SchemaResult[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_12SchemaResult_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_12SchemaResult_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_12SchemaResult_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_12SchemaResult_4__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_SchemaResult[] = {
  {(char *)"schema", __pyx_getprop_7pyarrow_7_flight_12SchemaResult_schema, 0, (char *)"The schema of the data in this flight.", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_SchemaResult = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.SchemaResult", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_SchemaResult), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_SchemaResult, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "SchemaResult(Schema schema)\nA result from a getschema request. Holding a schema", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_SchemaResult, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_SchemaResult, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_12SchemaResult_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_SchemaResult, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInfo *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_7pyarrow_7_flight_FlightInfo *)o);
  new((void*)&(p->info)) std::unique_ptr< arrow::flight::FlightInfo> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightInfo(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightInfo *p = (struct __pyx_obj_7pyarrow_7_flight_FlightInfo *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->info);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_10FlightInfo_total_records(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_10FlightInfo_13total_records_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_10FlightInfo_total_bytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_10FlightInfo_11total_bytes_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_10FlightInfo_schema(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_10FlightInfo_6schema_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_10FlightInfo_descriptor(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_10FlightInfo_10descriptor_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_10FlightInfo_endpoints(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_10FlightInfo_9endpoints_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightInfo[] = {
  {"serialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_10FlightInfo_3serialize, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_10FlightInfo_2serialize},
  {"deserialize", (PyCFunction)__pyx_pw_7pyarrow_7_flight_10FlightInfo_5deserialize, METH_O, __pyx_doc_7pyarrow_7_flight_10FlightInfo_4deserialize},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_10FlightInfo_7__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_10FlightInfo_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_10FlightInfo_9__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_10FlightInfo_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightInfo[] = {
  {(char *)"total_records", __pyx_getprop_7pyarrow_7_flight_10FlightInfo_total_records, 0, (char *)"The total record count of this flight, or -1 if unknown.", 0},
  {(char *)"total_bytes", __pyx_getprop_7pyarrow_7_flight_10FlightInfo_total_bytes, 0, (char *)"The size in bytes of the data in this flight, or -1 if unknown.", 0},
  {(char *)"schema", __pyx_getprop_7pyarrow_7_flight_10FlightInfo_schema, 0, (char *)"The schema of the data in this flight.", 0},
  {(char *)"descriptor", __pyx_getprop_7pyarrow_7_flight_10FlightInfo_descriptor, 0, (char *)"The descriptor of the data in this flight.", 0},
  {(char *)"endpoints", __pyx_getprop_7pyarrow_7_flight_10FlightInfo_endpoints, 0, (char *)"The endpoints where this flight is available.", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightInfo", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightInfo, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightInfo(Schema schema, FlightDescriptor descriptor, endpoints, total_records, total_bytes)\nA description of a Flight stream.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightInfo, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_10FlightInfo_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightInfo, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamChunk(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *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_7pyarrow_7_flight_FlightStreamChunk *)o);
  new((void*)&(p->chunk))  arrow::flight::FlightStreamChunk();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightStreamChunk(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *p = (struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->chunk);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_17FlightStreamChunk_data(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_4data_1__get__(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_17FlightStreamChunk_app_metadata(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_12app_metadata_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightStreamChunk[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17FlightStreamChunk_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17FlightStreamChunk_4__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightStreamChunk[] = {
  {(char *)"data", __pyx_getprop_7pyarrow_7_flight_17FlightStreamChunk_data, 0, (char *)0, 0},
  {(char *)"app_metadata", __pyx_getprop_7pyarrow_7_flight_17FlightStreamChunk_app_metadata, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightStreamChunk = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightStreamChunk", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightStreamChunk), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightStreamChunk, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A RecordBatch with application metadata on the side.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7pyarrow_7_flight_17FlightStreamChunk_1__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightStreamChunk, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightStreamChunk, /*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_7pyarrow_7_flight_FlightStreamChunk, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight__MetadataRecordBatchReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *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_7pyarrow_7_flight__MetadataRecordBatchReader *)o);
  new((void*)&(p->reader)) std::shared_ptr< arrow::flight::MetadataRecordBatchReader> ();
  p->__dict__ = PyDict_New(); if (unlikely(!p->__dict__)) goto bad;p->schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)Py_None); Py_INCREF(Py_None);
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight__MetadataRecordBatchReader(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *p = (struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)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);
  if (p->__dict__) PyDict_Clear(p->__dict__);
  __Pyx_call_destructor(p->reader);
  Py_CLEAR(p->__dict__);
  Py_CLEAR(p->schema);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight__MetadataRecordBatchReader(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *p = (struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)o;
  if (p->__dict__) {
    e = (*v)(p->__dict__, a); if (e) return e;
  }
  if (p->schema) {
    e = (*v)(((PyObject *)p->schema), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight__MetadataRecordBatchReader(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *p = (struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)o;
  tmp = ((PyObject*)p->__dict__);
  p->__dict__ = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->schema);
  p->schema = ((struct __pyx_obj_7pyarrow_3lib_Schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight__MetadataRecordBatchReader(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *p = (struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader *)o;
  if (unlikely(!p->__dict__)){
    p->__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__dict__);
  return p->__dict__;
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_26_MetadataRecordBatchReader_schema(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_6schema_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight__MetadataRecordBatchReader[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_26_MetadataRecordBatchReader___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_26_MetadataRecordBatchReader_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_26_MetadataRecordBatchReader_2__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight__MetadataRecordBatchReader[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight__MetadataRecordBatchReader, 0, (char *)0, 0},
  {(char *)"schema", __pyx_getprop_7pyarrow_7_flight_26_MetadataRecordBatchReader_schema, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight._MetadataRecordBatchReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight__MetadataRecordBatchReader, /*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*/
  "A reader for Flight streams.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight__MetadataRecordBatchReader, __dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight__MetadataRecordBatchReader, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_MetadataRecordBatchReader(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight__MetadataRecordBatchReader(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_MetadataRecordBatchReader(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *p = (struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader *)o;
  if (unlikely(!p->__pyx_base.__dict__)){
    p->__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__dict__);
  return p->__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_MetadataRecordBatchReader[] = {
  {"read_all", (PyCFunction)__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_4read_all, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_3read_all},
  {"read_chunk", (PyCFunction)__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_6read_chunk, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_5read_chunk},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_8__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_7__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_10__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_25MetadataRecordBatchReader_9__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_MetadataRecordBatchReader[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_MetadataRecordBatchReader, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.MetadataRecordBatchReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight__MetadataRecordBatchReader, /*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*/
  "A reader for Flight streams.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_1__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_MetadataRecordBatchReader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_MetadataRecordBatchReader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_MetadataRecordBatchReader, __pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_MetadataRecordBatchReader, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamReader(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_MetadataRecordBatchReader(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyObject *__pyx___dict__getter_7pyarrow_7_flight_FlightStreamReader(PyObject *o, CYTHON_UNUSED void *x) {
  struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *p = (struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader *)o;
  if (unlikely(!p->__pyx_base.__pyx_base.__dict__)){
    p->__pyx_base.__pyx_base.__dict__ = PyDict_New();
  }
  Py_XINCREF(p->__pyx_base.__pyx_base.__dict__);
  return p->__pyx_base.__pyx_base.__dict__;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightStreamReader[] = {
  {"cancel", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_1cancel, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_cancel},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamReader_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_18FlightStreamReader_4__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightStreamReader[] = {
  {(char *)"__dict__", __pyx___dict__getter_7pyarrow_7_flight_FlightStreamReader, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightStreamReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightStreamReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight__MetadataRecordBatchReader, /*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*/
  "A reader that can also be canceled.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight__MetadataRecordBatchReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_7pyarrow_7_flight_25MetadataRecordBatchReader_1__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightStreamReader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightStreamReader, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  offsetof(struct __pyx_obj_7pyarrow_7_flight_FlightStreamReader, __pyx_base.__pyx_base.__dict__), /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightStreamReader, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightStreamWriter(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_ptype_7pyarrow_3lib__CRecordBatchWriter->tp_new(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightStreamWriter(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  if (likely(__pyx_ptype_7pyarrow_3lib__CRecordBatchWriter)) __pyx_ptype_7pyarrow_3lib__CRecordBatchWriter->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_7pyarrow_7_flight_FlightStreamWriter);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightStreamWriter[] = {
  {"write_with_metadata", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_1write_with_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_write_with_metadata},
  {"done_writing", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_3done_writing, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_2done_writing},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_18FlightStreamWriter_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_18FlightStreamWriter_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightStreamWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightStreamWriter", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightStreamWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightStreamWriter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A RecordBatchWriter that also allows writing application metadata.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightStreamWriter, /*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_7pyarrow_7_flight_FlightStreamWriter, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightMetadataReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *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_7pyarrow_7_flight_FlightMetadataReader *)o);
  new((void*)&(p->reader)) std::unique_ptr< arrow::flight::FlightMetadataReader> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightMetadataReader(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *p = (struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->reader);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightMetadataReader[] = {
  {"read", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_1read, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_read},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataReader_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_20FlightMetadataReader_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightMetadataReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightMetadataReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightMetadataReader, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A reader for Flight metadata messages sent during a DoPut.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightMetadataReader, /*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_7pyarrow_7_flight_FlightMetadataReader, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightMetadataWriter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *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_7pyarrow_7_flight_FlightMetadataWriter *)o);
  new((void*)&(p->writer)) std::unique_ptr< arrow::flight::FlightMetadataWriter> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightMetadataWriter(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *p = (struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->writer);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightMetadataWriter[] = {
  {"write", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_1write, METH_O, __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_20FlightMetadataWriter_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_20FlightMetadataWriter_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightMetadataWriter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightMetadataWriter", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightMetadataWriter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightMetadataWriter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A sender for Flight metadata messages during a DoPut.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightMetadataWriter, /*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_7pyarrow_7_flight_FlightMetadataWriter, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightClient __pyx_vtable_7pyarrow_7_flight_FlightClient;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightClient(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightClient *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_7pyarrow_7_flight_FlightClient *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightClient;
  new((void*)&(p->client)) std::unique_ptr< arrow::flight::FlightClient> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightClient(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightClient *p = (struct __pyx_obj_7pyarrow_7_flight_FlightClient *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->client);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightClient[] = {
  {"wait_for_available", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_3wait_for_available, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_2wait_for_available},
  {"connect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_5connect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_4connect},
  {"authenticate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_7authenticate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_6authenticate},
  {"list_actions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_9list_actions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_8list_actions},
  {"do_action", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_11do_action, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_10do_action},
  {"list_flights", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_14list_flights, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_13list_flights},
  {"get_flight_info", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_17get_flight_info, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_16get_flight_info},
  {"get_schema", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_19get_schema, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_18get_schema},
  {"do_get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_21do_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_20do_get},
  {"do_put", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_12FlightClient_23do_put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_12FlightClient_22do_put},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_12FlightClient_25__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_12FlightClient_24__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_12FlightClient_27__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_12FlightClient_26__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightClient = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightClient", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightClient), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightClient, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightClient(location, tls_root_certs=None, override_hostname=None, middleware=None)\nA client to a Flight service.\n\n    Connect to a Flight service on the given host and port.\n\n    Parameters\n    ----------\n    location : str, tuple or Location\n        Location to connect to. Either a gRPC URI like `grpc://localhost:port`,\n        a tuple of (host, port) pair, or a Location instance.\n    tls_root_certs : bytes or None\n        PEM-encoded\n    override_hostname : str or None\n        Override the hostname checked by TLS. Insecure, use with caution.\n    middleware : list optional, default None\n        A list of ClientMiddlewareFactory instances.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightClient, /*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_7pyarrow_7_flight_12FlightClient_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightClient, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream __pyx_vtable_7pyarrow_7_flight_FlightDataStream;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightDataStream(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *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_7pyarrow_7_flight_FlightDataStream *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightDataStream;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightDataStream(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightDataStream[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDataStream_1__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightDataStream___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightDataStream_3__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16FlightDataStream_2__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightDataStream = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightDataStream", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightDataStream, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Abstract base class for Flight data streams.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightDataStream, /*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_7pyarrow_7_flight_FlightDataStream, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_RecordBatchStream __pyx_vtable_7pyarrow_7_flight_RecordBatchStream;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_RecordBatchStream(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightDataStream(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream*)__pyx_vtabptr_7pyarrow_7_flight_RecordBatchStream;
  p->data_source = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_RecordBatchStream(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *p = (struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)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->data_source);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightDataStream(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight_RecordBatchStream(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *p = (struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)o;
  e = ((likely(__pyx_ptype_7pyarrow_7_flight_FlightDataStream)) ? ((__pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_traverse) ? __pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_7pyarrow_7_flight_RecordBatchStream)); if (e) return e;
  if (p->data_source) {
    e = (*v)(p->data_source, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight_RecordBatchStream(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *p = (struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream *)o;
  if (likely(__pyx_ptype_7pyarrow_7_flight_FlightDataStream)) { if (__pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_clear) __pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_7pyarrow_7_flight_RecordBatchStream);
  tmp = ((PyObject*)p->data_source);
  p->data_source = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_RecordBatchStream[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17RecordBatchStream_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17RecordBatchStream_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17RecordBatchStream_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_RecordBatchStream = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.RecordBatchStream", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_RecordBatchStream), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_RecordBatchStream, /*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*/
  "RecordBatchStream(data_source)\nA Flight data stream backed by RecordBatches.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight_RecordBatchStream, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_RecordBatchStream, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_RecordBatchStream, /*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_7pyarrow_7_flight_17RecordBatchStream_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_RecordBatchStream, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_GeneratorStream __pyx_vtable_7pyarrow_7_flight_GeneratorStream;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_GeneratorStream(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_FlightDataStream(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_FlightDataStream*)__pyx_vtabptr_7pyarrow_7_flight_GeneratorStream;
  new((void*)&(p->schema)) std::shared_ptr< arrow::Schema> ();
  new((void*)&(p->current_stream)) std::unique_ptr< arrow::flight::FlightDataStream> ();
  p->generator = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_GeneratorStream(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *p = (struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)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);
  __Pyx_call_destructor(p->schema);
  __Pyx_call_destructor(p->current_stream);
  Py_CLEAR(p->generator);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightDataStream(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight_GeneratorStream(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *p = (struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)o;
  e = ((likely(__pyx_ptype_7pyarrow_7_flight_FlightDataStream)) ? ((__pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_traverse) ? __pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_7pyarrow_7_flight_GeneratorStream)); if (e) return e;
  if (p->generator) {
    e = (*v)(p->generator, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight_GeneratorStream(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *p = (struct __pyx_obj_7pyarrow_7_flight_GeneratorStream *)o;
  if (likely(__pyx_ptype_7pyarrow_7_flight_FlightDataStream)) { if (__pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_clear) __pyx_ptype_7pyarrow_7_flight_FlightDataStream->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_7pyarrow_7_flight_GeneratorStream);
  tmp = ((PyObject*)p->generator);
  p->generator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_GeneratorStream[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_15GeneratorStream_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_15GeneratorStream_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_15GeneratorStream_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_15GeneratorStream_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_GeneratorStream = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.GeneratorStream", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_GeneratorStream), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_GeneratorStream, /*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*/
  "GeneratorStream(schema, generator)\nA Flight data stream backed by a Python generator.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight_GeneratorStream, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight_GeneratorStream, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_GeneratorStream, /*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_7pyarrow_7_flight_15GeneratorStream_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_GeneratorStream, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerCallContext __pyx_vtable_7pyarrow_7_flight_ServerCallContext;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerCallContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *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_7pyarrow_7_flight_ServerCallContext *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ServerCallContext;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerCallContext(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerCallContext[] = {
  {"peer_identity", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerCallContext_1peer_identity, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17ServerCallContext_peer_identity},
  {"get_middleware", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerCallContext_3get_middleware, METH_O, __pyx_doc_7pyarrow_7_flight_17ServerCallContext_2get_middleware},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerCallContext_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17ServerCallContext_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerCallContext_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17ServerCallContext_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerCallContext = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerCallContext", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerCallContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerCallContext, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Per-call state/context.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerCallContext, /*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_7pyarrow_7_flight_ServerCallContext, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthReader __pyx_vtable_7pyarrow_7_flight_ServerAuthReader;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *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_7pyarrow_7_flight_ServerAuthReader *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ServerAuthReader;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthReader(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerAuthReader[] = {
  {"read", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_1read, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_read},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthReader_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ServerAuthReader_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerAuthReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerAuthReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthReader, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A reader for messages from the client during an auth handshake.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerAuthReader, /*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_7pyarrow_7_flight_ServerAuthReader, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthSender __pyx_vtable_7pyarrow_7_flight_ServerAuthSender;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthSender(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *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_7pyarrow_7_flight_ServerAuthSender *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ServerAuthSender;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthSender(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerAuthSender[] = {
  {"write", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_1write, METH_O, __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerAuthSender_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ServerAuthSender_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerAuthSender = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerAuthSender", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthSender, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A writer for messages to the client during an auth handshake.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerAuthSender, /*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_7pyarrow_7_flight_ServerAuthSender, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthReader __pyx_vtable_7pyarrow_7_flight_ClientAuthReader;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthReader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *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_7pyarrow_7_flight_ClientAuthReader *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ClientAuthReader;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthReader(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ClientAuthReader[] = {
  {"read", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_1read, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_read},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthReader_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientAuthReader_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ClientAuthReader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ClientAuthReader", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthReader, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A reader for messages from the server during an auth handshake.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ClientAuthReader, /*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_7pyarrow_7_flight_ClientAuthReader, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthSender __pyx_vtable_7pyarrow_7_flight_ClientAuthSender;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthSender(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *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_7pyarrow_7_flight_ClientAuthSender *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ClientAuthSender;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthSender(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ClientAuthSender[] = {
  {"write", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_1write, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_write},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientAuthSender_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientAuthSender_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ClientAuthSender = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ClientAuthSender", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthSender, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A writer for messages to the server during an auth handshake.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ClientAuthSender, /*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_7pyarrow_7_flight_ClientAuthSender, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerAuthHandler __pyx_vtable_7pyarrow_7_flight_ServerAuthHandler;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerAuthHandler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *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_7pyarrow_7_flight_ServerAuthHandler *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ServerAuthHandler;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthHandler(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerAuthHandler[] = {
  {"authenticate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_1authenticate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_authenticate},
  {"is_valid", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_3is_valid, METH_O, __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_2is_valid},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ServerAuthHandler_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17ServerAuthHandler_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerAuthHandler = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerAuthHandler", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerAuthHandler, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Authentication middleware for a server.\n\n    To implement an authentication mechanism, subclass this class and\n    override its methods.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerAuthHandler, /*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_7pyarrow_7_flight_ServerAuthHandler, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientAuthHandler __pyx_vtable_7pyarrow_7_flight_ClientAuthHandler;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientAuthHandler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *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_7pyarrow_7_flight_ClientAuthHandler *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ClientAuthHandler;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthHandler(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ClientAuthHandler[] = {
  {"authenticate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_1authenticate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_authenticate},
  {"get_token", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_3get_token, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_2get_token},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_17ClientAuthHandler_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_17ClientAuthHandler_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ClientAuthHandler = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ClientAuthHandler", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ClientAuthHandler, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Authentication plugin for a client.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ClientAuthHandler, /*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_7pyarrow_7_flight_ClientAuthHandler, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientMiddlewareFactory(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ClientMiddlewareFactory(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ClientMiddlewareFactory[] = {
  {"start_call", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_1start_call, METH_O, __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_start_call},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23ClientMiddlewareFactory_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_23ClientMiddlewareFactory_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ClientMiddlewareFactory", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ClientMiddlewareFactory), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ClientMiddlewareFactory, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A factory for new middleware instances.\n\n    All middleware methods will be called from the same thread as the\n    RPC method implementation. That is, thread-locals set in the\n    client are accessible from the middleware itself.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ClientMiddlewareFactory, /*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_7pyarrow_7_flight_ClientMiddlewareFactory, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ClientMiddleware __pyx_vtable_7pyarrow_7_flight_ClientMiddleware;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ClientMiddleware(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware *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_7pyarrow_7_flight_ClientMiddleware *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ClientMiddleware;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ClientMiddleware(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ClientMiddleware[] = {
  {"sending_headers", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_1sending_headers, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_sending_headers},
  {"received_headers", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_3received_headers, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_2received_headers},
  {"call_completed", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_5call_completed, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_4call_completed},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_7__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ClientMiddleware_9__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ClientMiddleware_8__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ClientMiddleware = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ClientMiddleware", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ClientMiddleware), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ClientMiddleware, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Client-side middleware for a call, instantiated per RPC.\n\n    Methods here should be fast and must be infallible: they should\n    not raise exceptions or stall indefinitely.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ClientMiddleware, /*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_7pyarrow_7_flight_ClientMiddleware, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerMiddlewareFactory(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddlewareFactory(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerMiddlewareFactory[] = {
  {"start_call", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_1start_call, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_start_call},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_3__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_23ServerMiddlewareFactory_5__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_23ServerMiddlewareFactory_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerMiddlewareFactory", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerMiddlewareFactory), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddlewareFactory, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "A factory for new middleware instances.\n\n    All middleware methods will be called from the same thread as the\n    RPC method implementation. That is, thread-locals set in the\n    middleware are accessible from the method itself.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerMiddlewareFactory, /*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_7pyarrow_7_flight_ServerMiddlewareFactory, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware __pyx_vtable_7pyarrow_7_flight_ServerMiddleware;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_ServerMiddleware(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware *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_7pyarrow_7_flight_ServerMiddleware *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_ServerMiddleware;
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddleware(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_ServerMiddleware[] = {
  {"sending_headers", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_1sending_headers, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_sending_headers},
  {"call_completed", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_3call_completed, METH_O, __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_2call_completed},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16ServerMiddleware_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16ServerMiddleware_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_ServerMiddleware = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.ServerMiddleware", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_ServerMiddleware), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddleware, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Server-side middleware for a call, instantiated per RPC.\n\n    Methods here should be fast and must be infalliable: they should\n    not raise exceptions or stall indefinitely.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_ServerMiddleware, /*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_7pyarrow_7_flight_ServerMiddleware, /*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
};

static PyObject *__pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_ServerMiddlewareFactory(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)o);
  p->factories = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)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->factories);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddlewareFactory(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)o;
  e = ((likely(__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory)) ? ((__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory->tp_traverse) ? __pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper)); if (e) return e;
  if (p->factories) {
    e = (*v)(p->factories, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper *)o;
  if (likely(__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory)) { if (__pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory->tp_clear) __pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper);
  tmp = ((PyObject*)p->factories);
  p->factories = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper[] = {
  {"start_call", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_3start_call, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_2start_call},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_5__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_7__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_6__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight._ServerMiddlewareFactoryWrapper", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper, /*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*/
  "_ServerMiddlewareFactoryWrapper(dict factories)\nWrapper to bundle server middleware into a single C++ one.", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper, /*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_7pyarrow_7_flight_31_ServerMiddlewareFactoryWrapper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight__ServerMiddlewareWrapper __pyx_vtable_7pyarrow_7_flight__ServerMiddlewareWrapper;

static PyObject *__pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareWrapper(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *p;
  PyObject *o = __pyx_tp_new_7pyarrow_7_flight_ServerMiddleware(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7pyarrow_7_flight_ServerMiddleware*)__pyx_vtabptr_7pyarrow_7_flight__ServerMiddlewareWrapper;
  p->middleware = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight__ServerMiddlewareWrapper(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)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->middleware);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_7pyarrow_7_flight_ServerMiddleware(o);
}

static int __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareWrapper(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)o;
  e = ((likely(__pyx_ptype_7pyarrow_7_flight_ServerMiddleware)) ? ((__pyx_ptype_7pyarrow_7_flight_ServerMiddleware->tp_traverse) ? __pyx_ptype_7pyarrow_7_flight_ServerMiddleware->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareWrapper)); if (e) return e;
  if (p->middleware) {
    e = (*v)(p->middleware, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareWrapper(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *p = (struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper *)o;
  if (likely(__pyx_ptype_7pyarrow_7_flight_ServerMiddleware)) { if (__pyx_ptype_7pyarrow_7_flight_ServerMiddleware->tp_clear) __pyx_ptype_7pyarrow_7_flight_ServerMiddleware->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareWrapper);
  tmp = ((PyObject*)p->middleware);
  p->middleware = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight__ServerMiddlewareWrapper[] = {
  {"sending_headers", (PyCFunction)__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_3sending_headers, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_2sending_headers},
  {"call_completed", (PyCFunction)__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_5call_completed, METH_O, __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_4call_completed},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_7__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_24_ServerMiddlewareWrapper_9__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_24_ServerMiddlewareWrapper_8__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight._ServerMiddlewareWrapper", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight__ServerMiddlewareWrapper), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight__ServerMiddlewareWrapper, /*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*/
  "_ServerMiddlewareWrapper(dict middleware)", /*tp_doc*/
  __pyx_tp_traverse_7pyarrow_7_flight__ServerMiddlewareWrapper, /*tp_traverse*/
  __pyx_tp_clear_7pyarrow_7_flight__ServerMiddlewareWrapper, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight__ServerMiddlewareWrapper, /*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_7pyarrow_7_flight_24_ServerMiddlewareWrapper_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight__ServerMiddlewareWrapper, /*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
};
static struct __pyx_vtabstruct_7pyarrow_7_flight_FlightServerBase __pyx_vtable_7pyarrow_7_flight_FlightServerBase;

static PyObject *__pyx_tp_new_7pyarrow_7_flight_FlightServerBase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *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_7pyarrow_7_flight_FlightServerBase *)o);
  p->__pyx_vtab = __pyx_vtabptr_7pyarrow_7_flight_FlightServerBase;
  new((void*)&(p->server)) std::unique_ptr<arrow::py::flight::PyFlightServer> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight_FlightServerBase(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *p = (struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  __Pyx_call_destructor(p->server);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7pyarrow_7_flight_16FlightServerBase_port(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_7pyarrow_7_flight_16FlightServerBase_4port_1__get__(o);
}

static PyMethodDef __pyx_methods_7pyarrow_7_flight_FlightServerBase[] = {
  {"list_flights", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_3list_flights, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_2list_flights},
  {"get_flight_info", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_5get_flight_info, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_4get_flight_info},
  {"get_schema", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_7get_schema, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_6get_schema},
  {"do_put", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_9do_put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_8do_put},
  {"do_get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_11do_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_10do_get},
  {"list_actions", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_13list_actions, METH_O, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_12list_actions},
  {"do_action", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_15do_action, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_14do_action},
  {"serve", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_17serve, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_16serve},
  {"run", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_19run, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_18run},
  {"shutdown", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_21shutdown, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_20shutdown},
  {"wait", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_23wait, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_22wait},
  {"__enter__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_25__enter__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_24__enter__},
  {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_27__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_26__exit__},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_29__reduce_cython__, METH_NOARGS, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_28__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7pyarrow_7_flight_16FlightServerBase_31__setstate_cython__, METH_O, __pyx_doc_7pyarrow_7_flight_16FlightServerBase_30__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7pyarrow_7_flight_FlightServerBase[] = {
  {(char *)"port", __pyx_getprop_7pyarrow_7_flight_16FlightServerBase_port, 0, (char *)"\n        Get the port that this server is listening on.\n\n        Returns a non-positive value if the operation is invalid\n        (e.g. init() was not called or server is listening on a domain\n        socket).\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7pyarrow_7_flight_FlightServerBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.FlightServerBase", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight_FlightServerBase, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "FlightServerBase(location=None, auth_handler=None, tls_certificates=None, middleware=None)\nA Flight service definition.\n\n    Override methods to define your Flight service.\n\n    Parameters\n    ----------\n    location : str, tuple or Location optional, default None\n        Location to serve on. Either a gRPC URI like `grpc://localhost:port`,\n        a tuple of (host, port) pair, or a Location instance.\n        If None is passed then the server will be started on localhost with a\n        system provided random port.\n    auth_handler : ServerAuthHandler optional, default None\n        An authentication mechanism to use. May be None.\n    tls_certificates : list optional, default None\n        A list of (certificate, key) pairs.\n    middleware : list optional, default None\n        A dictionary of :class:`ServerMiddlewareFactory` items. The\n        keys are used to retrieve the middleware instance during calls\n        (see :meth:`ServerCallContext.get_middleware`).\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7pyarrow_7_flight_FlightServerBase, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7pyarrow_7_flight_FlightServerBase, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_7pyarrow_7_flight_16FlightServerBase_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7pyarrow_7_flight_FlightServerBase, /*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
};

static struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct____iter__[8];
static int __pyx_freecount_7pyarrow_7_flight___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct____iter__[--__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__));
    (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_7pyarrow_7_flight___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__)))) {
    __pyx_freelist_7pyarrow_7_flight___pyx_scope_struct____iter__[__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct____iter__++] = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7pyarrow_7_flight___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight___pyx_scope_struct____iter__, /*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_7pyarrow_7_flight___pyx_scope_struct____iter__, /*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_7pyarrow_7_flight___pyx_scope_struct____iter__, /*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
};

static struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_1_do_action[8];
static int __pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_1_do_action = 0;

static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_1_do_action(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_1_do_action > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action)))) {
    o = (PyObject*)__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_1_do_action[--__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_1_do_action];
    memset(o, 0, sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)o);
  new((void*)&(p->__pyx_v_c_action))  arrow::flight::Action();
  new((void*)&(p->__pyx_v_results)) std::unique_ptr< arrow::flight::ResultStream> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight___pyx_scope_struct_1_do_action(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_c_action);
  __Pyx_call_destructor(p->__pyx_v_results);
  Py_CLEAR(p->__pyx_v_action);
  Py_CLEAR(p->__pyx_v_options);
  Py_CLEAR(p->__pyx_v_result);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_1_do_action < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action)))) {
    __pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_1_do_action[__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_1_do_action++] = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7pyarrow_7_flight___pyx_scope_struct_1_do_action(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action *)o;
  if (p->__pyx_v_action) {
    e = (*v)(p->__pyx_v_action, a); if (e) return e;
  }
  if (p->__pyx_v_options) {
    e = (*v)(((PyObject *)p->__pyx_v_options), a); if (e) return e;
  }
  if (p->__pyx_v_result) {
    e = (*v)(((PyObject *)p->__pyx_v_result), 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 PyTypeObject __pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.__pyx_scope_struct_1_do_action", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_1_do_action), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight___pyx_scope_struct_1_do_action, /*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_7pyarrow_7_flight___pyx_scope_struct_1_do_action, /*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_7pyarrow_7_flight___pyx_scope_struct_1_do_action, /*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
};

static struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_2_list_flights[8];
static int __pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_2_list_flights = 0;

static PyObject *__pyx_tp_new_7pyarrow_7_flight___pyx_scope_struct_2_list_flights(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_2_list_flights > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights)))) {
    o = (PyObject*)__pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_2_list_flights[--__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_2_list_flights];
    memset(o, 0, sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)o);
  new((void*)&(p->__pyx_v_c_criteria))  arrow::flight::Criteria();
  new((void*)&(p->__pyx_v_listing)) std::unique_ptr< arrow::flight::FlightListing> ();
  return o;
}

static void __pyx_tp_dealloc_7pyarrow_7_flight___pyx_scope_struct_2_list_flights(PyObject *o) {
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->__pyx_v_c_criteria);
  __Pyx_call_destructor(p->__pyx_v_listing);
  Py_CLEAR(p->__pyx_v_options);
  Py_CLEAR(p->__pyx_v_result);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_2_list_flights < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights)))) {
    __pyx_freelist_7pyarrow_7_flight___pyx_scope_struct_2_list_flights[__pyx_freecount_7pyarrow_7_flight___pyx_scope_struct_2_list_flights++] = ((struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7pyarrow_7_flight___pyx_scope_struct_2_list_flights(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *p = (struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights *)o;
  if (p->__pyx_v_options) {
    e = (*v)(((PyObject *)p->__pyx_v_options), a); if (e) return e;
  }
  if (p->__pyx_v_result) {
    e = (*v)(((PyObject *)p->__pyx_v_result), 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 PyTypeObject __pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyarrow._flight.__pyx_scope_struct_2_list_flights", /*tp_name*/
  sizeof(struct __pyx_obj_7pyarrow_7_flight___pyx_scope_struct_2_list_flights), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7pyarrow_7_flight___pyx_scope_struct_2_list_flights, /*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_7pyarrow_7_flight___pyx_scope_struct_2_list_flights, /*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_7pyarrow_7_flight___pyx_scope_struct_2_list_flights, /*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
};

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__flight(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__flight},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_flight",
    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_kp_s_A_TLS_certificate_and_key_for_us, __pyx_k_A_TLS_certificate_and_key_for_us, sizeof(__pyx_k_A_TLS_certificate_and_key_for_us), 0, 0, 1, 0},
  {&__pyx_kp_s_A_type_of_action_that_is_executa, __pyx_k_A_type_of_action_that_is_executa, sizeof(__pyx_k_A_type_of_action_that_is_executa), 0, 0, 1, 0},
  {&__pyx_n_s_Action, __pyx_k_Action, sizeof(__pyx_k_Action), 0, 0, 1, 1},
  {&__pyx_n_s_ActionType, __pyx_k_ActionType, sizeof(__pyx_k_ActionType), 0, 0, 1, 1},
  {&__pyx_n_s_ActionType_2, __pyx_k_ActionType_2, sizeof(__pyx_k_ActionType_2), 0, 0, 1, 1},
  {&__pyx_n_u_ActionType_2, __pyx_k_ActionType_2, sizeof(__pyx_k_ActionType_2), 0, 1, 0, 1},
  {&__pyx_n_s_ActionType_make_action, __pyx_k_ActionType_make_action, sizeof(__pyx_k_ActionType_make_action), 0, 0, 1, 1},
  {&__pyx_kp_u_Action_must_be_Action_instance_s, __pyx_k_Action_must_be_Action_instance_s, sizeof(__pyx_k_Action_must_be_Action_instance_s), 0, 1, 0, 0},
  {&__pyx_n_s_ArrowException, __pyx_k_ArrowException, sizeof(__pyx_k_ArrowException), 0, 0, 1, 1},
  {&__pyx_n_s_BasicAuth, __pyx_k_BasicAuth, sizeof(__pyx_k_BasicAuth), 0, 0, 1, 1},
  {&__pyx_n_s_CMD, __pyx_k_CMD, sizeof(__pyx_k_CMD), 0, 0, 1, 1},
  {&__pyx_n_s_CallInfo, __pyx_k_CallInfo, sizeof(__pyx_k_CallInfo), 0, 0, 1, 1},
  {&__pyx_n_s_CallInfo_2, __pyx_k_CallInfo_2, sizeof(__pyx_k_CallInfo_2), 0, 0, 1, 1},
  {&__pyx_n_u_CallInfo_2, __pyx_k_CallInfo_2, sizeof(__pyx_k_CallInfo_2), 0, 1, 0, 1},
  {&__pyx_kp_u_Can_only_return_metadata_alongsi, __pyx_k_Can_only_return_metadata_alongsi, sizeof(__pyx_k_Can_only_return_metadata_alongsi), 0, 1, 0, 0},
  {&__pyx_kp_u_Can_t_construct_RecordBatchStrea, __pyx_k_Can_t_construct_RecordBatchStrea, sizeof(__pyx_k_Can_t_construct_RecordBatchStrea), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_use_ClientAuthReader_outs, __pyx_k_Cannot_use_ClientAuthReader_outs, sizeof(__pyx_k_Cannot_use_ClientAuthReader_outs), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_use_ClientAuthSender_outs, __pyx_k_Cannot_use_ClientAuthSender_outs, sizeof(__pyx_k_Cannot_use_ClientAuthSender_outs), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_use_ServerAuthReader_outs, __pyx_k_Cannot_use_ServerAuthReader_outs, sizeof(__pyx_k_Cannot_use_ServerAuthReader_outs), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_use_ServerAuthSender_outs, __pyx_k_Cannot_use_ServerAuthSender_outs, sizeof(__pyx_k_Cannot_use_ServerAuthSender_outs), 0, 1, 0, 0},
  {&__pyx_n_s_CertKeyPair, __pyx_k_CertKeyPair, sizeof(__pyx_k_CertKeyPair), 0, 0, 1, 1},
  {&__pyx_n_u_CertKeyPair, __pyx_k_CertKeyPair, sizeof(__pyx_k_CertKeyPair), 0, 1, 0, 1},
  {&__pyx_n_s_CertKeyPair_2, __pyx_k_CertKeyPair_2, sizeof(__pyx_k_CertKeyPair_2), 0, 0, 1, 1},
  {&__pyx_n_s_ClientAuthHandler, __pyx_k_ClientAuthHandler, sizeof(__pyx_k_ClientAuthHandler), 0, 0, 1, 1},
  {&__pyx_n_s_ClientAuthReader, __pyx_k_ClientAuthReader, sizeof(__pyx_k_ClientAuthReader), 0, 0, 1, 1},
  {&__pyx_n_s_ClientAuthSender, __pyx_k_ClientAuthSender, sizeof(__pyx_k_ClientAuthSender), 0, 0, 1, 1},
  {&__pyx_n_s_ClientMiddleware, __pyx_k_ClientMiddleware, sizeof(__pyx_k_ClientMiddleware), 0, 0, 1, 1},
  {&__pyx_n_s_ClientMiddlewareFactory, __pyx_k_ClientMiddlewareFactory, sizeof(__pyx_k_ClientMiddlewareFactory), 0, 0, 1, 1},
  {&__pyx_n_s_DOTALL, __pyx_k_DOTALL, sizeof(__pyx_k_DOTALL), 0, 0, 1, 1},
  {&__pyx_n_s_DO_ACTION, __pyx_k_DO_ACTION, sizeof(__pyx_k_DO_ACTION), 0, 0, 1, 1},
  {&__pyx_n_s_DO_GET, __pyx_k_DO_GET, sizeof(__pyx_k_DO_GET), 0, 0, 1, 1},
  {&__pyx_n_s_DO_PUT, __pyx_k_DO_PUT, sizeof(__pyx_k_DO_PUT), 0, 0, 1, 1},
  {&__pyx_n_s_DescriptorType, __pyx_k_DescriptorType, sizeof(__pyx_k_DescriptorType), 0, 0, 1, 1},
  {&__pyx_kp_u_Do_not_call_s_constructor_direct, __pyx_k_Do_not_call_s_constructor_direct, sizeof(__pyx_k_Do_not_call_s_constructor_direct), 0, 1, 0, 0},
  {&__pyx_kp_u_Endpoint_is_not_instance_of_Flig, __pyx_k_Endpoint_is_not_instance_of_Flig, sizeof(__pyx_k_Endpoint_is_not_instance_of_Flig), 0, 1, 0, 0},
  {&__pyx_n_s_Enum, __pyx_k_Enum, sizeof(__pyx_k_Enum), 0, 0, 1, 1},
  {&__pyx_kp_u_Expected_RecordBatchReader_or_Ta, __pyx_k_Expected_RecordBatchReader_or_Ta, sizeof(__pyx_k_Expected_RecordBatchReader_or_Ta), 0, 1, 0, 0},
  {&__pyx_kp_u_Expected_a_FlightCallOptions_obj, __pyx_k_Expected_a_FlightCallOptions_obj, sizeof(__pyx_k_Expected_a_FlightCallOptions_obj), 0, 1, 0, 0},
  {&__pyx_n_s_FLIGHT_SERVER_ERROR_REGEX, __pyx_k_FLIGHT_SERVER_ERROR_REGEX, sizeof(__pyx_k_FLIGHT_SERVER_ERROR_REGEX), 0, 0, 1, 1},
  {&__pyx_n_s_FlightCallOptions, __pyx_k_FlightCallOptions, sizeof(__pyx_k_FlightCallOptions), 0, 0, 1, 1},
  {&__pyx_n_s_FlightCancelledError, __pyx_k_FlightCancelledError, sizeof(__pyx_k_FlightCancelledError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightClient, __pyx_k_FlightClient, sizeof(__pyx_k_FlightClient), 0, 0, 1, 1},
  {&__pyx_kp_u_FlightClient_authenticate_takes, __pyx_k_FlightClient_authenticate_takes, sizeof(__pyx_k_FlightClient_authenticate_takes), 0, 1, 0, 0},
  {&__pyx_n_s_FlightClient_do_action, __pyx_k_FlightClient_do_action, sizeof(__pyx_k_FlightClient_do_action), 0, 0, 1, 1},
  {&__pyx_n_s_FlightClient_list_flights, __pyx_k_FlightClient_list_flights, sizeof(__pyx_k_FlightClient_list_flights), 0, 0, 1, 1},
  {&__pyx_n_s_FlightDataStream, __pyx_k_FlightDataStream, sizeof(__pyx_k_FlightDataStream), 0, 0, 1, 1},
  {&__pyx_n_s_FlightDescriptor, __pyx_k_FlightDescriptor, sizeof(__pyx_k_FlightDescriptor), 0, 0, 1, 1},
  {&__pyx_kp_u_FlightDescriptor_command_r, __pyx_k_FlightDescriptor_command_r, sizeof(__pyx_k_FlightDescriptor_command_r), 0, 1, 0, 0},
  {&__pyx_kp_u_FlightDescriptor_path_r, __pyx_k_FlightDescriptor_path_r, sizeof(__pyx_k_FlightDescriptor_path_r), 0, 1, 0, 0},
  {&__pyx_kp_u_FlightDescriptor_type_r, __pyx_k_FlightDescriptor_type_r, sizeof(__pyx_k_FlightDescriptor_type_r), 0, 1, 0, 0},
  {&__pyx_n_s_FlightEndpoint, __pyx_k_FlightEndpoint, sizeof(__pyx_k_FlightEndpoint), 0, 0, 1, 1},
  {&__pyx_kp_u_FlightEndpoint_ticket_r_locatio, __pyx_k_FlightEndpoint_ticket_r_locatio, sizeof(__pyx_k_FlightEndpoint_ticket_r_locatio), 0, 1, 0, 0},
  {&__pyx_n_s_FlightError, __pyx_k_FlightError, sizeof(__pyx_k_FlightError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightInfo, __pyx_k_FlightInfo, sizeof(__pyx_k_FlightInfo), 0, 0, 1, 1},
  {&__pyx_n_s_FlightInternalError, __pyx_k_FlightInternalError, sizeof(__pyx_k_FlightInternalError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightMetadataReader, __pyx_k_FlightMetadataReader, sizeof(__pyx_k_FlightMetadataReader), 0, 0, 1, 1},
  {&__pyx_n_s_FlightMetadataWriter, __pyx_k_FlightMetadataWriter, sizeof(__pyx_k_FlightMetadataWriter), 0, 0, 1, 1},
  {&__pyx_n_s_FlightMethod, __pyx_k_FlightMethod, sizeof(__pyx_k_FlightMethod), 0, 0, 1, 1},
  {&__pyx_n_s_FlightServerBase, __pyx_k_FlightServerBase, sizeof(__pyx_k_FlightServerBase), 0, 0, 1, 1},
  {&__pyx_kp_u_FlightServerBase_do_get_must_ret, __pyx_k_FlightServerBase_do_get_must_ret, sizeof(__pyx_k_FlightServerBase_do_get_must_ret), 0, 1, 0, 0},
  {&__pyx_kp_u_FlightServerBase_get_flight_info, __pyx_k_FlightServerBase_get_flight_info, sizeof(__pyx_k_FlightServerBase_get_flight_info), 0, 1, 0, 0},
  {&__pyx_kp_u_FlightServerBase_get_schema_info, __pyx_k_FlightServerBase_get_schema_info, sizeof(__pyx_k_FlightServerBase_get_schema_info), 0, 1, 0, 0},
  {&__pyx_kp_u_FlightServerBase_list_flights_mu, __pyx_k_FlightServerBase_list_flights_mu, sizeof(__pyx_k_FlightServerBase_list_flights_mu), 0, 1, 0, 0},
  {&__pyx_n_s_FlightServerError, __pyx_k_FlightServerError, sizeof(__pyx_k_FlightServerError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightStreamChunk, __pyx_k_FlightStreamChunk, sizeof(__pyx_k_FlightStreamChunk), 0, 0, 1, 1},
  {&__pyx_n_s_FlightStreamReader, __pyx_k_FlightStreamReader, sizeof(__pyx_k_FlightStreamReader), 0, 0, 1, 1},
  {&__pyx_n_s_FlightStreamWriter, __pyx_k_FlightStreamWriter, sizeof(__pyx_k_FlightStreamWriter), 0, 0, 1, 1},
  {&__pyx_n_s_FlightTimedOutError, __pyx_k_FlightTimedOutError, sizeof(__pyx_k_FlightTimedOutError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightUnauthenticatedError, __pyx_k_FlightUnauthenticatedError, sizeof(__pyx_k_FlightUnauthenticatedError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightUnauthorizedError, __pyx_k_FlightUnauthorizedError, sizeof(__pyx_k_FlightUnauthorizedError), 0, 0, 1, 1},
  {&__pyx_n_s_FlightUnavailableError, __pyx_k_FlightUnavailableError, sizeof(__pyx_k_FlightUnavailableError), 0, 0, 1, 1},
  {&__pyx_kp_u_Flight_RPC_failed_with_Python_ex, __pyx_k_Flight_RPC_failed_with_Python_ex, sizeof(__pyx_k_Flight_RPC_failed_with_Python_ex), 0, 1, 0, 0},
  {&__pyx_kp_u_Flight_RPC_failed_with_message_D, __pyx_k_Flight_RPC_failed_with_message_D, sizeof(__pyx_k_Flight_RPC_failed_with_message_D), 0, 1, 0, 0},
  {&__pyx_kp_u_Flight_error, __pyx_k_Flight_error, sizeof(__pyx_k_Flight_error), 0, 1, 0, 0},
  {&__pyx_n_s_GET_FLIGHT_INFO, __pyx_k_GET_FLIGHT_INFO, sizeof(__pyx_k_GET_FLIGHT_INFO), 0, 0, 1, 1},
  {&__pyx_n_s_GET_SCHEMA, __pyx_k_GET_SCHEMA, sizeof(__pyx_k_GET_SCHEMA), 0, 0, 1, 1},
  {&__pyx_n_s_GeneratorStream, __pyx_k_GeneratorStream, sizeof(__pyx_k_GeneratorStream), 0, 0, 1, 1},
  {&__pyx_kp_u_GeneratorStream_must_be_initiali, __pyx_k_GeneratorStream_must_be_initiali, sizeof(__pyx_k_GeneratorStream_must_be_initiali), 0, 1, 0, 0},
  {&__pyx_kp_u_Got_a_FlightDataStream_whose_sch, __pyx_k_Got_a_FlightDataStream_whose_sch, sizeof(__pyx_k_Got_a_FlightDataStream_whose_sch), 0, 1, 0, 0},
  {&__pyx_kp_u_Got_a_RecordBatch_whose_schema_d, __pyx_k_Got_a_RecordBatch_whose_schema_d, sizeof(__pyx_k_Got_a_RecordBatch_whose_schema_d), 0, 1, 0, 0},
  {&__pyx_n_s_HANDSHAKE, __pyx_k_HANDSHAKE, sizeof(__pyx_k_HANDSHAKE), 0, 0, 1, 1},
  {&__pyx_n_s_INVALID, __pyx_k_INVALID, sizeof(__pyx_k_INVALID), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x06, __pyx_k_Incompatible_checksums_s_vs_0x06, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x06), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x0f, __pyx_k_Incompatible_checksums_s_vs_0x0f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x0f), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb2, __pyx_k_Incompatible_checksums_s_vs_0xb2, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb2), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
  {&__pyx_kp_s_Information_about_a_particular_R, __pyx_k_Information_about_a_particular_R, sizeof(__pyx_k_Information_about_a_particular_R), 0, 0, 1, 0},
  {&__pyx_kp_u_Invalid_descriptor_type, __pyx_k_Invalid_descriptor_type, sizeof(__pyx_k_Invalid_descriptor_type), 0, 1, 0, 0},
  {&__pyx_n_s_LIST_ACTIONS, __pyx_k_LIST_ACTIONS, sizeof(__pyx_k_LIST_ACTIONS), 0, 0, 1, 1},
  {&__pyx_n_s_LIST_FLIGHTS, __pyx_k_LIST_FLIGHTS, sizeof(__pyx_k_LIST_FLIGHTS), 0, 0, 1, 1},
  {&__pyx_kp_u_Location, __pyx_k_Location, sizeof(__pyx_k_Location), 0, 1, 0, 0},
  {&__pyx_n_s_Location_2, __pyx_k_Location_2, sizeof(__pyx_k_Location_2), 0, 0, 1, 1},
  {&__pyx_n_s_MetadataRecordBatchReader, __pyx_k_MetadataRecordBatchReader, sizeof(__pyx_k_MetadataRecordBatchReader), 0, 0, 1, 1},
  {&__pyx_n_s_MetadataRecordBatchReader_2, __pyx_k_MetadataRecordBatchReader_2, sizeof(__pyx_k_MetadataRecordBatchReader_2), 0, 0, 1, 1},
  {&__pyx_n_s_MetadataRecordBatchReader___iter, __pyx_k_MetadataRecordBatchReader___iter, sizeof(__pyx_k_MetadataRecordBatchReader___iter), 0, 0, 1, 1},
  {&__pyx_kp_u_Must_provide_Action_not, __pyx_k_Must_provide_Action_not, sizeof(__pyx_k_Must_provide_Action_not), 0, 1, 0, 0},
  {&__pyx_kp_u_Must_provide_a_FlightDescriptor, __pyx_k_Must_provide_a_FlightDescriptor, sizeof(__pyx_k_Must_provide_a_FlightDescriptor), 0, 1, 0, 0},
  {&__pyx_kp_u_Must_provide_a_Location_not, __pyx_k_Must_provide_a_Location_not, sizeof(__pyx_k_Must_provide_a_Location_not), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_PATH, __pyx_k_PATH, sizeof(__pyx_k_PATH), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_ReadPandasOption, __pyx_k_ReadPandasOption, sizeof(__pyx_k_ReadPandasOption), 0, 0, 1, 1},
  {&__pyx_n_s_RecordBatchStream, __pyx_k_RecordBatchStream, sizeof(__pyx_k_RecordBatchStream), 0, 0, 1, 1},
  {&__pyx_n_s_Result, __pyx_k_Result, sizeof(__pyx_k_Result), 0, 0, 1, 1},
  {&__pyx_kp_u_Results_of_list_actions_must_be, __pyx_k_Results_of_list_actions_must_be, sizeof(__pyx_k_Results_of_list_actions_must_be), 0, 1, 0, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_SchemaResult, __pyx_k_SchemaResult, sizeof(__pyx_k_SchemaResult), 0, 0, 1, 1},
  {&__pyx_n_s_ServerAuthHandler, __pyx_k_ServerAuthHandler, sizeof(__pyx_k_ServerAuthHandler), 0, 0, 1, 1},
  {&__pyx_n_s_ServerAuthReader, __pyx_k_ServerAuthReader, sizeof(__pyx_k_ServerAuthReader), 0, 0, 1, 1},
  {&__pyx_n_s_ServerAuthSender, __pyx_k_ServerAuthSender, sizeof(__pyx_k_ServerAuthSender), 0, 0, 1, 1},
  {&__pyx_n_s_ServerCallContext, __pyx_k_ServerCallContext, sizeof(__pyx_k_ServerCallContext), 0, 0, 1, 1},
  {&__pyx_n_s_ServerMiddleware, __pyx_k_ServerMiddleware, sizeof(__pyx_k_ServerMiddleware), 0, 0, 1, 1},
  {&__pyx_n_s_ServerMiddlewareFactory, __pyx_k_ServerMiddlewareFactory, sizeof(__pyx_k_ServerMiddlewareFactory), 0, 0, 1, 1},
  {&__pyx_n_s_ServerMiddlewareFactoryWrapper, __pyx_k_ServerMiddlewareFactoryWrapper, sizeof(__pyx_k_ServerMiddlewareFactoryWrapper), 0, 0, 1, 1},
  {&__pyx_n_s_ServerMiddlewareWrapper, __pyx_k_ServerMiddlewareWrapper, sizeof(__pyx_k_ServerMiddlewareWrapper), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_Table, __pyx_k_Table, sizeof(__pyx_k_Table), 0, 0, 1, 1},
  {&__pyx_kp_u_The_FlightClient_connect_method, __pyx_k_The_FlightClient_connect_method, sizeof(__pyx_k_The_FlightClient_connect_method), 0, 1, 0, 0},
  {&__pyx_kp_u_The_FlightServer_run_method_is_d, __pyx_k_The_FlightServer_run_method_is_d, sizeof(__pyx_k_The_FlightServer_run_method_is_d), 0, 1, 0, 0},
  {&__pyx_kp_s_The_implemented_methods_in_Fligh, __pyx_k_The_implemented_methods_in_Fligh, sizeof(__pyx_k_The_implemented_methods_in_Fligh), 0, 0, 1, 0},
  {&__pyx_kp_s_The_type_of_a_FlightDescriptor, __pyx_k_The_type_of_a_FlightDescriptor, sizeof(__pyx_k_The_type_of_a_FlightDescriptor), 0, 0, 1, 0},
  {&__pyx_kp_u_Ticket, __pyx_k_Ticket, sizeof(__pyx_k_Ticket), 0, 1, 0, 0},
  {&__pyx_n_s_Ticket_2, __pyx_k_Ticket_2, sizeof(__pyx_k_Ticket_2), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UNKNOWN, __pyx_k_UNKNOWN, sizeof(__pyx_k_UNKNOWN), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_b__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 0, 0, 0},
  {&__pyx_n_s__66, __pyx_k__66, sizeof(__pyx_k__66), 0, 0, 1, 1},
  {&__pyx_n_s_action, __pyx_k_action, sizeof(__pyx_k_action), 0, 0, 1, 1},
  {&__pyx_n_s_action_type, __pyx_k_action_type, sizeof(__pyx_k_action_type), 0, 0, 1, 1},
  {&__pyx_n_s_app_metadata, __pyx_k_app_metadata, sizeof(__pyx_k_app_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_as_buffer, __pyx_k_as_buffer, sizeof(__pyx_k_as_buffer), 0, 0, 1, 1},
  {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
  {&__pyx_n_s_auth, __pyx_k_auth, sizeof(__pyx_k_auth), 0, 0, 1, 1},
  {&__pyx_n_s_auth_handler, __pyx_k_auth_handler, sizeof(__pyx_k_auth_handler), 0, 0, 1, 1},
  {&__pyx_kp_u_auth_handler_must_be_a_ServerAut, __pyx_k_auth_handler_must_be_a_ServerAut, sizeof(__pyx_k_auth_handler_must_be_a_ServerAut), 0, 1, 0, 0},
  {&__pyx_n_s_authenticate, __pyx_k_authenticate, sizeof(__pyx_k_authenticate), 0, 0, 1, 1},
  {&__pyx_n_s_batch, __pyx_k_batch, sizeof(__pyx_k_batch), 0, 0, 1, 1},
  {&__pyx_kp_u_bin, __pyx_k_bin, sizeof(__pyx_k_bin), 0, 1, 0, 0},
  {&__pyx_n_s_binary_type, __pyx_k_binary_type, sizeof(__pyx_k_binary_type), 0, 0, 1, 1},
  {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1},
  {&__pyx_n_s_c_host, __pyx_k_c_host, sizeof(__pyx_k_c_host), 0, 0, 1, 1},
  {&__pyx_n_s_c_path, __pyx_k_c_path, sizeof(__pyx_k_c_path), 0, 0, 1, 1},
  {&__pyx_n_s_c_port, __pyx_k_c_port, sizeof(__pyx_k_c_port), 0, 0, 1, 1},
  {&__pyx_n_s_call_completed, __pyx_k_call_completed, sizeof(__pyx_k_call_completed), 0, 0, 1, 1},
  {&__pyx_n_u_cert, __pyx_k_cert, sizeof(__pyx_k_cert), 0, 1, 0, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 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_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_command, __pyx_k_command, sizeof(__pyx_k_command), 0, 0, 1, 1},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
  {&__pyx_n_s_criteria, __pyx_k_criteria, sizeof(__pyx_k_criteria), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_source, __pyx_k_data_source, sizeof(__pyx_k_data_source), 0, 0, 1, 1},
  {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
  {&__pyx_n_u_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 1, 0, 1},
  {&__pyx_n_s_descriptor, __pyx_k_descriptor, sizeof(__pyx_k_descriptor), 0, 0, 1, 1},
  {&__pyx_n_s_descriptor_type, __pyx_k_descriptor_type, sizeof(__pyx_k_descriptor_type), 0, 0, 1, 1},
  {&__pyx_n_s_deserialize, __pyx_k_deserialize, sizeof(__pyx_k_deserialize), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_do_action, __pyx_k_do_action, sizeof(__pyx_k_do_action), 0, 0, 1, 1},
  {&__pyx_n_s_do_get, __pyx_k_do_get, sizeof(__pyx_k_do_get), 0, 0, 1, 1},
  {&__pyx_n_s_do_put, __pyx_k_do_put, sizeof(__pyx_k_do_put), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_endpoints, __pyx_k_endpoints, sizeof(__pyx_k_endpoints), 0, 0, 1, 1},
  {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
  {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
  {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1},
  {&__pyx_n_s_exc_value, __pyx_k_exc_value, sizeof(__pyx_k_exc_value), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_factories, __pyx_k_factories, sizeof(__pyx_k_factories), 0, 0, 1, 1},
  {&__pyx_n_s_for_command, __pyx_k_for_command, sizeof(__pyx_k_for_command), 0, 0, 1, 1},
  {&__pyx_n_s_for_grpc_tcp, __pyx_k_for_grpc_tcp, sizeof(__pyx_k_for_grpc_tcp), 0, 0, 1, 1},
  {&__pyx_n_s_for_grpc_tls, __pyx_k_for_grpc_tls, sizeof(__pyx_k_for_grpc_tls), 0, 0, 1, 1},
  {&__pyx_n_s_for_grpc_unix, __pyx_k_for_grpc_unix, sizeof(__pyx_k_for_grpc_unix), 0, 0, 1, 1},
  {&__pyx_n_s_for_path, __pyx_k_for_path, sizeof(__pyx_k_for_path), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_frombytes, __pyx_k_frombytes, sizeof(__pyx_k_frombytes), 0, 0, 1, 1},
  {&__pyx_n_s_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_flight_info, __pyx_k_get_flight_info, sizeof(__pyx_k_get_flight_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_schema, __pyx_k_get_schema, sizeof(__pyx_k_get_schema), 0, 0, 1, 1},
  {&__pyx_n_s_get_token, __pyx_k_get_token, sizeof(__pyx_k_get_token), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1},
  {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_incoming, __pyx_k_incoming, sizeof(__pyx_k_incoming), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_is_valid, __pyx_k_is_valid, sizeof(__pyx_k_is_valid), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_u_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 1, 0, 1},
  {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1},
  {&__pyx_n_s_list_actions, __pyx_k_list_actions, sizeof(__pyx_k_list_actions), 0, 0, 1, 1},
  {&__pyx_n_s_list_flights, __pyx_k_list_flights, sizeof(__pyx_k_list_flights), 0, 0, 1, 1},
  {&__pyx_n_u_localhost, __pyx_k_localhost, sizeof(__pyx_k_localhost), 0, 1, 0, 1},
  {&__pyx_n_s_location, __pyx_k_location, sizeof(__pyx_k_location), 0, 0, 1, 1},
  {&__pyx_kp_u_location_argument_must_be_a_str, __pyx_k_location_argument_must_be_a_str, sizeof(__pyx_k_location_argument_must_be_a_str), 0, 1, 0, 0},
  {&__pyx_n_s_locations, __pyx_k_locations, sizeof(__pyx_k_locations), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_action, __pyx_k_make_action, sizeof(__pyx_k_make_action), 0, 0, 1, 1},
  {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_n_u_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 1, 0, 1},
  {&__pyx_n_s_middleware, __pyx_k_middleware, sizeof(__pyx_k_middleware), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_munge_grpc_python_error, __pyx_k_munge_grpc_python_error, sizeof(__pyx_k_munge_grpc_python_error), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_outgoing, __pyx_k_outgoing, sizeof(__pyx_k_outgoing), 0, 0, 1, 1},
  {&__pyx_n_s_override_hostname, __pyx_k_override_hostname, sizeof(__pyx_k_override_hostname), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 0, 1, 1},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_pyarrow__flight, __pyx_k_pyarrow__flight, sizeof(__pyx_k_pyarrow__flight), 0, 0, 1, 1},
  {&__pyx_kp_s_pyarrow__flight_pyx, __pyx_k_pyarrow__flight_pyx, sizeof(__pyx_k_pyarrow__flight_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_pyarrow_compat, __pyx_k_pyarrow_compat, sizeof(__pyx_k_pyarrow_compat), 0, 0, 1, 1},
  {&__pyx_n_s_pyarrow_ipc, __pyx_k_pyarrow_ipc, sizeof(__pyx_k_pyarrow_ipc), 0, 0, 1, 1},
  {&__pyx_n_s_pyarrow_lib, __pyx_k_pyarrow_lib, sizeof(__pyx_k_pyarrow_lib), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 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_ClientAuthHandler, __pyx_k_pyx_unpickle_ClientAuthHandler, sizeof(__pyx_k_pyx_unpickle_ClientAuthHandler), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_ClientMiddleware, __pyx_k_pyx_unpickle_ClientMiddleware, sizeof(__pyx_k_pyx_unpickle_ClientMiddleware), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_ClientMiddlewareF, __pyx_k_pyx_unpickle_ClientMiddlewareF, sizeof(__pyx_k_pyx_unpickle_ClientMiddlewareF), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightCancelledEr, __pyx_k_pyx_unpickle_FlightCancelledEr, sizeof(__pyx_k_pyx_unpickle_FlightCancelledEr), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightDataStream, __pyx_k_pyx_unpickle_FlightDataStream, sizeof(__pyx_k_pyx_unpickle_FlightDataStream), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightError, __pyx_k_pyx_unpickle_FlightError, sizeof(__pyx_k_pyx_unpickle_FlightError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightInternalErr, __pyx_k_pyx_unpickle_FlightInternalErr, sizeof(__pyx_k_pyx_unpickle_FlightInternalErr), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightServerError, __pyx_k_pyx_unpickle_FlightServerError, sizeof(__pyx_k_pyx_unpickle_FlightServerError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightTimedOutErr, __pyx_k_pyx_unpickle_FlightTimedOutErr, sizeof(__pyx_k_pyx_unpickle_FlightTimedOutErr), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightUnauthentic, __pyx_k_pyx_unpickle_FlightUnauthentic, sizeof(__pyx_k_pyx_unpickle_FlightUnauthentic), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightUnauthorize, __pyx_k_pyx_unpickle_FlightUnauthorize, sizeof(__pyx_k_pyx_unpickle_FlightUnauthorize), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_FlightUnavailable, __pyx_k_pyx_unpickle_FlightUnavailable, sizeof(__pyx_k_pyx_unpickle_FlightUnavailable), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_RecordBatchStream, __pyx_k_pyx_unpickle_RecordBatchStream, sizeof(__pyx_k_pyx_unpickle_RecordBatchStream), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_ServerAuthHandler, __pyx_k_pyx_unpickle_ServerAuthHandler, sizeof(__pyx_k_pyx_unpickle_ServerAuthHandler), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_ServerMiddleware, __pyx_k_pyx_unpickle_ServerMiddleware, sizeof(__pyx_k_pyx_unpickle_ServerMiddleware), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_ServerMiddlewareF, __pyx_k_pyx_unpickle_ServerMiddlewareF, sizeof(__pyx_k_pyx_unpickle_ServerMiddlewareF), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle__ServerMiddleware, __pyx_k_pyx_unpickle__ServerMiddleware, sizeof(__pyx_k_pyx_unpickle__ServerMiddleware), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle__ServerMiddleware_2, __pyx_k_pyx_unpickle__ServerMiddleware_2, sizeof(__pyx_k_pyx_unpickle__ServerMiddleware_2), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_read_chunk, __pyx_k_read_chunk, sizeof(__pyx_k_read_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1},
  {&__pyx_n_s_received_headers, __pyx_k_received_headers, sizeof(__pyx_k_received_headers), 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_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_kp_u_run_on_uninitialized_FlightServe, __pyx_k_run_on_uninitialized_FlightServe, sizeof(__pyx_k_run_on_uninitialized_FlightServe), 0, 1, 0, 0},
  {&__pyx_n_s_schema, __pyx_k_schema, sizeof(__pyx_k_schema), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_kp_s_self_action_cannot_be_converted, __pyx_k_self_action_cannot_be_converted, sizeof(__pyx_k_self_action_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_basic_auth_cannot_be_conver, __pyx_k_self_basic_auth_cannot_be_conver, sizeof(__pyx_k_self_basic_auth_cannot_be_conver), 0, 0, 1, 0},
  {&__pyx_kp_s_self_chunk_cannot_be_converted_t, __pyx_k_self_chunk_cannot_be_converted_t, sizeof(__pyx_k_self_chunk_cannot_be_converted_t), 0, 0, 1, 0},
  {&__pyx_kp_s_self_client_cannot_be_converted, __pyx_k_self_client_cannot_be_converted, sizeof(__pyx_k_self_client_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_context_cannot_be_converted, __pyx_k_self_context_cannot_be_converted, sizeof(__pyx_k_self_context_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_current_stream_self_schema, __pyx_k_self_current_stream_self_schema, sizeof(__pyx_k_self_current_stream_self_schema), 0, 0, 1, 0},
  {&__pyx_kp_s_self_descriptor_cannot_be_conver, __pyx_k_self_descriptor_cannot_be_conver, sizeof(__pyx_k_self_descriptor_cannot_be_conver), 0, 0, 1, 0},
  {&__pyx_kp_s_self_endpoint_cannot_be_converte, __pyx_k_self_endpoint_cannot_be_converte, sizeof(__pyx_k_self_endpoint_cannot_be_converte), 0, 0, 1, 0},
  {&__pyx_kp_s_self_info_cannot_be_converted_to, __pyx_k_self_info_cannot_be_converted_to, sizeof(__pyx_k_self_info_cannot_be_converted_to), 0, 0, 1, 0},
  {&__pyx_kp_s_self_location_cannot_be_converte, __pyx_k_self_location_cannot_be_converte, sizeof(__pyx_k_self_location_cannot_be_converte), 0, 0, 1, 0},
  {&__pyx_kp_u_self_object_in_callback_is_not_G, __pyx_k_self_object_in_callback_is_not_G, sizeof(__pyx_k_self_object_in_callback_is_not_G), 0, 1, 0, 0},
  {&__pyx_kp_s_self_options_cannot_be_converted, __pyx_k_self_options_cannot_be_converted, sizeof(__pyx_k_self_options_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_reader_cannot_be_converted, __pyx_k_self_reader_cannot_be_converted, sizeof(__pyx_k_self_reader_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_result_cannot_be_converted, __pyx_k_self_result_cannot_be_converted, sizeof(__pyx_k_self_result_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_sender_cannot_be_converted, __pyx_k_self_sender_cannot_be_converted, sizeof(__pyx_k_self_sender_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_server_cannot_be_converted, __pyx_k_self_server_cannot_be_converted, sizeof(__pyx_k_self_server_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_ticket_cannot_be_converted, __pyx_k_self_ticket_cannot_be_converted, sizeof(__pyx_k_self_ticket_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_kp_s_self_writer_cannot_be_converted, __pyx_k_self_writer_cannot_be_converted, sizeof(__pyx_k_self_writer_cannot_be_converted), 0, 0, 1, 0},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_sending_headers, __pyx_k_sending_headers, sizeof(__pyx_k_sending_headers), 0, 0, 1, 1},
  {&__pyx_n_s_serve, __pyx_k_serve, sizeof(__pyx_k_serve), 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_shutdown, __pyx_k_shutdown, sizeof(__pyx_k_shutdown), 0, 0, 1, 1},
  {&__pyx_kp_u_shutdown_on_uninitialized_Flight, __pyx_k_shutdown_on_uninitialized_Flight, sizeof(__pyx_k_shutdown_on_uninitialized_Flight), 0, 1, 0, 0},
  {&__pyx_n_s_six, __pyx_k_six, sizeof(__pyx_k_six), 0, 0, 1, 1},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1},
  {&__pyx_n_s_start_call, __pyx_k_start_call, sizeof(__pyx_k_start_call), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
  {&__pyx_n_s_string_types, __pyx_k_string_types, sizeof(__pyx_k_string_types), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_text_type, __pyx_k_text_type, sizeof(__pyx_k_text_type), 0, 0, 1, 1},
  {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_ticket, __pyx_k_ticket, sizeof(__pyx_k_ticket), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_tls_certificates, __pyx_k_tls_certificates, sizeof(__pyx_k_tls_certificates), 0, 0, 1, 1},
  {&__pyx_n_s_tls_root_certs, __pyx_k_tls_root_certs, sizeof(__pyx_k_tls_root_certs), 0, 0, 1, 1},
  {&__pyx_n_s_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 0, 1, 1},
  {&__pyx_n_s_total_bytes, __pyx_k_total_bytes, sizeof(__pyx_k_total_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_total_records, __pyx_k_total_records, sizeof(__pyx_k_total_records), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_n_u_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 1, 0, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
  {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_wait, __pyx_k_wait, sizeof(__pyx_k_wait), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 275, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 119, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 383, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 511, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 827, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 981, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 1302, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 61, __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("self.options cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_self_options_cannot_be_converted); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "(tree fragment)":4
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.options cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_options_cannot_be_converted); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_self_action_cannot_be_converted); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "(tree fragment)":4
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.action cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_action_cannot_be_converted); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_result_cannot_be_converted); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "(tree fragment)":4
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_self_result_cannot_be_converted); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_self_basic_auth_cannot_be_conver); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "(tree fragment)":4
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.basic_auth cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_self_basic_auth_cannot_be_conver); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "pyarrow/_flight.pyx":383
 *         elif self.descriptor.type == CDescriptorTypeCmd:
 *             return DescriptorType.CMD
 *         raise RuntimeError("Invalid descriptor type!")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Invalid_descriptor_type); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_self_descriptor_cannot_be_conver); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "(tree fragment)":4
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.descriptor cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_self_descriptor_cannot_be_conver); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_self_ticket_cannot_be_converted); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "(tree fragment)":4
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.ticket cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_self_ticket_cannot_be_converted); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_self_location_cannot_be_converte); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "(tree fragment)":4
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.location cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_self_location_cannot_be_converte); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_self_endpoint_cannot_be_converte); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "(tree fragment)":4
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.endpoint cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_self_endpoint_cannot_be_converte); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_self_result_cannot_be_converted); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "(tree fragment)":4
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.result cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_self_result_cannot_be_converted); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_self_info_cannot_be_converted_to); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "(tree fragment)":4
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.info cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_self_info_cannot_be_converted_to); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_self_chunk_cannot_be_converted_t); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "(tree fragment)":4
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.chunk cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_self_chunk_cannot_be_converted_t); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_self_writer_cannot_be_converted); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "(tree fragment)":4
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_self_writer_cannot_be_converted); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_self_writer_cannot_be_converted); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "(tree fragment)":4
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.writer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_self_writer_cannot_be_converted); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "pyarrow/_flight.pyx":935
 *                 location = Location.for_grpc_tcp(host, port)
 *         elif not isinstance(location, Location):
 *             raise TypeError('`location` argument must be a string, tuple or a '             # <<<<<<<<<<<<<<
 *                             'Location instance')
 *         self.init(location, tls_root_certs, override_hostname, middleware)
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_u_location_argument_must_be_a_str); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "pyarrow/_flight.pyx":1064
 *             action = Action(*action)
 *         elif not isinstance(action, Action):
 *             raise TypeError("Action must be Action instance, string, or tuple")             # <<<<<<<<<<<<<<
 * 
 *         cdef CAction c_action = Action.unwrap(<Action> action)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_u_Action_must_be_Action_instance_s); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_self_client_cannot_be_converted); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "(tree fragment)":4
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.client cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_self_client_cannot_be_converted); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_self_current_stream_self_schema); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "(tree fragment)":4
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.current_stream,self.schema cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_self_current_stream_self_schema); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_self_context_cannot_be_converted); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "(tree fragment)":4
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.context cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_self_context_cannot_be_converted); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "pyarrow/_flight.pyx":1302
 *         cdef c_string token
 *         if not self.reader:
 *             raise ValueError("Cannot use ServerAuthReader outside "             # <<<<<<<<<<<<<<
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_u_Cannot_use_ServerAuthReader_outs); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "pyarrow/_flight.pyx":1333
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 *             raise ValueError("Cannot use ServerAuthSender outside "             # <<<<<<<<<<<<<<
 *                              "ServerAuthHandler.authenticate")
 *         with nogil:
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_u_Cannot_use_ServerAuthSender_outs); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_self_sender_cannot_be_converted); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "(tree fragment)":4
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_self_sender_cannot_be_converted); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "pyarrow/_flight.pyx":1363
 *         cdef c_string token
 *         if not self.reader:
 *             raise ValueError("Cannot use ClientAuthReader outside "             # <<<<<<<<<<<<<<
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_u_Cannot_use_ClientAuthReader_outs); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "(tree fragment)":4
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_self_reader_cannot_be_converted); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "pyarrow/_flight.pyx":1394
 *         cdef c_string c_message = tobytes(message)
 *         if not self.sender:
 *             raise ValueError("Cannot use ClientAuthSender outside "             # <<<<<<<<<<<<<<
 *                              "ClientAuthHandler.authenticate")
 *         with nogil:
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_u_Cannot_use_ClientAuthSender_outs); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 1394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_self_sender_cannot_be_converted); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "(tree fragment)":4
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.sender cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_self_sender_cannot_be_converted); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "pyarrow/_flight.pyx":1425
 *     py_stream = <object> self
 *     if not isinstance(py_stream, GeneratorStream):
 *         raise RuntimeError("self object in callback is not GeneratorStream")             # <<<<<<<<<<<<<<
 *     stream = <GeneratorStream> py_stream
 * 
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_u_self_object_in_callback_is_not_G); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "pyarrow/_flight.pyx":1451
 *     if isinstance(result, (Table, _CRecordBatchReader)):
 *         if metadata:
 *             raise ValueError("Can only return metadata alongside a "             # <<<<<<<<<<<<<<
 *                              "RecordBatch.")
 *         result = RecordBatchStream(result)
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_u_Can_only_return_metadata_alongsi); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "pyarrow/_flight.pyx":1592
 *         return (<FlightError> flight_error).to_status()
 *     if not isinstance(result, FlightDataStream):
 *         raise TypeError("FlightServerBase.do_get must return "             # <<<<<<<<<<<<<<
 *                         "a FlightDataStream")
 *     data_stream = unique_ptr[CFlightDataStream](
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_u_FlightServerBase_do_get_must_ret); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 1592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "pyarrow/_flight.pyx":1648
 *         for action in result:
 *             if not isinstance(action, tuple):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     "Results of list_actions must be ActionType or tuple")
 *             action_type.type = tobytes(action[0])
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_u_Results_of_list_actions_must_be); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "pyarrow/_flight.pyx":2145
 *         elif isinstance(location, (tuple, type(None))):
 *             if location is None:
 *                 location = ('localhost', 0)             # <<<<<<<<<<<<<<
 *             host, port = location
 *             if tls_certificates:
 */
  __pyx_tuple__61 = PyTuple_Pack(2, __pyx_n_u_localhost, __pyx_int_0); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 2145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "pyarrow/_flight.pyx":2243
 *         """
 *         if self.server.get() == nullptr:
 *             raise ValueError("run() on uninitialized FlightServerBase")             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(self.server.get().ServeWithSignals())
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_u_run_on_uninitialized_FlightServe); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 2243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "pyarrow/_flight.pyx":2265
 *         # indefinitely.
 *         if self.server.get() == nullptr:
 *             raise ValueError("shutdown() on uninitialized FlightServerBase")             # <<<<<<<<<<<<<<
 *         with nogil:
 *             check_flight_status(self.server.get().Shutdown())
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_kp_u_shutdown_on_uninitialized_Flight); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_s_self_server_cannot_be_converted); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "(tree fragment)":4
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.server cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_self_server_cannot_be_converted); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "pyarrow/_flight.pyx":85
 * 
 * 
 * def _munge_grpc_python_error(message):             # <<<<<<<<<<<<<<
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:
 */
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_n_s_message, __pyx_n_s_m); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_pyarrow__flight_pyx, __pyx_n_s_munge_grpc_python_error, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 85, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":214
 *     """A type of action that is executable on a Flight service."""
 * 
 *     def make_action(self, buf):             # <<<<<<<<<<<<<<
 *         """Create an Action with this type.
 * 
 */
  __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_buf); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_make_action, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 214, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":276
 * 
 *     @staticmethod
 *     def deserialize(string):             # <<<<<<<<<<<<<<
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 */
  __pyx_tuple__71 = PyTuple_Pack(2, __pyx_n_s_string, __pyx_n_s_auth); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_deserialize, 276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 276, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":357
 * 
 *     @staticmethod
 *     def for_path(*path):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for a resource path."""
 *         cdef FlightDescriptor result = \
 */
  __pyx_tuple__73 = PyTuple_Pack(3, __pyx_n_s_path, __pyx_n_s_result, __pyx_n_s_p); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_for_path, 357, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 357, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":366
 * 
 *     @staticmethod
 *     def for_command(command):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for an opaque command."""
 *         cdef FlightDescriptor result = \
 */
  __pyx_tuple__75 = PyTuple_Pack(2, __pyx_n_s_command, __pyx_n_s_result); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_for_command, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 366, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":515
 * 
 *     @staticmethod
 *     def for_grpc_tcp(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TCP-based gRPC service."""
 *         cdef:
 */
  __pyx_tuple__77 = PyTuple_Pack(5, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_c_host, __pyx_n_s_c_port, __pyx_n_s_result); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_for_grpc_tcp, 515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 515, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":526
 * 
 *     @staticmethod
 *     def for_grpc_tls(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TLS-based gRPC service."""
 *         cdef:
 */
  __pyx_tuple__79 = PyTuple_Pack(5, __pyx_n_s_host, __pyx_n_s_port, __pyx_n_s_c_host, __pyx_n_s_c_port, __pyx_n_s_result); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_for_grpc_tls, 526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 526, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":537
 * 
 *     @staticmethod
 *     def for_grpc_unix(path):             # <<<<<<<<<<<<<<
 *         """Create a Location for a domain socket-based gRPC service."""
 *         cdef:
 */
  __pyx_tuple__81 = PyTuple_Pack(3, __pyx_n_s_path, __pyx_n_s_c_path, __pyx_n_s_result); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_for_grpc_unix, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 537, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":2282
 * 
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *             middleware=None):
 *     """
 */
  __pyx_tuple__83 = PyTuple_Pack(4, __pyx_n_s_location, __pyx_n_s_tls_root_certs, __pyx_n_s_override_hostname, __pyx_n_s_middleware); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyarrow__flight_pyx, __pyx_n_s_connect, 2282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 2282, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__85 = 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__85)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightError, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__87 = 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__87)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightInternalErr, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__89 = 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__89)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightTimedOutErr, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__91 = 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__91)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightCancelledEr, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__93 = 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__93)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);
  __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightServerError, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__95 = 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__95)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);
  __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightUnauthentic, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__97 = 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__97)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);
  __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightUnauthorize, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__99 = 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__99)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightUnavailable, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__101 = 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__101)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_FlightDataStream, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__103 = 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__103)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_RecordBatchStream, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__105 = 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__105)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);
  __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ServerAuthHandler, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__107 = 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__107)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ClientAuthHandler, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__109 = 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__109)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ClientMiddlewareF, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__111 = 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__111)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ClientMiddleware, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__113 = 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__113)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ServerMiddlewareF, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__115 = 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__115)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ServerMiddleware, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__117 = 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__117)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__ServerMiddleware, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_tuple__119 = 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__119)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__ServerMiddleware_2, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(1, 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;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_025 = PyFloat_FromDouble(0.025); if (unlikely(!__pyx_float_0_025)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6351270 = PyInt_FromLong(6351270L); if (unlikely(!__pyx_int_6351270)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16160196 = PyInt_FromLong(16160196L); if (unlikely(!__pyx_int_16160196)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_186650374 = PyInt_FromLong(186650374L); if (unlikely(!__pyx_int_186650374)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_7pyarrow_7_flight_FlightCallOptions = &__pyx_vtable_7pyarrow_7_flight_FlightCallOptions;
  __pyx_vtable_7pyarrow_7_flight_FlightCallOptions.unwrap = ( arrow::flight::FlightCallOptions *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightCallOptions *))__pyx_f_7pyarrow_7_flight_17FlightCallOptions_unwrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightCallOptions) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightCallOptions.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightCallOptions.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightCallOptions.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightCallOptions.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_FlightCallOptions, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_17FlightCallOptions___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_17FlightCallOptions___init__.doc = __pyx_doc_7pyarrow_7_flight_17FlightCallOptions___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_17FlightCallOptions___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightCallOptions.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightCallOptions) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightCallOptions, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightCallOptions) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightCallOptions) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightCallOptions = &__pyx_type_7pyarrow_7_flight_FlightCallOptions;
  __pyx_vtabptr_7pyarrow_7_flight_FlightError = &__pyx_vtable_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightError.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_11FlightError_to_status;
  __pyx_type_7pyarrow_7_flight_FlightError.tp_base = (&((PyTypeObject*)PyExc_Exception)[0]);
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightError) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightError) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightError) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightError) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightError = &__pyx_type_7pyarrow_7_flight_FlightError;
  __pyx_vtabptr_7pyarrow_7_flight_FlightInternalError = &__pyx_vtable_7pyarrow_7_flight_FlightInternalError;
  __pyx_vtable_7pyarrow_7_flight_FlightInternalError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightInternalError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_19FlightInternalError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightTimedOutError = &__pyx_vtable_7pyarrow_7_flight_FlightTimedOutError;
  __pyx_vtable_7pyarrow_7_flight_FlightTimedOutError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightTimedOutError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_19FlightTimedOutError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightCancelledError = &__pyx_vtable_7pyarrow_7_flight_FlightCancelledError;
  __pyx_vtable_7pyarrow_7_flight_FlightCancelledError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightCancelledError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_20FlightCancelledError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightServerError = &__pyx_vtable_7pyarrow_7_flight_FlightServerError;
  __pyx_vtable_7pyarrow_7_flight_FlightServerError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightServerError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_17FlightServerError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightUnauthenticatedError = &__pyx_vtable_7pyarrow_7_flight_FlightUnauthenticatedError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnauthenticatedError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnauthenticatedError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_26FlightUnauthenticatedError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightUnauthorizedError = &__pyx_vtable_7pyarrow_7_flight_FlightUnauthorizedError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnauthorizedError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnauthorizedError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_23FlightUnauthorizedError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_FlightUnavailableError = &__pyx_vtable_7pyarrow_7_flight_FlightUnavailableError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnavailableError.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightError;
  __pyx_vtable_7pyarrow_7_flight_FlightUnavailableError.__pyx_base.to_status = (arrow::Status (*)(struct __pyx_obj_7pyarrow_7_flight_FlightError *))__pyx_f_7pyarrow_7_flight_22FlightUnavailableError_to_status;
  __pyx_vtabptr_7pyarrow_7_flight_Action = &__pyx_vtable_7pyarrow_7_flight_Action;
  __pyx_vtable_7pyarrow_7_flight_Action.unwrap = ( arrow::flight::Action (*)(struct __pyx_obj_7pyarrow_7_flight_Action *))__pyx_f_7pyarrow_7_flight_6Action_unwrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_Action) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_Action.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_Action.tp_dictoffset && __pyx_type_7pyarrow_7_flight_Action.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_Action.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_Action, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 174, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_6Action___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_6Action___init__.doc = __pyx_doc_7pyarrow_7_flight_6Action___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_6Action___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_Action.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_Action) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Action, (PyObject *)&__pyx_type_7pyarrow_7_flight_Action) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_Action) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_Action = &__pyx_type_7pyarrow_7_flight_Action;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_Result) < 0) __PYX_ERR(0, 225, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_Result.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_Result.tp_dictoffset && __pyx_type_7pyarrow_7_flight_Result.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_Result.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_Result, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 225, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_6Result___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_6Result___init__.doc = __pyx_doc_7pyarrow_7_flight_6Result___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_6Result___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Result, (PyObject *)&__pyx_type_7pyarrow_7_flight_Result) < 0) __PYX_ERR(0, 225, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_Result) < 0) __PYX_ERR(0, 225, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_Result = &__pyx_type_7pyarrow_7_flight_Result;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_BasicAuth) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_BasicAuth.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_BasicAuth.tp_dictoffset && __pyx_type_7pyarrow_7_flight_BasicAuth.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_BasicAuth.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_BasicAuth, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 246, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_9BasicAuth___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_9BasicAuth___init__.doc = __pyx_doc_7pyarrow_7_flight_9BasicAuth___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_9BasicAuth___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BasicAuth, (PyObject *)&__pyx_type_7pyarrow_7_flight_BasicAuth) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_BasicAuth) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_BasicAuth = &__pyx_type_7pyarrow_7_flight_BasicAuth;
  __pyx_vtabptr_7pyarrow_7_flight_FlightDescriptor = &__pyx_vtable_7pyarrow_7_flight_FlightDescriptor;
  __pyx_vtable_7pyarrow_7_flight_FlightDescriptor.unwrap = ( arrow::flight::FlightDescriptor (*)(struct __pyx_obj_7pyarrow_7_flight_FlightDescriptor *))__pyx_f_7pyarrow_7_flight_16FlightDescriptor_unwrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightDescriptor) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightDescriptor.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightDescriptor.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightDescriptor.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightDescriptor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightDescriptor.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightDescriptor) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightDescriptor, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightDescriptor) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightDescriptor) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightDescriptor = &__pyx_type_7pyarrow_7_flight_FlightDescriptor;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_Ticket) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_Ticket.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_Ticket.tp_dictoffset && __pyx_type_7pyarrow_7_flight_Ticket.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_Ticket.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Ticket_2, (PyObject *)&__pyx_type_7pyarrow_7_flight_Ticket) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_Ticket) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_Ticket = &__pyx_type_7pyarrow_7_flight_Ticket;
  __pyx_vtabptr_7pyarrow_7_flight_Location = &__pyx_vtable_7pyarrow_7_flight_Location;
  __pyx_vtable_7pyarrow_7_flight_Location.wrap = (struct __pyx_obj_7pyarrow_7_flight_Location *(*)( arrow::flight::Location))__pyx_f_7pyarrow_7_flight_8Location_wrap;
  __pyx_vtable_7pyarrow_7_flight_Location.unwrap = ( arrow::flight::Location (*)(PyObject *))__pyx_f_7pyarrow_7_flight_8Location_unwrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_Location) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_Location.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_Location.tp_dictoffset && __pyx_type_7pyarrow_7_flight_Location.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_Location.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_Location.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_Location) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Location_2, (PyObject *)&__pyx_type_7pyarrow_7_flight_Location) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_Location) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_Location = &__pyx_type_7pyarrow_7_flight_Location;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightEndpoint) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightEndpoint.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightEndpoint.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightEndpoint.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightEndpoint.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_FlightEndpoint, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 564, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_14FlightEndpoint___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_14FlightEndpoint___init__.doc = __pyx_doc_7pyarrow_7_flight_14FlightEndpoint___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_14FlightEndpoint___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightEndpoint, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightEndpoint) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightEndpoint) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightEndpoint = &__pyx_type_7pyarrow_7_flight_FlightEndpoint;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_SchemaResult) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_SchemaResult.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_SchemaResult.tp_dictoffset && __pyx_type_7pyarrow_7_flight_SchemaResult.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_SchemaResult.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_SchemaResult, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 619, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_12SchemaResult___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_12SchemaResult___init__.doc = __pyx_doc_7pyarrow_7_flight_12SchemaResult___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_12SchemaResult___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SchemaResult, (PyObject *)&__pyx_type_7pyarrow_7_flight_SchemaResult) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_SchemaResult) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_SchemaResult = &__pyx_type_7pyarrow_7_flight_SchemaResult;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightInfo) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightInfo.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightInfo.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightInfo.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightInfo.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_FlightInfo, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 647, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_10FlightInfo___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_10FlightInfo___init__.doc = __pyx_doc_7pyarrow_7_flight_10FlightInfo___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_10FlightInfo___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightInfo, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightInfo) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightInfo) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightInfo = &__pyx_type_7pyarrow_7_flight_FlightInfo;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightStreamChunk) < 0) __PYX_ERR(0, 754, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightStreamChunk.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightStreamChunk.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightStreamChunk.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightStreamChunk.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightStreamChunk, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightStreamChunk) < 0) __PYX_ERR(0, 754, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightStreamChunk) < 0) __PYX_ERR(0, 754, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightStreamChunk = &__pyx_type_7pyarrow_7_flight_FlightStreamChunk;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader.tp_print = 0;
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetadataRecordBatchReader, (PyObject *)&__pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader = &__pyx_type_7pyarrow_7_flight__MetadataRecordBatchReader;
  __pyx_t_1 = PyImport_ImportModule("pyarrow.lib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7pyarrow_3lib__CRecordBatchWriter = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "_CRecordBatchWriter", sizeof(struct __pyx_obj_7pyarrow_3lib__CRecordBatchWriter), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib__CRecordBatchWriter) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_type_7pyarrow_7_flight_FlightStreamWriter.tp_base = __pyx_ptype_7pyarrow_3lib__CRecordBatchWriter;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightStreamWriter) < 0) __PYX_ERR(0, 841, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightStreamWriter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightStreamWriter.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightStreamWriter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightStreamWriter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightStreamWriter, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightStreamWriter) < 0) __PYX_ERR(0, 841, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightStreamWriter) < 0) __PYX_ERR(0, 841, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightStreamWriter = &__pyx_type_7pyarrow_7_flight_FlightStreamWriter;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightMetadataReader) < 0) __PYX_ERR(0, 869, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightMetadataReader.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightMetadataReader.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightMetadataReader.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightMetadataReader.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightMetadataReader, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightMetadataReader) < 0) __PYX_ERR(0, 869, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightMetadataReader) < 0) __PYX_ERR(0, 869, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightMetadataReader = &__pyx_type_7pyarrow_7_flight_FlightMetadataReader;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightMetadataWriter) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightMetadataWriter.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightMetadataWriter.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightMetadataWriter.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightMetadataWriter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightMetadataWriter, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightMetadataWriter) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightMetadataWriter) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightMetadataWriter = &__pyx_type_7pyarrow_7_flight_FlightMetadataWriter;
  __pyx_vtabptr_7pyarrow_7_flight_FlightClient = &__pyx_vtable_7pyarrow_7_flight_FlightClient;
  __pyx_vtable_7pyarrow_7_flight_FlightClient.init = (PyObject *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightClient *, struct __pyx_obj_7pyarrow_7_flight_Location *, PyObject *, PyObject *, PyObject *))__pyx_f_7pyarrow_7_flight_12FlightClient_init;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightClient) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightClient.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightClient.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightClient.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightClient.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightClient.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightClient) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightClient, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightClient) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightClient) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightClient = &__pyx_type_7pyarrow_7_flight_FlightClient;
  __pyx_vtabptr_7pyarrow_7_flight_FlightDataStream = &__pyx_vtable_7pyarrow_7_flight_FlightDataStream;
  __pyx_vtable_7pyarrow_7_flight_FlightDataStream.to_stream = ( arrow::flight::FlightDataStream *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *))__pyx_f_7pyarrow_7_flight_16FlightDataStream_to_stream;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightDataStream) < 0) __PYX_ERR(0, 1182, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightDataStream.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightDataStream.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightDataStream.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightDataStream.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightDataStream.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightDataStream) < 0) __PYX_ERR(0, 1182, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightDataStream, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightDataStream) < 0) __PYX_ERR(0, 1182, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightDataStream) < 0) __PYX_ERR(0, 1182, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightDataStream = &__pyx_type_7pyarrow_7_flight_FlightDataStream;
  __pyx_vtabptr_7pyarrow_7_flight_RecordBatchStream = &__pyx_vtable_7pyarrow_7_flight_RecordBatchStream;
  __pyx_vtable_7pyarrow_7_flight_RecordBatchStream.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightDataStream;
  __pyx_vtable_7pyarrow_7_flight_RecordBatchStream.__pyx_base.to_stream = ( arrow::flight::FlightDataStream *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *))__pyx_f_7pyarrow_7_flight_17RecordBatchStream_to_stream;
  __pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightDataStream;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_RecordBatchStream) < 0) __PYX_ERR(0, 1194, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_dictoffset && __pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_RecordBatchStream, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1194, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_17RecordBatchStream___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_17RecordBatchStream___init__.doc = __pyx_doc_7pyarrow_7_flight_17RecordBatchStream___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_17RecordBatchStream___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_RecordBatchStream.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_RecordBatchStream) < 0) __PYX_ERR(0, 1194, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RecordBatchStream, (PyObject *)&__pyx_type_7pyarrow_7_flight_RecordBatchStream) < 0) __PYX_ERR(0, 1194, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_RecordBatchStream) < 0) __PYX_ERR(0, 1194, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_RecordBatchStream = &__pyx_type_7pyarrow_7_flight_RecordBatchStream;
  __pyx_vtabptr_7pyarrow_7_flight_GeneratorStream = &__pyx_vtable_7pyarrow_7_flight_GeneratorStream;
  __pyx_vtable_7pyarrow_7_flight_GeneratorStream.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_FlightDataStream;
  __pyx_vtable_7pyarrow_7_flight_GeneratorStream.__pyx_base.to_stream = ( arrow::flight::FlightDataStream *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightDataStream *))__pyx_f_7pyarrow_7_flight_15GeneratorStream_to_stream;
  __pyx_type_7pyarrow_7_flight_GeneratorStream.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightDataStream;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_GeneratorStream) < 0) __PYX_ERR(0, 1226, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_GeneratorStream.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_GeneratorStream.tp_dictoffset && __pyx_type_7pyarrow_7_flight_GeneratorStream.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_GeneratorStream.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7pyarrow_7_flight_GeneratorStream, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1226, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7pyarrow_7_flight_15GeneratorStream___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7pyarrow_7_flight_15GeneratorStream___init__.doc = __pyx_doc_7pyarrow_7_flight_15GeneratorStream___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7pyarrow_7_flight_15GeneratorStream___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_GeneratorStream.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_GeneratorStream) < 0) __PYX_ERR(0, 1226, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_GeneratorStream, (PyObject *)&__pyx_type_7pyarrow_7_flight_GeneratorStream) < 0) __PYX_ERR(0, 1226, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_GeneratorStream) < 0) __PYX_ERR(0, 1226, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_GeneratorStream = &__pyx_type_7pyarrow_7_flight_GeneratorStream;
  __pyx_vtabptr_7pyarrow_7_flight_ServerCallContext = &__pyx_vtable_7pyarrow_7_flight_ServerCallContext;
  __pyx_vtable_7pyarrow_7_flight_ServerCallContext.wrap = (struct __pyx_obj_7pyarrow_7_flight_ServerCallContext *(*)( arrow::flight::ServerCallContext const &))__pyx_f_7pyarrow_7_flight_17ServerCallContext_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerCallContext) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerCallContext.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerCallContext.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerCallContext.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerCallContext.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ServerCallContext.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ServerCallContext) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerCallContext, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerCallContext) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerCallContext) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerCallContext = &__pyx_type_7pyarrow_7_flight_ServerCallContext;
  __pyx_vtabptr_7pyarrow_7_flight_ServerAuthReader = &__pyx_vtable_7pyarrow_7_flight_ServerAuthReader;
  __pyx_vtable_7pyarrow_7_flight_ServerAuthReader.poison = (void (*)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *))__pyx_f_7pyarrow_7_flight_16ServerAuthReader_poison;
  __pyx_vtable_7pyarrow_7_flight_ServerAuthReader.wrap = (struct __pyx_obj_7pyarrow_7_flight_ServerAuthReader *(*)( arrow::flight::ServerAuthReader *))__pyx_f_7pyarrow_7_flight_16ServerAuthReader_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerAuthReader) < 0) __PYX_ERR(0, 1294, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerAuthReader.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerAuthReader.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerAuthReader.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerAuthReader.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ServerAuthReader.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ServerAuthReader) < 0) __PYX_ERR(0, 1294, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerAuthReader, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerAuthReader) < 0) __PYX_ERR(0, 1294, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerAuthReader) < 0) __PYX_ERR(0, 1294, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerAuthReader = &__pyx_type_7pyarrow_7_flight_ServerAuthReader;
  __pyx_vtabptr_7pyarrow_7_flight_ServerAuthSender = &__pyx_vtable_7pyarrow_7_flight_ServerAuthSender;
  __pyx_vtable_7pyarrow_7_flight_ServerAuthSender.poison = (void (*)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *))__pyx_f_7pyarrow_7_flight_16ServerAuthSender_poison;
  __pyx_vtable_7pyarrow_7_flight_ServerAuthSender.wrap = (struct __pyx_obj_7pyarrow_7_flight_ServerAuthSender *(*)( arrow::flight::ServerAuthSender *))__pyx_f_7pyarrow_7_flight_16ServerAuthSender_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerAuthSender) < 0) __PYX_ERR(0, 1325, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerAuthSender.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerAuthSender.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerAuthSender.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerAuthSender.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ServerAuthSender.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ServerAuthSender) < 0) __PYX_ERR(0, 1325, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerAuthSender, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerAuthSender) < 0) __PYX_ERR(0, 1325, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerAuthSender) < 0) __PYX_ERR(0, 1325, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerAuthSender = &__pyx_type_7pyarrow_7_flight_ServerAuthSender;
  __pyx_vtabptr_7pyarrow_7_flight_ClientAuthReader = &__pyx_vtable_7pyarrow_7_flight_ClientAuthReader;
  __pyx_vtable_7pyarrow_7_flight_ClientAuthReader.poison = (void (*)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *))__pyx_f_7pyarrow_7_flight_16ClientAuthReader_poison;
  __pyx_vtable_7pyarrow_7_flight_ClientAuthReader.wrap = (struct __pyx_obj_7pyarrow_7_flight_ClientAuthReader *(*)( arrow::flight::ClientAuthReader *))__pyx_f_7pyarrow_7_flight_16ClientAuthReader_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ClientAuthReader) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ClientAuthReader.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ClientAuthReader.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ClientAuthReader.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ClientAuthReader.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ClientAuthReader.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ClientAuthReader) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClientAuthReader, (PyObject *)&__pyx_type_7pyarrow_7_flight_ClientAuthReader) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ClientAuthReader) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ClientAuthReader = &__pyx_type_7pyarrow_7_flight_ClientAuthReader;
  __pyx_vtabptr_7pyarrow_7_flight_ClientAuthSender = &__pyx_vtable_7pyarrow_7_flight_ClientAuthSender;
  __pyx_vtable_7pyarrow_7_flight_ClientAuthSender.poison = (void (*)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *))__pyx_f_7pyarrow_7_flight_16ClientAuthSender_poison;
  __pyx_vtable_7pyarrow_7_flight_ClientAuthSender.wrap = (struct __pyx_obj_7pyarrow_7_flight_ClientAuthSender *(*)( arrow::flight::ClientAuthSender *))__pyx_f_7pyarrow_7_flight_16ClientAuthSender_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ClientAuthSender) < 0) __PYX_ERR(0, 1386, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ClientAuthSender.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ClientAuthSender.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ClientAuthSender.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ClientAuthSender.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ClientAuthSender.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ClientAuthSender) < 0) __PYX_ERR(0, 1386, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClientAuthSender, (PyObject *)&__pyx_type_7pyarrow_7_flight_ClientAuthSender) < 0) __PYX_ERR(0, 1386, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ClientAuthSender) < 0) __PYX_ERR(0, 1386, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ClientAuthSender = &__pyx_type_7pyarrow_7_flight_ClientAuthSender;
  __pyx_vtabptr_7pyarrow_7_flight_ServerAuthHandler = &__pyx_vtable_7pyarrow_7_flight_ServerAuthHandler;
  __pyx_vtable_7pyarrow_7_flight_ServerAuthHandler.to_handler = ( arrow::py::flight::PyServerAuthHandler *(*)(struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *))__pyx_f_7pyarrow_7_flight_17ServerAuthHandler_to_handler;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerAuthHandler) < 0) __PYX_ERR(0, 1819, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerAuthHandler.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerAuthHandler.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerAuthHandler.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerAuthHandler.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ServerAuthHandler.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ServerAuthHandler) < 0) __PYX_ERR(0, 1819, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerAuthHandler, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerAuthHandler) < 0) __PYX_ERR(0, 1819, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerAuthHandler) < 0) __PYX_ERR(0, 1819, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerAuthHandler = &__pyx_type_7pyarrow_7_flight_ServerAuthHandler;
  __pyx_vtabptr_7pyarrow_7_flight_ClientAuthHandler = &__pyx_vtable_7pyarrow_7_flight_ClientAuthHandler;
  __pyx_vtable_7pyarrow_7_flight_ClientAuthHandler.to_handler = ( arrow::py::flight::PyClientAuthHandler *(*)(struct __pyx_obj_7pyarrow_7_flight_ClientAuthHandler *))__pyx_f_7pyarrow_7_flight_17ClientAuthHandler_to_handler;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ClientAuthHandler) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ClientAuthHandler.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ClientAuthHandler.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ClientAuthHandler.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ClientAuthHandler.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ClientAuthHandler.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ClientAuthHandler) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClientAuthHandler, (PyObject *)&__pyx_type_7pyarrow_7_flight_ClientAuthHandler) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ClientAuthHandler) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ClientAuthHandler = &__pyx_type_7pyarrow_7_flight_ClientAuthHandler;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClientMiddlewareFactory, (PyObject *)&__pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ClientMiddlewareFactory = &__pyx_type_7pyarrow_7_flight_ClientMiddlewareFactory;
  __pyx_vtabptr_7pyarrow_7_flight_ClientMiddleware = &__pyx_vtable_7pyarrow_7_flight_ClientMiddleware;
  __pyx_vtable_7pyarrow_7_flight_ClientMiddleware.wrap = (void (*)(PyObject *, std::unique_ptr< arrow::flight::ClientMiddleware>  *))__pyx_f_7pyarrow_7_flight_16ClientMiddleware_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ClientMiddleware) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ClientMiddleware.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ClientMiddleware.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ClientMiddleware.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ClientMiddleware.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ClientMiddleware.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ClientMiddleware) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ClientMiddleware, (PyObject *)&__pyx_type_7pyarrow_7_flight_ClientMiddleware) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ClientMiddleware) < 0) __PYX_ERR(0, 1929, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ClientMiddleware = &__pyx_type_7pyarrow_7_flight_ClientMiddleware;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory) < 0) __PYX_ERR(0, 1986, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerMiddlewareFactory, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory) < 0) __PYX_ERR(0, 1986, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory) < 0) __PYX_ERR(0, 1986, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory = &__pyx_type_7pyarrow_7_flight_ServerMiddlewareFactory;
  __pyx_vtabptr_7pyarrow_7_flight_ServerMiddleware = &__pyx_vtable_7pyarrow_7_flight_ServerMiddleware;
  __pyx_vtable_7pyarrow_7_flight_ServerMiddleware.wrap = (void (*)(PyObject *, std::shared_ptr< arrow::flight::ServerMiddleware>  *))__pyx_f_7pyarrow_7_flight_16ServerMiddleware_wrap;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_ServerMiddleware) < 0) __PYX_ERR(0, 2024, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_ServerMiddleware.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_ServerMiddleware.tp_dictoffset && __pyx_type_7pyarrow_7_flight_ServerMiddleware.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_ServerMiddleware.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_ServerMiddleware.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_ServerMiddleware) < 0) __PYX_ERR(0, 2024, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerMiddleware, (PyObject *)&__pyx_type_7pyarrow_7_flight_ServerMiddleware) < 0) __PYX_ERR(0, 2024, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_ServerMiddleware) < 0) __PYX_ERR(0, 2024, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_ServerMiddleware = &__pyx_type_7pyarrow_7_flight_ServerMiddleware;
  __pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper.tp_base = __pyx_ptype_7pyarrow_7_flight_ServerMiddlewareFactory;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper.tp_dictoffset && __pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerMiddlewareFactoryWrapper, (PyObject *)&__pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper) < 0) __PYX_ERR(0, 2065, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper = &__pyx_type_7pyarrow_7_flight__ServerMiddlewareFactoryWrapper;
  __pyx_vtabptr_7pyarrow_7_flight__ServerMiddlewareWrapper = &__pyx_vtable_7pyarrow_7_flight__ServerMiddlewareWrapper;
  __pyx_vtable_7pyarrow_7_flight__ServerMiddlewareWrapper.__pyx_base = *__pyx_vtabptr_7pyarrow_7_flight_ServerMiddleware;
  __pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_base = __pyx_ptype_7pyarrow_7_flight_ServerMiddleware;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper) < 0) __PYX_ERR(0, 2087, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_dictoffset && __pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper.tp_dict, __pyx_vtabptr_7pyarrow_7_flight__ServerMiddlewareWrapper) < 0) __PYX_ERR(0, 2087, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerMiddlewareWrapper, (PyObject *)&__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper) < 0) __PYX_ERR(0, 2087, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper) < 0) __PYX_ERR(0, 2087, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight__ServerMiddlewareWrapper = &__pyx_type_7pyarrow_7_flight__ServerMiddlewareWrapper;
  __pyx_vtabptr_7pyarrow_7_flight_FlightServerBase = &__pyx_vtable_7pyarrow_7_flight_FlightServerBase;
  __pyx_vtable_7pyarrow_7_flight_FlightServerBase.init = (PyObject *(*)(struct __pyx_obj_7pyarrow_7_flight_FlightServerBase *, struct __pyx_obj_7pyarrow_7_flight_Location *, struct __pyx_obj_7pyarrow_7_flight_ServerAuthHandler *, PyObject *, PyObject *))__pyx_f_7pyarrow_7_flight_16FlightServerBase_init;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightServerBase) < 0) __PYX_ERR(0, 2113, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightServerBase.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight_FlightServerBase.tp_dictoffset && __pyx_type_7pyarrow_7_flight_FlightServerBase.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight_FlightServerBase.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightServerBase.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightServerBase) < 0) __PYX_ERR(0, 2113, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightServerBase, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightServerBase) < 0) __PYX_ERR(0, 2113, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightServerBase) < 0) __PYX_ERR(0, 2113, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightServerBase = &__pyx_type_7pyarrow_7_flight_FlightServerBase;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__) < 0) __PYX_ERR(0, 792, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__.tp_dictoffset && __pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7pyarrow_7_flight___pyx_scope_struct____iter__ = &__pyx_type_7pyarrow_7_flight___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action) < 0) __PYX_ERR(0, 1038, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action.tp_dictoffset && __pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_1_do_action = &__pyx_type_7pyarrow_7_flight___pyx_scope_struct_1_do_action;
  if (PyType_Ready(&__pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights) < 0) __PYX_ERR(0, 1080, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights.tp_dictoffset && __pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7pyarrow_7_flight___pyx_scope_struct_2_list_flights = &__pyx_type_7pyarrow_7_flight___pyx_scope_struct_2_list_flights;
  __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;
  __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(3, 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(3, 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(4, 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(4, 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(5, 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(5, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("datetime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_8datetime_date = __Pyx_ImportType(__pyx_t_1, "datetime", "date", sizeof(PyDateTime_Date), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_8datetime_date) __PYX_ERR(2, 9, __pyx_L1_error)
  __pyx_ptype_7cpython_8datetime_time = __Pyx_ImportType(__pyx_t_1, "datetime", "time", sizeof(PyDateTime_Time), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_8datetime_time) __PYX_ERR(2, 12, __pyx_L1_error)
  __pyx_ptype_7cpython_8datetime_datetime = __Pyx_ImportType(__pyx_t_1, "datetime", "datetime", sizeof(PyDateTime_DateTime), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_8datetime_datetime) __PYX_ERR(2, 15, __pyx_L1_error)
  __pyx_ptype_7cpython_8datetime_timedelta = __Pyx_ImportType(__pyx_t_1, "datetime", "timedelta", sizeof(PyDateTime_Delta), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_8datetime_timedelta) __PYX_ERR(2, 18, __pyx_L1_error)
  __pyx_ptype_7cpython_8datetime_tzinfo = __Pyx_ImportType(__pyx_t_1, "datetime", "tzinfo", sizeof(PyDateTime_TZInfo), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_8datetime_tzinfo) __PYX_ERR(2, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("pyarrow.lib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7pyarrow_3lib_Message = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Message", sizeof(struct __pyx_obj_7pyarrow_3lib_Message), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Message) __PYX_ERR(6, 36, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_MemoryPool = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "MemoryPool", sizeof(struct __pyx_obj_7pyarrow_3lib_MemoryPool), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_MemoryPool) __PYX_ERR(6, 41, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_MemoryPool = (struct __pyx_vtabstruct_7pyarrow_3lib_MemoryPool*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_MemoryPool->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_MemoryPool)) __PYX_ERR(6, 41, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DataType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DataType", sizeof(struct __pyx_obj_7pyarrow_3lib_DataType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DataType) __PYX_ERR(6, 51, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_DataType = (struct __pyx_vtabstruct_7pyarrow_3lib_DataType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_DataType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_DataType)) __PYX_ERR(6, 51, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ListType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ListType", sizeof(struct __pyx_obj_7pyarrow_3lib_ListType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ListType) __PYX_ERR(6, 62, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ListType = (struct __pyx_vtabstruct_7pyarrow_3lib_ListType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ListType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ListType)) __PYX_ERR(6, 62, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_LargeListType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "LargeListType", sizeof(struct __pyx_obj_7pyarrow_3lib_LargeListType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_LargeListType) __PYX_ERR(6, 67, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_LargeListType = (struct __pyx_vtabstruct_7pyarrow_3lib_LargeListType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_LargeListType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_LargeListType)) __PYX_ERR(6, 67, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_MapType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "MapType", sizeof(struct __pyx_obj_7pyarrow_3lib_MapType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_MapType) __PYX_ERR(6, 72, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_MapType = (struct __pyx_vtabstruct_7pyarrow_3lib_MapType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_MapType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_MapType)) __PYX_ERR(6, 72, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeListType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeListType", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeListType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeListType) __PYX_ERR(6, 77, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeListType = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeListType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeListType)) __PYX_ERR(6, 77, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_StructType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "StructType", sizeof(struct __pyx_obj_7pyarrow_3lib_StructType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_StructType) __PYX_ERR(6, 82, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_StructType = (struct __pyx_vtabstruct_7pyarrow_3lib_StructType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_StructType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_StructType)) __PYX_ERR(6, 82, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DictionaryMemo = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DictionaryMemo", sizeof(struct __pyx_obj_7pyarrow_3lib_DictionaryMemo), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DictionaryMemo) __PYX_ERR(6, 90, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DictionaryType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DictionaryType", sizeof(struct __pyx_obj_7pyarrow_3lib_DictionaryType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DictionaryType) __PYX_ERR(6, 98, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_DictionaryType = (struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_DictionaryType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_DictionaryType)) __PYX_ERR(6, 98, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_TimestampType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "TimestampType", sizeof(struct __pyx_obj_7pyarrow_3lib_TimestampType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_TimestampType) __PYX_ERR(6, 103, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_TimestampType = (struct __pyx_vtabstruct_7pyarrow_3lib_TimestampType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_TimestampType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_TimestampType)) __PYX_ERR(6, 103, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Time32Type = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Time32Type", sizeof(struct __pyx_obj_7pyarrow_3lib_Time32Type), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Time32Type) __PYX_ERR(6, 108, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Time32Type = (struct __pyx_vtabstruct_7pyarrow_3lib_Time32Type*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Time32Type->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Time32Type)) __PYX_ERR(6, 108, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Time64Type = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Time64Type", sizeof(struct __pyx_obj_7pyarrow_3lib_Time64Type), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Time64Type) __PYX_ERR(6, 113, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Time64Type = (struct __pyx_vtabstruct_7pyarrow_3lib_Time64Type*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Time64Type->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Time64Type)) __PYX_ERR(6, 113, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DurationType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DurationType", sizeof(struct __pyx_obj_7pyarrow_3lib_DurationType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DurationType) __PYX_ERR(6, 118, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_DurationType = (struct __pyx_vtabstruct_7pyarrow_3lib_DurationType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_DurationType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_DurationType)) __PYX_ERR(6, 118, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeBinaryType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeBinaryType", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryType) __PYX_ERR(6, 123, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryType = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryType)) __PYX_ERR(6, 123, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Decimal128Type = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Decimal128Type", sizeof(struct __pyx_obj_7pyarrow_3lib_Decimal128Type), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Decimal128Type) __PYX_ERR(6, 128, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Decimal128Type = (struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Type*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Decimal128Type->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Decimal128Type)) __PYX_ERR(6, 128, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_BaseExtensionType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "BaseExtensionType", sizeof(struct __pyx_obj_7pyarrow_3lib_BaseExtensionType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_BaseExtensionType) __PYX_ERR(6, 133, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_BaseExtensionType = (struct __pyx_vtabstruct_7pyarrow_3lib_BaseExtensionType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_BaseExtensionType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_BaseExtensionType)) __PYX_ERR(6, 133, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ExtensionType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ExtensionType", sizeof(struct __pyx_obj_7pyarrow_3lib_ExtensionType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ExtensionType) __PYX_ERR(6, 138, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ExtensionType = (struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ExtensionType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ExtensionType)) __PYX_ERR(6, 138, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_PyExtensionType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "PyExtensionType", sizeof(struct __pyx_obj_7pyarrow_3lib_PyExtensionType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_PyExtensionType) __PYX_ERR(6, 143, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_PyExtensionType = (struct __pyx_vtabstruct_7pyarrow_3lib_PyExtensionType*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_PyExtensionType->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_PyExtensionType)) __PYX_ERR(6, 143, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Field = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Field", sizeof(struct __pyx_obj_7pyarrow_3lib_Field), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Field) __PYX_ERR(6, 147, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Field = (struct __pyx_vtabstruct_7pyarrow_3lib_Field*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Field->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Field)) __PYX_ERR(6, 147, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Schema = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Schema", sizeof(struct __pyx_obj_7pyarrow_3lib_Schema), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Schema) __PYX_ERR(6, 158, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Schema = (struct __pyx_vtabstruct_7pyarrow_3lib_Schema*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Schema->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Schema)) __PYX_ERR(6, 158, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Scalar = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Scalar", sizeof(struct __pyx_obj_7pyarrow_3lib_Scalar), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Scalar) __PYX_ERR(6, 167, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_NAType = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "NAType", sizeof(struct __pyx_obj_7pyarrow_3lib_NAType), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_NAType) __PYX_ERR(6, 172, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ArrayValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ArrayValue", sizeof(struct __pyx_obj_7pyarrow_3lib_ArrayValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ArrayValue) __PYX_ERR(6, 176, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ArrayValue = (struct __pyx_vtabstruct_7pyarrow_3lib_ArrayValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ArrayValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ArrayValue)) __PYX_ERR(6, 176, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ScalarValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ScalarValue", sizeof(struct __pyx_obj_7pyarrow_3lib_ScalarValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ScalarValue) __PYX_ERR(6, 186, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ScalarValue = (struct __pyx_vtabstruct_7pyarrow_3lib_ScalarValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ScalarValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ScalarValue)) __PYX_ERR(6, 186, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int8Value = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int8Value", sizeof(struct __pyx_obj_7pyarrow_3lib_Int8Value), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int8Value) __PYX_ERR(6, 192, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int8Value = (struct __pyx_vtabstruct_7pyarrow_3lib_Int8Value*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int8Value->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int8Value)) __PYX_ERR(6, 192, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int64Value = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int64Value", sizeof(struct __pyx_obj_7pyarrow_3lib_Int64Value), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int64Value) __PYX_ERR(6, 196, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int64Value = (struct __pyx_vtabstruct_7pyarrow_3lib_Int64Value*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int64Value->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int64Value)) __PYX_ERR(6, 196, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ListValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ListValue", sizeof(struct __pyx_obj_7pyarrow_3lib_ListValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ListValue) __PYX_ERR(6, 200, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ListValue = (struct __pyx_vtabstruct_7pyarrow_3lib_ListValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ListValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ListValue)) __PYX_ERR(6, 200, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_LargeListValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "LargeListValue", sizeof(struct __pyx_obj_7pyarrow_3lib_LargeListValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_LargeListValue) __PYX_ERR(6, 211, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_LargeListValue = (struct __pyx_vtabstruct_7pyarrow_3lib_LargeListValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_LargeListValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_LargeListValue)) __PYX_ERR(6, 211, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_MapValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "MapValue", sizeof(struct __pyx_obj_7pyarrow_3lib_MapValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_MapValue) __PYX_ERR(6, 222, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_MapValue = (struct __pyx_vtabstruct_7pyarrow_3lib_MapValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_MapValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_MapValue)) __PYX_ERR(6, 222, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeListValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeListValue", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeListValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeListValue) __PYX_ERR(6, 234, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeListValue = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeListValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeListValue)) __PYX_ERR(6, 234, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_StructValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "StructValue", sizeof(struct __pyx_obj_7pyarrow_3lib_StructValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_StructValue) __PYX_ERR(6, 245, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_StructValue = (struct __pyx_vtabstruct_7pyarrow_3lib_StructValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_StructValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_StructValue)) __PYX_ERR(6, 245, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UnionValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UnionValue", sizeof(struct __pyx_obj_7pyarrow_3lib_UnionValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UnionValue) __PYX_ERR(6, 250, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UnionValue = (struct __pyx_vtabstruct_7pyarrow_3lib_UnionValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UnionValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UnionValue)) __PYX_ERR(6, 250, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_StringValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "StringValue", sizeof(struct __pyx_obj_7pyarrow_3lib_StringValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_StringValue) __PYX_ERR(6, 258, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_StringValue = (struct __pyx_vtabstruct_7pyarrow_3lib_StringValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_StringValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_StringValue)) __PYX_ERR(6, 258, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeBinaryValue = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeBinaryValue", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryValue), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryValue) __PYX_ERR(6, 262, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryValue = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryValue*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryValue->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryValue)) __PYX_ERR(6, 262, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib__PandasConvertible = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "_PandasConvertible", sizeof(struct __pyx_obj_7pyarrow_3lib__PandasConvertible), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib__PandasConvertible) __PYX_ERR(6, 266, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Array) __PYX_ERR(6, 270, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Array)) __PYX_ERR(6, 270, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Tensor = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Tensor", sizeof(struct __pyx_obj_7pyarrow_3lib_Tensor), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Tensor) __PYX_ERR(6, 286, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Tensor = (struct __pyx_vtabstruct_7pyarrow_3lib_Tensor*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Tensor->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Tensor)) __PYX_ERR(6, 286, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_SparseCSRMatrix = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "SparseCSRMatrix", sizeof(struct __pyx_obj_7pyarrow_3lib_SparseCSRMatrix), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_SparseCSRMatrix) __PYX_ERR(6, 297, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_SparseCSRMatrix = (struct __pyx_vtabstruct_7pyarrow_3lib_SparseCSRMatrix*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_SparseCSRMatrix->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_SparseCSRMatrix)) __PYX_ERR(6, 297, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_SparseCOOTensor = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "SparseCOOTensor", sizeof(struct __pyx_obj_7pyarrow_3lib_SparseCOOTensor), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_SparseCOOTensor) __PYX_ERR(6, 308, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_SparseCOOTensor = (struct __pyx_vtabstruct_7pyarrow_3lib_SparseCOOTensor*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_SparseCOOTensor->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_SparseCOOTensor)) __PYX_ERR(6, 308, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_NullArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "NullArray", sizeof(struct __pyx_obj_7pyarrow_3lib_NullArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_NullArray) __PYX_ERR(6, 319, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_NullArray = (struct __pyx_vtabstruct_7pyarrow_3lib_NullArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_NullArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_NullArray)) __PYX_ERR(6, 319, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_BooleanArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "BooleanArray", sizeof(struct __pyx_obj_7pyarrow_3lib_BooleanArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_BooleanArray) __PYX_ERR(6, 323, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_BooleanArray = (struct __pyx_vtabstruct_7pyarrow_3lib_BooleanArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_BooleanArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_BooleanArray)) __PYX_ERR(6, 323, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_NumericArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "NumericArray", sizeof(struct __pyx_obj_7pyarrow_3lib_NumericArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_NumericArray) __PYX_ERR(6, 327, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_NumericArray = (struct __pyx_vtabstruct_7pyarrow_3lib_NumericArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_NumericArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_NumericArray)) __PYX_ERR(6, 327, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_IntegerArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "IntegerArray", sizeof(struct __pyx_obj_7pyarrow_3lib_IntegerArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_IntegerArray) __PYX_ERR(6, 331, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_IntegerArray = (struct __pyx_vtabstruct_7pyarrow_3lib_IntegerArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_IntegerArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_IntegerArray)) __PYX_ERR(6, 331, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FloatingPointArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FloatingPointArray", sizeof(struct __pyx_obj_7pyarrow_3lib_FloatingPointArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FloatingPointArray) __PYX_ERR(6, 335, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FloatingPointArray = (struct __pyx_vtabstruct_7pyarrow_3lib_FloatingPointArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FloatingPointArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FloatingPointArray)) __PYX_ERR(6, 335, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int8Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int8Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Int8Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int8Array) __PYX_ERR(6, 339, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int8Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Int8Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int8Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int8Array)) __PYX_ERR(6, 339, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UInt8Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UInt8Array", sizeof(struct __pyx_obj_7pyarrow_3lib_UInt8Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UInt8Array) __PYX_ERR(6, 343, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UInt8Array = (struct __pyx_vtabstruct_7pyarrow_3lib_UInt8Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UInt8Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UInt8Array)) __PYX_ERR(6, 343, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int16Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int16Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Int16Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int16Array) __PYX_ERR(6, 347, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int16Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Int16Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int16Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int16Array)) __PYX_ERR(6, 347, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UInt16Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UInt16Array", sizeof(struct __pyx_obj_7pyarrow_3lib_UInt16Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UInt16Array) __PYX_ERR(6, 351, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UInt16Array = (struct __pyx_vtabstruct_7pyarrow_3lib_UInt16Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UInt16Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UInt16Array)) __PYX_ERR(6, 351, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int32Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int32Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Int32Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int32Array) __PYX_ERR(6, 355, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int32Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Int32Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int32Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int32Array)) __PYX_ERR(6, 355, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UInt32Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UInt32Array", sizeof(struct __pyx_obj_7pyarrow_3lib_UInt32Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UInt32Array) __PYX_ERR(6, 359, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UInt32Array = (struct __pyx_vtabstruct_7pyarrow_3lib_UInt32Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UInt32Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UInt32Array)) __PYX_ERR(6, 359, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Int64Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Int64Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Int64Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Int64Array) __PYX_ERR(6, 363, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Int64Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Int64Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Int64Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Int64Array)) __PYX_ERR(6, 363, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UInt64Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UInt64Array", sizeof(struct __pyx_obj_7pyarrow_3lib_UInt64Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UInt64Array) __PYX_ERR(6, 367, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UInt64Array = (struct __pyx_vtabstruct_7pyarrow_3lib_UInt64Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UInt64Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UInt64Array)) __PYX_ERR(6, 367, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_HalfFloatArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "HalfFloatArray", sizeof(struct __pyx_obj_7pyarrow_3lib_HalfFloatArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_HalfFloatArray) __PYX_ERR(6, 371, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_HalfFloatArray = (struct __pyx_vtabstruct_7pyarrow_3lib_HalfFloatArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_HalfFloatArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_HalfFloatArray)) __PYX_ERR(6, 371, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FloatArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FloatArray", sizeof(struct __pyx_obj_7pyarrow_3lib_FloatArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FloatArray) __PYX_ERR(6, 375, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FloatArray = (struct __pyx_vtabstruct_7pyarrow_3lib_FloatArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FloatArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FloatArray)) __PYX_ERR(6, 375, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DoubleArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DoubleArray", sizeof(struct __pyx_obj_7pyarrow_3lib_DoubleArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DoubleArray) __PYX_ERR(6, 379, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_DoubleArray = (struct __pyx_vtabstruct_7pyarrow_3lib_DoubleArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_DoubleArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_DoubleArray)) __PYX_ERR(6, 379, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeBinaryArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeBinaryArray", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeBinaryArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryArray) __PYX_ERR(6, 383, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryArray = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeBinaryArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeBinaryArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeBinaryArray)) __PYX_ERR(6, 383, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Decimal128Array = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Decimal128Array", sizeof(struct __pyx_obj_7pyarrow_3lib_Decimal128Array), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Decimal128Array) __PYX_ERR(6, 387, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Decimal128Array = (struct __pyx_vtabstruct_7pyarrow_3lib_Decimal128Array*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Decimal128Array->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Decimal128Array)) __PYX_ERR(6, 387, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_StructArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "StructArray", sizeof(struct __pyx_obj_7pyarrow_3lib_StructArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_StructArray) __PYX_ERR(6, 391, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_StructArray = (struct __pyx_vtabstruct_7pyarrow_3lib_StructArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_StructArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_StructArray)) __PYX_ERR(6, 391, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ListArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ListArray", sizeof(struct __pyx_obj_7pyarrow_3lib_ListArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ListArray) __PYX_ERR(6, 395, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ListArray = (struct __pyx_vtabstruct_7pyarrow_3lib_ListArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ListArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ListArray)) __PYX_ERR(6, 395, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_LargeListArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "LargeListArray", sizeof(struct __pyx_obj_7pyarrow_3lib_LargeListArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_LargeListArray) __PYX_ERR(6, 399, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_LargeListArray = (struct __pyx_vtabstruct_7pyarrow_3lib_LargeListArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_LargeListArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_LargeListArray)) __PYX_ERR(6, 399, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_MapArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "MapArray", sizeof(struct __pyx_obj_7pyarrow_3lib_MapArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_MapArray) __PYX_ERR(6, 403, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_MapArray = (struct __pyx_vtabstruct_7pyarrow_3lib_MapArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_MapArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_MapArray)) __PYX_ERR(6, 403, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_FixedSizeListArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "FixedSizeListArray", sizeof(struct __pyx_obj_7pyarrow_3lib_FixedSizeListArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_FixedSizeListArray) __PYX_ERR(6, 407, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_FixedSizeListArray = (struct __pyx_vtabstruct_7pyarrow_3lib_FixedSizeListArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_FixedSizeListArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_FixedSizeListArray)) __PYX_ERR(6, 407, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_UnionArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "UnionArray", sizeof(struct __pyx_obj_7pyarrow_3lib_UnionArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_UnionArray) __PYX_ERR(6, 411, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_UnionArray = (struct __pyx_vtabstruct_7pyarrow_3lib_UnionArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_UnionArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_UnionArray)) __PYX_ERR(6, 411, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_StringArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "StringArray", sizeof(struct __pyx_obj_7pyarrow_3lib_StringArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_StringArray) __PYX_ERR(6, 415, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_StringArray = (struct __pyx_vtabstruct_7pyarrow_3lib_StringArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_StringArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_StringArray)) __PYX_ERR(6, 415, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_BinaryArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "BinaryArray", sizeof(struct __pyx_obj_7pyarrow_3lib_BinaryArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_BinaryArray) __PYX_ERR(6, 419, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_BinaryArray = (struct __pyx_vtabstruct_7pyarrow_3lib_BinaryArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_BinaryArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_BinaryArray)) __PYX_ERR(6, 419, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_DictionaryArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "DictionaryArray", sizeof(struct __pyx_obj_7pyarrow_3lib_DictionaryArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_DictionaryArray) __PYX_ERR(6, 423, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_DictionaryArray = (struct __pyx_vtabstruct_7pyarrow_3lib_DictionaryArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_DictionaryArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_DictionaryArray)) __PYX_ERR(6, 423, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ExtensionArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ExtensionArray", sizeof(struct __pyx_obj_7pyarrow_3lib_ExtensionArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ExtensionArray) __PYX_ERR(6, 428, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ExtensionArray = (struct __pyx_vtabstruct_7pyarrow_3lib_ExtensionArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ExtensionArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ExtensionArray)) __PYX_ERR(6, 428, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ChunkedArray = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ChunkedArray", sizeof(struct __pyx_obj_7pyarrow_3lib_ChunkedArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ChunkedArray) __PYX_ERR(6, 439, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ChunkedArray = (struct __pyx_vtabstruct_7pyarrow_3lib_ChunkedArray*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ChunkedArray->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ChunkedArray)) __PYX_ERR(6, 439, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Table = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Table", sizeof(struct __pyx_obj_7pyarrow_3lib_Table), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Table) __PYX_ERR(6, 452, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Table = (struct __pyx_vtabstruct_7pyarrow_3lib_Table*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Table->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Table)) __PYX_ERR(6, 452, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_RecordBatch = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "RecordBatch", sizeof(struct __pyx_obj_7pyarrow_3lib_RecordBatch), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_RecordBatch) __PYX_ERR(6, 460, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_RecordBatch = (struct __pyx_vtabstruct_7pyarrow_3lib_RecordBatch*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_RecordBatch->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_RecordBatch)) __PYX_ERR(6, 460, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_Buffer = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "Buffer", sizeof(struct __pyx_obj_7pyarrow_3lib_Buffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_Buffer) __PYX_ERR(6, 469, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_Buffer = (struct __pyx_vtabstruct_7pyarrow_3lib_Buffer*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_Buffer)) __PYX_ERR(6, 469, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_ResizableBuffer = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "ResizableBuffer", sizeof(struct __pyx_obj_7pyarrow_3lib_ResizableBuffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_ResizableBuffer) __PYX_ERR(6, 479, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_ResizableBuffer = (struct __pyx_vtabstruct_7pyarrow_3lib_ResizableBuffer*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_ResizableBuffer->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_ResizableBuffer)) __PYX_ERR(6, 479, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_NativeFile = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "NativeFile", sizeof(struct __pyx_obj_7pyarrow_3lib_NativeFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_NativeFile) __PYX_ERR(6, 484, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_NativeFile = (struct __pyx_vtabstruct_7pyarrow_3lib_NativeFile*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_NativeFile->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_NativeFile)) __PYX_ERR(6, 484, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_BufferedInputStream = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "BufferedInputStream", sizeof(struct __pyx_obj_7pyarrow_3lib_BufferedInputStream), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_BufferedInputStream) __PYX_ERR(6, 508, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_BufferedInputStream = (struct __pyx_vtabstruct_7pyarrow_3lib_BufferedInputStream*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_BufferedInputStream->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_BufferedInputStream)) __PYX_ERR(6, 508, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_BufferedOutputStream = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "BufferedOutputStream", sizeof(struct __pyx_obj_7pyarrow_3lib_BufferedOutputStream), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_BufferedOutputStream) __PYX_ERR(6, 512, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_BufferedOutputStream = (struct __pyx_vtabstruct_7pyarrow_3lib_BufferedOutputStream*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_BufferedOutputStream->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_BufferedOutputStream)) __PYX_ERR(6, 512, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_CompressedInputStream = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "CompressedInputStream", sizeof(struct __pyx_obj_7pyarrow_3lib_CompressedInputStream), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_CompressedInputStream) __PYX_ERR(6, 516, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_CompressedInputStream = (struct __pyx_vtabstruct_7pyarrow_3lib_CompressedInputStream*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_CompressedInputStream->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_CompressedInputStream)) __PYX_ERR(6, 516, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_CompressedOutputStream = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "CompressedOutputStream", sizeof(struct __pyx_obj_7pyarrow_3lib_CompressedOutputStream), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_CompressedOutputStream) __PYX_ERR(6, 520, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_CompressedOutputStream = (struct __pyx_vtabstruct_7pyarrow_3lib_CompressedOutputStream*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_CompressedOutputStream->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_CompressedOutputStream)) __PYX_ERR(6, 520, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib__CRecordBatchReader = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "_CRecordBatchReader", sizeof(struct __pyx_obj_7pyarrow_3lib__CRecordBatchReader), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib__CRecordBatchReader) __PYX_ERR(6, 529, __pyx_L1_error)
  __pyx_ptype_7pyarrow_3lib_CastOptions = __Pyx_ImportType(__pyx_t_1, "pyarrow.lib", "CastOptions", sizeof(struct __pyx_obj_7pyarrow_3lib_CastOptions), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7pyarrow_3lib_CastOptions) __PYX_ERR(6, 534, __pyx_L1_error)
  __pyx_vtabptr_7pyarrow_3lib_CastOptions = (struct __pyx_vtabstruct_7pyarrow_3lib_CastOptions*)__Pyx_GetVtable(__pyx_ptype_7pyarrow_3lib_CastOptions->tp_dict); if (unlikely(!__pyx_vtabptr_7pyarrow_3lib_CastOptions)) __PYX_ERR(6, 534, __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;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("pyarrow.lib"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "check_status", (void (**)(void))&__pyx_f_7pyarrow_3lib_check_status, "int (arrow::Status const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_wrap_batch", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_wrap_batch, "PyObject *(std::shared_ptr< arrow::RecordBatch>  const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_wrap_buffer", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer, "PyObject *(std::shared_ptr< arrow::Buffer>  const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_wrap_schema", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_wrap_schema, "PyObject *(std::shared_ptr< arrow::Schema>  const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_wrap_table", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_wrap_table, "PyObject *(std::shared_ptr< arrow::Table>  const &)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_unwrap_buffer", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_unwrap_buffer, "std::shared_ptr< arrow::Buffer>  (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "pyarrow_unwrap_schema", (void (**)(void))&__pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema, "std::shared_ptr< arrow::Schema>  (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC init_flight(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC init_flight(void)
#else
__Pyx_PyMODINIT_FUNC PyInit__flight(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__flight(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__flight(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module '_flight' 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__flight(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #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("_flight", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_pyarrow___flight) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "pyarrow._flight")) {
      if (unlikely(PyDict_SetItemString(modules, "pyarrow._flight", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "pyarrow/_flight.pyx":23
 * from __future__ import absolute_import
 * 
 * import collections             # <<<<<<<<<<<<<<
 * import contextlib
 * import enum
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":24
 * 
 * import collections
 * import contextlib             # <<<<<<<<<<<<<<
 * import enum
 * import re
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_contextlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextlib, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":25
 * import collections
 * import contextlib
 * import enum             # <<<<<<<<<<<<<<
 * import re
 * import socket
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_enum, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":26
 * import contextlib
 * import enum
 * import re             # <<<<<<<<<<<<<<
 * import socket
 * import time
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":27
 * import enum
 * import re
 * import socket             # <<<<<<<<<<<<<<
 * import time
 * import threading
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_socket, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":28
 * import re
 * import socket
 * import time             # <<<<<<<<<<<<<<
 * import threading
 * import warnings
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":29
 * import socket
 * import time
 * import threading             # <<<<<<<<<<<<<<
 * import warnings
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":30
 * import time
 * import threading
 * import warnings             # <<<<<<<<<<<<<<
 * 
 * import six
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":32
 * import warnings
 * 
 * import six             # <<<<<<<<<<<<<<
 * 
 * from cython.operator cimport dereference as deref
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_six, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_six, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":37
 * from cython.operator cimport postincrement
 * 
 * from pyarrow.compat import frombytes, tobytes             # <<<<<<<<<<<<<<
 * from pyarrow.lib cimport *
 * from pyarrow.lib import ArrowException
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_frombytes);
  __Pyx_GIVEREF(__pyx_n_s_frombytes);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_frombytes);
  __Pyx_INCREF(__pyx_n_s_tobytes);
  __Pyx_GIVEREF(__pyx_n_s_tobytes);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_tobytes);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pyarrow_compat, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __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_frombytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_frombytes, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tobytes, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":39
 * from pyarrow.compat import frombytes, tobytes
 * from pyarrow.lib cimport *
 * from pyarrow.lib import ArrowException             # <<<<<<<<<<<<<<
 * from pyarrow.lib import as_buffer
 * from pyarrow.includes.libarrow_flight cimport *
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_ArrowException);
  __Pyx_GIVEREF(__pyx_n_s_ArrowException);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ArrowException);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pyarrow_lib, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __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_ArrowException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ArrowException, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":40
 * from pyarrow.lib cimport *
 * from pyarrow.lib import ArrowException
 * from pyarrow.lib import as_buffer             # <<<<<<<<<<<<<<
 * from pyarrow.includes.libarrow_flight cimport *
 * from pyarrow.ipc import _ReadPandasOption
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_as_buffer);
  __Pyx_GIVEREF(__pyx_n_s_as_buffer);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_as_buffer);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pyarrow_lib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __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_as_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_as_buffer, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":42
 * from pyarrow.lib import as_buffer
 * from pyarrow.includes.libarrow_flight cimport *
 * from pyarrow.ipc import _ReadPandasOption             # <<<<<<<<<<<<<<
 * import pyarrow.lib as lib
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_ReadPandasOption);
  __Pyx_GIVEREF(__pyx_n_s_ReadPandasOption);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ReadPandasOption);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pyarrow_ipc, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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_ReadPandasOption); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadPandasOption, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":43
 * from pyarrow.includes.libarrow_flight cimport *
 * from pyarrow.ipc import _ReadPandasOption
 * import pyarrow.lib as lib             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s__66);
  __Pyx_GIVEREF(__pyx_n_s__66);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__66);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pyarrow_lib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lib, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":78
 * 
 * 
 * _FLIGHT_SERVER_ERROR_REGEX = re.compile(             # <<<<<<<<<<<<<<
 *     r'Flight RPC failed with message: (.*). Detail: '
 *     r'Python exception: (.*)',
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":81
 *     r'Flight RPC failed with message: (.*). Detail: '
 *     r'Python exception: (.*)',
 *     re.DOTALL             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DOTALL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":78
 * 
 * 
 * _FLIGHT_SERVER_ERROR_REGEX = re.compile(             # <<<<<<<<<<<<<<
 *     r'Flight RPC failed with message: (.*). Detail: '
 *     r'Python exception: (.*)',
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u_Flight_RPC_failed_with_message_D);
  __Pyx_GIVEREF(__pyx_kp_u_Flight_RPC_failed_with_message_D);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Flight_RPC_failed_with_message_D);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLIGHT_SERVER_ERROR_REGEX, __pyx_t_3) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":85
 * 
 * 
 * def _munge_grpc_python_error(message):             # <<<<<<<<<<<<<<
 *     m = _FLIGHT_SERVER_ERROR_REGEX.match(message)
 *     if m:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_1_munge_grpc_python_error, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_munge_grpc_python_error, __pyx_t_3) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":123
 * 
 * 
 * _CertKeyPair = collections.namedtuple('_CertKeyPair', ['cert', 'key'])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_cert);
  __Pyx_GIVEREF(__pyx_n_u_cert);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_cert);
  __Pyx_INCREF(__pyx_n_u_key);
  __Pyx_GIVEREF(__pyx_n_u_key);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_key);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_CertKeyPair);
  __Pyx_GIVEREF(__pyx_n_u_CertKeyPair);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_CertKeyPair);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __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;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CertKeyPair, __pyx_t_3) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":126
 * 
 * 
 * class CertKeyPair(_CertKeyPair):             # <<<<<<<<<<<<<<
 *     """A TLS certificate and key for use in Flight."""
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CertKeyPair); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_CertKeyPair_2, __pyx_n_s_CertKeyPair_2, (PyObject *) NULL, __pyx_n_s_pyarrow__flight, __pyx_kp_s_A_TLS_certificate_and_key_for_us); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_CertKeyPair_2, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CertKeyPair_2, __pyx_t_4) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyarrow/_flight.pyx":138
 * 
 * 
 * cdef class FlightInternalError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusInternal, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_FlightInternalError);
  __Pyx_GIVEREF(__pyx_n_s_FlightInternalError);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_FlightInternalError);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyType_Type.tp_new(&PyType_Type, __pyx_t_2, NULL);
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (((PyTypeObject*) __pyx_t_1)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_1)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))->tp_name);
    __PYX_ERR(0, 138, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __pyx_type_7pyarrow_7_flight_FlightInternalError.tp_bases = PyTuple_GET_ITEM(__pyx_t_2, 1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_type_7pyarrow_7_flight_FlightInternalError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightInternalError) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightInternalError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightInternalError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightInternalError) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightInternalError) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightInternalError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightInternalError) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightInternalError) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightInternalError = &__pyx_type_7pyarrow_7_flight_FlightInternalError;

  /* "pyarrow/_flight.pyx":143
 * 
 * 
 * cdef class FlightTimedOutError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusTimedOut, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_FlightTimedOutError);
  __Pyx_GIVEREF(__pyx_n_s_FlightTimedOutError);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_FlightTimedOutError);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyType_Type.tp_new(&PyType_Type, __pyx_t_3, NULL);
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (((PyTypeObject*) __pyx_t_2)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_2)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))->tp_name);
    __PYX_ERR(0, 143, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
  __pyx_type_7pyarrow_7_flight_FlightTimedOutError.tp_bases = PyTuple_GET_ITEM(__pyx_t_3, 1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_type_7pyarrow_7_flight_FlightTimedOutError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightTimedOutError) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightTimedOutError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightTimedOutError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightTimedOutError) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightTimedOutError) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightTimedOutError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightTimedOutError) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightTimedOutError) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightTimedOutError = &__pyx_type_7pyarrow_7_flight_FlightTimedOutError;

  /* "pyarrow/_flight.pyx":148
 * 
 * 
 * cdef class FlightCancelledError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusCancelled, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FlightCancelledError);
  __Pyx_GIVEREF(__pyx_n_s_FlightCancelledError);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FlightCancelledError);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyType_Type.tp_new(&PyType_Type, __pyx_t_1, NULL);
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (((PyTypeObject*) __pyx_t_3)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_3)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))->tp_name);
    __PYX_ERR(0, 148, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __pyx_type_7pyarrow_7_flight_FlightCancelledError.tp_bases = PyTuple_GET_ITEM(__pyx_t_1, 1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_type_7pyarrow_7_flight_FlightCancelledError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightCancelledError) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightCancelledError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightCancelledError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightCancelledError) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightCancelledError) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightCancelledError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightCancelledError) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightCancelledError) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightCancelledError = &__pyx_type_7pyarrow_7_flight_FlightCancelledError;

  /* "pyarrow/_flight.pyx":153
 * 
 * 
 * cdef class FlightServerError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusFailed, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_FlightServerError);
  __Pyx_GIVEREF(__pyx_n_s_FlightServerError);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_FlightServerError);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyType_Type.tp_new(&PyType_Type, __pyx_t_2, NULL);
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (((PyTypeObject*) __pyx_t_1)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_1)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))->tp_name);
    __PYX_ERR(0, 153, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __pyx_type_7pyarrow_7_flight_FlightServerError.tp_bases = PyTuple_GET_ITEM(__pyx_t_2, 1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_type_7pyarrow_7_flight_FlightServerError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightServerError) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightServerError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightServerError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightServerError) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightServerError) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightServerError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightServerError) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightServerError) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightServerError = &__pyx_type_7pyarrow_7_flight_FlightServerError;

  /* "pyarrow/_flight.pyx":158
 * 
 * 
 * cdef class FlightUnauthenticatedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_FlightUnauthenticatedError);
  __Pyx_GIVEREF(__pyx_n_s_FlightUnauthenticatedError);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_FlightUnauthenticatedError);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyType_Type.tp_new(&PyType_Type, __pyx_t_3, NULL);
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (((PyTypeObject*) __pyx_t_2)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_2)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))->tp_name);
    __PYX_ERR(0, 158, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
  __pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError.tp_bases = PyTuple_GET_ITEM(__pyx_t_3, 1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightUnauthenticatedError) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightUnauthenticatedError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightUnauthenticatedError = &__pyx_type_7pyarrow_7_flight_FlightUnauthenticatedError;

  /* "pyarrow/_flight.pyx":164
 * 
 * 
 * cdef class FlightUnauthorizedError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnauthorized, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_FlightUnauthorizedError);
  __Pyx_GIVEREF(__pyx_n_s_FlightUnauthorizedError);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_FlightUnauthorizedError);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyType_Type.tp_new(&PyType_Type, __pyx_t_1, NULL);
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (((PyTypeObject*) __pyx_t_3)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_3)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))->tp_name);
    __PYX_ERR(0, 164, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __pyx_type_7pyarrow_7_flight_FlightUnauthorizedError.tp_bases = PyTuple_GET_ITEM(__pyx_t_1, 1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_type_7pyarrow_7_flight_FlightUnauthorizedError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightUnauthorizedError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightUnauthorizedError) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightUnauthorizedError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightUnauthorizedError = &__pyx_type_7pyarrow_7_flight_FlightUnauthorizedError;

  /* "pyarrow/_flight.pyx":169
 * 
 * 
 * cdef class FlightUnavailableError(FlightError, ArrowException):             # <<<<<<<<<<<<<<
 *     cdef CStatus to_status(self):
 *         return MakeFlightError(CFlightStatusUnavailable, tobytes(str(self)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ArrowException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightError));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_FlightUnavailableError);
  __Pyx_GIVEREF(__pyx_n_s_FlightUnavailableError);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_FlightUnavailableError);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyType_Type.tp_new(&PyType_Type, __pyx_t_2, NULL);
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (((PyTypeObject*) __pyx_t_1)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_1)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_2, 1), 0))->tp_name);
    __PYX_ERR(0, 169, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_2, 1));
  __pyx_type_7pyarrow_7_flight_FlightUnavailableError.tp_bases = PyTuple_GET_ITEM(__pyx_t_2, 1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_type_7pyarrow_7_flight_FlightUnavailableError.tp_base = __pyx_ptype_7pyarrow_7_flight_FlightError;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightUnavailableError) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightUnavailableError.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type_7pyarrow_7_flight_FlightUnavailableError.tp_dict, __pyx_vtabptr_7pyarrow_7_flight_FlightUnavailableError) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  if (__Pyx_MergeVtables(&__pyx_type_7pyarrow_7_flight_FlightUnavailableError) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightUnavailableError, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightUnavailableError) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightUnavailableError) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightUnavailableError = &__pyx_type_7pyarrow_7_flight_FlightUnavailableError;

  /* "pyarrow/_flight.pyx":208
 * 
 * 
 * _ActionType = collections.namedtuple('_ActionType', ['type', 'description'])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_type);
  __Pyx_GIVEREF(__pyx_n_u_type);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_type);
  __Pyx_INCREF(__pyx_n_u_description);
  __Pyx_GIVEREF(__pyx_n_u_description);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_description);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_ActionType_2);
  __Pyx_GIVEREF(__pyx_n_u_ActionType_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_ActionType_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ActionType_2, __pyx_t_2) < 0) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":211
 * 
 * 
 * class ActionType(_ActionType):             # <<<<<<<<<<<<<<
 *     """A type of action that is executable on a Flight service."""
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ActionType_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_ActionType, __pyx_n_s_ActionType, (PyObject *) NULL, __pyx_n_s_pyarrow__flight, __pyx_kp_s_A_type_of_action_that_is_executa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pyarrow/_flight.pyx":214
 *     """A type of action that is executable on a Flight service."""
 * 
 *     def make_action(self, buf):             # <<<<<<<<<<<<<<
 *         """Create an Action with this type.
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_10ActionType_1make_action, 0, __pyx_n_s_ActionType_make_action, NULL, __pyx_n_s_pyarrow__flight, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_make_action, __pyx_t_4) < 0) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyarrow/_flight.pyx":211
 * 
 * 
 * class ActionType(_ActionType):             # <<<<<<<<<<<<<<
 *     """A type of action that is executable on a Flight service."""
 * 
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ActionType, __pyx_t_3, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ActionType, __pyx_t_4) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":276
 * 
 *     @staticmethod
 *     def deserialize(string):             # <<<<<<<<<<<<<<
 *         auth = BasicAuth()
 *         check_flight_status(DeserializeBasicAuth(string, &auth.basic_auth))
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_9BasicAuth_3deserialize, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_BasicAuth->tp_dict, __pyx_n_s_deserialize, __pyx_t_3) < 0) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_BasicAuth);

  /* "pyarrow/_flight.pyx":275
 *         return self.basic_auth.get().password
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def deserialize(string):
 *         auth = BasicAuth()
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7pyarrow_7_flight_BasicAuth, __pyx_n_s_deserialize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_BasicAuth->tp_dict, __pyx_n_s_deserialize, __pyx_t_2) < 0) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_BasicAuth);

  /* "pyarrow/_flight.pyx":288
 * 
 * 
 * class DescriptorType(enum.Enum):             # <<<<<<<<<<<<<<
 *     """
 *     The type of a FlightDescriptor.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __pyx_n_s_DescriptorType, __pyx_n_s_DescriptorType, (PyObject *) NULL, __pyx_n_s_pyarrow__flight, __pyx_kp_s_The_type_of_a_FlightDescriptor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pyarrow/_flight.pyx":306
 *     """
 * 
 *     UNKNOWN = 0             # <<<<<<<<<<<<<<
 *     PATH = 1
 *     CMD = 2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_UNKNOWN, __pyx_int_0) < 0) __PYX_ERR(0, 306, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":307
 * 
 *     UNKNOWN = 0
 *     PATH = 1             # <<<<<<<<<<<<<<
 *     CMD = 2
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_PATH, __pyx_int_1) < 0) __PYX_ERR(0, 307, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":308
 *     UNKNOWN = 0
 *     PATH = 1
 *     CMD = 2             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_CMD, __pyx_int_2) < 0) __PYX_ERR(0, 308, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":288
 * 
 * 
 * class DescriptorType(enum.Enum):             # <<<<<<<<<<<<<<
 *     """
 *     The type of a FlightDescriptor.
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_DescriptorType, __pyx_t_2, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DescriptorType, __pyx_t_4) < 0) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":311
 * 
 * 
 * class FlightMethod(enum.Enum):             # <<<<<<<<<<<<<<
 *     """The implemented methods in Flight."""
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __pyx_n_s_FlightMethod, __pyx_n_s_FlightMethod, (PyObject *) NULL, __pyx_n_s_pyarrow__flight, __pyx_kp_s_The_implemented_methods_in_Fligh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pyarrow/_flight.pyx":314
 *     """The implemented methods in Flight."""
 * 
 *     INVALID = 0             # <<<<<<<<<<<<<<
 *     HANDSHAKE = 1
 *     LIST_FLIGHTS = 2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_INVALID, __pyx_int_0) < 0) __PYX_ERR(0, 314, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":315
 * 
 *     INVALID = 0
 *     HANDSHAKE = 1             # <<<<<<<<<<<<<<
 *     LIST_FLIGHTS = 2
 *     GET_FLIGHT_INFO = 3
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_HANDSHAKE, __pyx_int_1) < 0) __PYX_ERR(0, 315, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":316
 *     INVALID = 0
 *     HANDSHAKE = 1
 *     LIST_FLIGHTS = 2             # <<<<<<<<<<<<<<
 *     GET_FLIGHT_INFO = 3
 *     GET_SCHEMA = 4
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_LIST_FLIGHTS, __pyx_int_2) < 0) __PYX_ERR(0, 316, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":317
 *     HANDSHAKE = 1
 *     LIST_FLIGHTS = 2
 *     GET_FLIGHT_INFO = 3             # <<<<<<<<<<<<<<
 *     GET_SCHEMA = 4
 *     DO_GET = 5
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_GET_FLIGHT_INFO, __pyx_int_3) < 0) __PYX_ERR(0, 317, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":318
 *     LIST_FLIGHTS = 2
 *     GET_FLIGHT_INFO = 3
 *     GET_SCHEMA = 4             # <<<<<<<<<<<<<<
 *     DO_GET = 5
 *     DO_PUT = 6
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_GET_SCHEMA, __pyx_int_4) < 0) __PYX_ERR(0, 318, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":319
 *     GET_FLIGHT_INFO = 3
 *     GET_SCHEMA = 4
 *     DO_GET = 5             # <<<<<<<<<<<<<<
 *     DO_PUT = 6
 *     DO_ACTION = 7
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DO_GET, __pyx_int_5) < 0) __PYX_ERR(0, 319, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":320
 *     GET_SCHEMA = 4
 *     DO_GET = 5
 *     DO_PUT = 6             # <<<<<<<<<<<<<<
 *     DO_ACTION = 7
 *     LIST_ACTIONS = 8
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DO_PUT, __pyx_int_6) < 0) __PYX_ERR(0, 320, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":321
 *     DO_GET = 5
 *     DO_PUT = 6
 *     DO_ACTION = 7             # <<<<<<<<<<<<<<
 *     LIST_ACTIONS = 8
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_DO_ACTION, __pyx_int_7) < 0) __PYX_ERR(0, 321, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":322
 *     DO_PUT = 6
 *     DO_ACTION = 7
 *     LIST_ACTIONS = 8             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_LIST_ACTIONS, __pyx_int_8) < 0) __PYX_ERR(0, 322, __pyx_L1_error)

  /* "pyarrow/_flight.pyx":311
 * 
 * 
 * class FlightMethod(enum.Enum):             # <<<<<<<<<<<<<<
 *     """The implemented methods in Flight."""
 * 
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_FlightMethod, __pyx_t_2, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FlightMethod, __pyx_t_4) < 0) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":357
 * 
 *     @staticmethod
 *     def for_path(*path):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for a resource path."""
 *         cdef FlightDescriptor result = \
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_16FlightDescriptor_3for_path, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor->tp_dict, __pyx_n_s_for_path, __pyx_t_2) < 0) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightDescriptor);

  /* "pyarrow/_flight.pyx":356
 *                         .format(self.__class__.__name__))
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def for_path(*path):
 *         """Create a FlightDescriptor for a resource path."""
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor, __pyx_n_s_for_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor->tp_dict, __pyx_n_s_for_path, __pyx_t_3) < 0) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightDescriptor);

  /* "pyarrow/_flight.pyx":366
 * 
 *     @staticmethod
 *     def for_command(command):             # <<<<<<<<<<<<<<
 *         """Create a FlightDescriptor for an opaque command."""
 *         cdef FlightDescriptor result = \
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_16FlightDescriptor_5for_command, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor->tp_dict, __pyx_n_s_for_command, __pyx_t_3) < 0) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightDescriptor);

  /* "pyarrow/_flight.pyx":365
 *         return result
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def for_command(command):
 *         """Create a FlightDescriptor for an opaque command."""
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor, __pyx_n_s_for_command); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor->tp_dict, __pyx_n_s_for_command, __pyx_t_2) < 0) __PYX_ERR(0, 366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightDescriptor);

  /* "pyarrow/_flight.pyx":426
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor, __pyx_n_s_deserialize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pyarrow/_flight.pyx":425
 *         return out
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def deserialize(cls, serialized):
 *         """Parse the wire-format representation of this type.
 */
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightDescriptor->tp_dict, __pyx_n_s_deserialize, __pyx_t_3) < 0) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightDescriptor);

  /* "pyarrow/_flight.pyx":468
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7pyarrow_7_flight_Ticket, __pyx_n_s_deserialize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pyarrow/_flight.pyx":467
 *         return out
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def deserialize(cls, serialized):
 *         """Parse the wire-format representation of this type.
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Ticket->tp_dict, __pyx_n_s_deserialize, __pyx_t_2) < 0) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Ticket);

  /* "pyarrow/_flight.pyx":515
 * 
 *     @staticmethod
 *     def for_grpc_tcp(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TCP-based gRPC service."""
 *         cdef:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_8Location_9for_grpc_tcp, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_tcp, __pyx_t_2) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":514
 *         return self.location.Equals((<Location> other).location)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def for_grpc_tcp(host, port):
 *         """Create a Location for a TCP-based gRPC service."""
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_7pyarrow_7_flight_Location, __pyx_n_s_for_grpc_tcp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_tcp, __pyx_t_3) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":526
 * 
 *     @staticmethod
 *     def for_grpc_tls(host, port):             # <<<<<<<<<<<<<<
 *         """Create a Location for a TLS-based gRPC service."""
 *         cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_8Location_11for_grpc_tls, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_tls, __pyx_t_3) < 0) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":525
 *         return result
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def for_grpc_tls(host, port):
 *         """Create a Location for a TLS-based gRPC service."""
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7pyarrow_7_flight_Location, __pyx_n_s_for_grpc_tls); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_tls, __pyx_t_2) < 0) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":537
 * 
 *     @staticmethod
 *     def for_grpc_unix(path):             # <<<<<<<<<<<<<<
 *         """Create a Location for a domain socket-based gRPC service."""
 *         cdef:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_8Location_13for_grpc_unix, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_unix, __pyx_t_2) < 0) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":536
 *         return result
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def for_grpc_unix(path):
 *         """Create a Location for a domain socket-based gRPC service."""
 */
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_7pyarrow_7_flight_Location, __pyx_n_s_for_grpc_unix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_Location->tp_dict, __pyx_n_s_for_grpc_unix, __pyx_t_3) < 0) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_Location);

  /* "pyarrow/_flight.pyx":741
 * 
 *     @classmethod
 *     def deserialize(cls, serialized):             # <<<<<<<<<<<<<<
 *         """Parse the wire-format representation of this type.
 * 
 */
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightInfo, __pyx_n_s_deserialize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pyarrow/_flight.pyx":740
 *         return out
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def deserialize(cls, serialized):
 *         """Parse the wire-format representation of this type.
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightInfo->tp_dict, __pyx_n_s_deserialize, __pyx_t_2) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightInfo);

  /* "pyarrow/_flight.pyx":789
 * 
 * cdef class MetadataRecordBatchReader(_MetadataRecordBatchReader,
 *                                      _ReadPandasOption):             # <<<<<<<<<<<<<<
 *     """A reader for Flight streams."""
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadPandasOption); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "pyarrow/_flight.pyx":788
 * 
 * 
 * cdef class MetadataRecordBatchReader(_MetadataRecordBatchReader,             # <<<<<<<<<<<<<<
 *                                      _ReadPandasOption):
 *     """A reader for Flight streams."""
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_MetadataRecordBatchReader_2);
  __Pyx_GIVEREF(__pyx_n_s_MetadataRecordBatchReader_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MetadataRecordBatchReader_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyType_Type.tp_new(&PyType_Type, __pyx_t_1, NULL);
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (((PyTypeObject*) __pyx_t_2)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))) {
    PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
                 ((PyTypeObject*) __pyx_t_2)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_1, 1), 0))->tp_name);
    __PYX_ERR(0, 788, __pyx_L1_error)
  }
  __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_1, 1));
  __pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader.tp_bases = PyTuple_GET_ITEM(__pyx_t_1, 1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader.tp_base = __pyx_ptype_7pyarrow_7_flight__MetadataRecordBatchReader;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader) < 0) __PYX_ERR(0, 788, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader.tp_print = 0;
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MetadataRecordBatchReader_2, (PyObject *)&__pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader) < 0) __PYX_ERR(0, 788, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader) < 0) __PYX_ERR(0, 788, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_MetadataRecordBatchReader = &__pyx_type_7pyarrow_7_flight_MetadataRecordBatchReader;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.reader cannot be converted to a Python object for pickling")
 */
  __pyx_type_7pyarrow_7_flight_FlightStreamReader.tp_base = __pyx_ptype_7pyarrow_7_flight_MetadataRecordBatchReader;
  if (__Pyx_PyType_Ready(&__pyx_type_7pyarrow_7_flight_FlightStreamReader) < 0) __PYX_ERR(0, 832, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7pyarrow_7_flight_FlightStreamReader.tp_print = 0;
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FlightStreamReader, (PyObject *)&__pyx_type_7pyarrow_7_flight_FlightStreamReader) < 0) __PYX_ERR(0, 832, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7pyarrow_7_flight_FlightStreamReader) < 0) __PYX_ERR(0, 832, __pyx_L1_error)
  __pyx_ptype_7pyarrow_7_flight_FlightStreamReader = &__pyx_type_7pyarrow_7_flight_FlightStreamReader;

  /* "pyarrow/_flight.pyx":989
 * 
 *     @classmethod
 *     def connect(cls, location, tls_root_certs=None, override_hostname=None):             # <<<<<<<<<<<<<<
 *         warnings.warn("The 'FlightClient.connect' method is deprecated, use "
 *                       "FlightClient constructor or pyarrow.flight.connect "
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightClient, __pyx_n_s_connect); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "pyarrow/_flight.pyx":988
 *                 break
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def connect(cls, location, tls_root_certs=None, override_hostname=None):
 *         warnings.warn("The 'FlightClient.connect' method is deprecated, use "
 */
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7pyarrow_7_flight_FlightClient->tp_dict, __pyx_n_s_connect, __pyx_t_2) < 0) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_7pyarrow_7_flight_FlightClient);

  /* "pyarrow/_flight.pyx":1889
 * 
 * 
 * _CallInfo = collections.namedtuple("_CallInfo", ["method"])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_method);
  __Pyx_GIVEREF(__pyx_n_u_method);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_method);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_CallInfo_2);
  __Pyx_GIVEREF(__pyx_n_u_CallInfo_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_CallInfo_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CallInfo_2, __pyx_t_2) < 0) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyarrow/_flight.pyx":1892
 * 
 * 
 * class CallInfo(_CallInfo):             # <<<<<<<<<<<<<<
 *     """Information about a particular RPC for Flight middleware."""
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CallInfo_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_CallInfo, __pyx_n_s_CallInfo, (PyObject *) NULL, __pyx_n_s_pyarrow__flight, __pyx_kp_s_Information_about_a_particular_R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_CallInfo, __pyx_t_3, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CallInfo, __pyx_t_4) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":2282
 * 
 * 
 * def connect(location, tls_root_certs=None, override_hostname=None,             # <<<<<<<<<<<<<<
 *             middleware=None):
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_3connect, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_connect, __pyx_t_3) < 0) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_5__pyx_unpickle_FlightError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightError, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightError__set_state(<FlightError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightError__set_state(FlightError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_7__pyx_unpickle_FlightInternalError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightInternalErr, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightTimedOutError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_9__pyx_unpickle_FlightTimedOutError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightTimedOutErr, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightTimedOutError__set_state(<FlightTimedOutError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightTimedOutError__set_state(FlightTimedOutError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_11__pyx_unpickle_FlightCancelledError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightCancelledEr, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightServerError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_13__pyx_unpickle_FlightServerError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightServerError, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightServerError__set_state(<FlightServerError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightServerError__set_state(FlightServerError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_15__pyx_unpickle_FlightUnauthenticatedError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightUnauthentic, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightUnauthorizedError(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_17__pyx_unpickle_FlightUnauthorizedError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightUnauthorize, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightUnauthorizedError__set_state(<FlightUnauthorizedError> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightUnauthorizedError__set_state(FlightUnauthorizedError __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_19__pyx_unpickle_FlightUnavailableError, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightUnavailable, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_FlightDataStream(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_21__pyx_unpickle_FlightDataStream, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_FlightDataStream, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_FlightDataStream__set_state(<FlightDataStream> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_FlightDataStream__set_state(FlightDataStream __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_23__pyx_unpickle_RecordBatchStream, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_RecordBatchStream, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_ServerAuthHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_25__pyx_unpickle_ServerAuthHandler, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ServerAuthHandler, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_ServerAuthHandler__set_state(<ServerAuthHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerAuthHandler__set_state(ServerAuthHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_27__pyx_unpickle_ClientAuthHandler, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ClientAuthHandler, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_ClientMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_29__pyx_unpickle_ClientMiddlewareFactory, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ClientMiddlewareF, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_ClientMiddlewareFactory__set_state(<ClientMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ClientMiddlewareFactory__set_state(ClientMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_31__pyx_unpickle_ClientMiddleware, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ClientMiddleware, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_ServerMiddlewareFactory(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_33__pyx_unpickle_ServerMiddlewareFactory, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ServerMiddlewareF, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_ServerMiddlewareFactory__set_state(<ServerMiddlewareFactory> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ServerMiddlewareFactory__set_state(ServerMiddlewareFactory __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_35__pyx_unpickle_ServerMiddleware, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ServerMiddleware, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle__ServerMiddlewareFactoryWrapper(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_37__pyx_unpickle__ServerMiddlewareFactoryWrapper, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__ServerMiddleware, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(<_ServerMiddlewareFactoryWrapper> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ServerMiddlewareFactoryWrapper__set_state(_ServerMiddlewareFactoryWrapper __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.factories = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7pyarrow_7_flight_39__pyx_unpickle__ServerMiddlewareWrapper, NULL, __pyx_n_s_pyarrow__flight); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__ServerMiddleware_2, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pyarrow/_flight.pyx":1
 * # Licensed to the Apache Software Foundation (ASF) under one             # <<<<<<<<<<<<<<
 * # or more contributor license agreements.  See the NOTICE file
 * # distributed with this work for additional information
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_string")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_string(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pyarrow._flight", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pyarrow._flight");
  }
  __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;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

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

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

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

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

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

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

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

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

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

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

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

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

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

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

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

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

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

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

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

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

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

/* 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;
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

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

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

/* 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 (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;
}

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

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

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

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

/* 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);
  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_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
            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;
            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_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
                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;
            }
            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;
}

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

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* PyType_Ready */
static int __Pyx_PyType_Ready(PyTypeObject *t) {
    int r;
    PyObject *bases = t->tp_bases;
    if (bases)
    {
        Py_ssize_t i, n = PyTuple_GET_SIZE(bases);
        for (i = 1; i < n; i++)
        {
            PyObject *b0 = PyTuple_GET_ITEM(bases, i);
            PyTypeObject *b;
#if PY_MAJOR_VERSION < 3
            if (PyClass_Check(b0))
            {
                PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
                             PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
                return -1;
            }
#endif
            b = (PyTypeObject*)b0;
            if (!PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
            {
                PyErr_Format(PyExc_TypeError, "base class '%.200s' is not a heap type",
                             b->tp_name);
                return -1;
            }
            if (t->tp_dictoffset == 0 && b->tp_dictoffset)
            {
                PyErr_Format(PyExc_TypeError,
                    "extension type '%.200s' has no __dict__ slot, but base type '%.200s' has: "
                    "either add 'cdef dict __dict__' to the extension type "
                    "or add '__slots__ = [...]' to the base type",
                    t->tp_name, b->tp_name);
                return -1;
            }
        }
    }
#if PY_VERSION_HEX >= 0x03050000
    t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#endif
    r = PyType_Ready(t);
#if PY_VERSION_HEX >= 0x03050000
    t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
#endif
    return r;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i;
    void** base_vtables;
    void* unknown = (void*)-1;
    PyObject* bases = type->tp_bases;
    int base_depth = 0;
    {
        PyTypeObject* base = type->tp_base;
        while (base) {
            base_depth += 1;
            base = base->tp_base;
        }
    }
    base_vtables = (void**) malloc(sizeof(void*) * (base_depth + 1));
    base_vtables[0] = unknown;
    for (i = 1; i < PyTuple_GET_SIZE(bases); i++) {
        void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))->tp_dict);
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = type->tp_base;
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base->tp_dict);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = base->tp_base;
            }
        }
    }
    PyErr_Clear();
    free(base_vtables);
    return 0;
bad:
    PyErr_Format(
        PyExc_TypeError,
        "multiple bases have vtable conflict: '%s' and '%s'",
        type->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(bases, i))->tp_name);
    free(base_vtables);
    return -1;
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
#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
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    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)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(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
};
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;
    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);
}

/* GetNameInClass */
static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
    PyObject *result;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result) {
        result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
    }
    return result;
}

/* ClassMethod */
static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY
    if (PyMethodDescr_Check(method))
#else
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (__Pyx_TypeCheck(method, methoddescr_type))
#endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#ifdef __Pyx_CyFunction_USED
    else if (__Pyx_CyFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#endif
    PyErr_SetString(PyExc_TypeError,
                   "Class-level classmethod() can only be called on "
                   "a method_descriptor or instance method.");
    return NULL;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(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;
        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 = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    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;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
    const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* None */
static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) {
  int err;
  #ifdef WITH_THREAD
  PyGILState_STATE _save = PyGILState_Ensure();
  #endif
  err = !!PyErr_Occurred();
  #ifdef WITH_THREAD
  PyGILState_Release(_save);
  #endif
  return err;
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
    const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

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

/* 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;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #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;
}
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 = _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 = _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 = _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_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 (self->ob_refcnt > 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);
    self->ob_refcnt = 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(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, 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 __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;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

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

/* 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},
    {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
};
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;
}

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

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