static PyObject *__pyx_pf_17clickhouse_driver_14bufferedreader_14BufferedReader_8read_strings(struct __pyx_obj_17clickhouse_driver_14bufferedreader_BufferedReader *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_n_items, PyObject *__pyx_v_encoding) {
  PyObject *__pyx_v_items = NULL;
  unsigned PY_LONG_LONG __pyx_v_i;
  char *__pyx_v_buffer_ptr;
  unsigned PY_LONG_LONG __pyx_v_right;
  unsigned PY_LONG_LONG __pyx_v_size;
  unsigned PY_LONG_LONG __pyx_v_shift;
  unsigned PY_LONG_LONG __pyx_v_bytes_read;
  unsigned PY_LONG_LONG __pyx_v_b;
  char *__pyx_v_c_string;
  unsigned PY_LONG_LONG __pyx_v_c_string_size;
  char *__pyx_v_c_encoding;
  PyObject *__pyx_v_rv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  unsigned PY_LONG_LONG __pyx_t_6;
  unsigned PY_LONG_LONG __pyx_t_7;
  unsigned PY_LONG_LONG __pyx_t_8;
  unsigned PY_LONG_LONG __pyx_t_9;
  unsigned PY_LONG_LONG __pyx_t_10;
  unsigned PY_LONG_LONG __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_strings", 0);
  __Pyx_INCREF(__pyx_v_encoding);

  /* "clickhouse_driver/bufferedreader.pyx":67
 *         We inline strings reading logic here to avoid this overhead.
 *         """
 *         items = PyTuple_New(n_items)             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned long long i
 */
  __pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "clickhouse_driver/bufferedreader.pyx":71
 *         cdef unsigned long long i
 *         # Buffer vars
 *         cdef char* buffer_ptr = PyByteArray_AsString(self.buffer)             # <<<<<<<<<<<<<<
 *         cdef unsigned long long right
 *         # String length vars
 */
  __pyx_t_1 = __pyx_v_self->buffer;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "clickhouse_driver/bufferedreader.pyx":78
 * 
 *         # String for decode vars.
 *         cdef char *c_string = NULL             # <<<<<<<<<<<<<<
 *         cdef unsigned long long c_string_size = 1024
 *         cdef char *c_encoding = NULL
 */
  __pyx_v_c_string = NULL;

  /* "clickhouse_driver/bufferedreader.pyx":79
 *         # String for decode vars.
 *         cdef char *c_string = NULL
 *         cdef unsigned long long c_string_size = 1024             # <<<<<<<<<<<<<<
 *         cdef char *c_encoding = NULL
 *         if encoding:
 */
  __pyx_v_c_string_size = 0x400;

  /* "clickhouse_driver/bufferedreader.pyx":80
 *         cdef char *c_string = NULL
 *         cdef unsigned long long c_string_size = 1024
 *         cdef char *c_encoding = NULL             # <<<<<<<<<<<<<<
 *         if encoding:
 *             encoding = encoding.encode('utf-8')
 */
  __pyx_v_c_encoding = NULL;

  /* "clickhouse_driver/bufferedreader.pyx":81
 *         cdef unsigned long long c_string_size = 1024
 *         cdef char *c_encoding = NULL
 *         if encoding:             # <<<<<<<<<<<<<<
 *             encoding = encoding.encode('utf-8')
 *             c_encoding = encoding
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "clickhouse_driver/bufferedreader.pyx":82
 *         cdef char *c_encoding = NULL
 *         if encoding:
 *             encoding = encoding.encode('utf-8')             # <<<<<<<<<<<<<<
 *             c_encoding = encoding
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "clickhouse_driver/bufferedreader.pyx":83
 *         if encoding:
 *             encoding = encoding.encode('utf-8')
 *             c_encoding = encoding             # <<<<<<<<<<<<<<
 * 
 *         cdef object rv = object()
 */
    __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
    __pyx_v_c_encoding = __pyx_t_5;

    /* "clickhouse_driver/bufferedreader.pyx":81
 *         cdef unsigned long long c_string_size = 1024
 *         cdef char *c_encoding = NULL
 *         if encoding:             # <<<<<<<<<<<<<<
 *             encoding = encoding.encode('utf-8')
 *             c_encoding = encoding
 */
  }

  /* "clickhouse_driver/bufferedreader.pyx":85
 *             c_encoding = encoding
 * 
 *         cdef object rv = object()             # <<<<<<<<<<<<<<
 *         # String for decode vars.
 *         if c_encoding:
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "clickhouse_driver/bufferedreader.pyx":87
 *         cdef object rv = object()
 *         # String for decode vars.
 *         if c_encoding:             # <<<<<<<<<<<<<<
 *             c_string = <char *> PyMem_Realloc(NULL, c_string_size)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_encoding != 0);
  if (__pyx_t_2) {

    /* "clickhouse_driver/bufferedreader.pyx":88
 *         # String for decode vars.
 *         if c_encoding:
 *             c_string = <char *> PyMem_Realloc(NULL, c_string_size)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n_items):
 */
    __pyx_v_c_string = ((char *)PyMem_Realloc(NULL, __pyx_v_c_string_size));

    /* "clickhouse_driver/bufferedreader.pyx":87
 *         cdef object rv = object()
 *         # String for decode vars.
 *         if c_encoding:             # <<<<<<<<<<<<<<
 *             c_string = <char *> PyMem_Realloc(NULL, c_string_size)
 * 
 */
  }

  /* "clickhouse_driver/bufferedreader.pyx":90
 *             c_string = <char *> PyMem_Realloc(NULL, c_string_size)
 * 
 *         for i in range(n_items):             # <<<<<<<<<<<<<<
 *             shift = size = 0
 * 
 */
  __pyx_t_6 = __pyx_v_n_items;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "clickhouse_driver/bufferedreader.pyx":91
 * 
 *         for i in range(n_items):
 *             shift = size = 0             # <<<<<<<<<<<<<<
 * 
 *             # Read string size
 */
    __pyx_v_shift = 0;
    __pyx_v_size = 0;

    /* "clickhouse_driver/bufferedreader.pyx":94
 * 
 *             # Read string size
 *             while True:             # <<<<<<<<<<<<<<
 *                 if self.position == self.current_buffer_size:
 *                     self.read_into_buffer()
 */
    while (1) {

      /* "clickhouse_driver/bufferedreader.pyx":95
 *             # Read string size
 *             while True:
 *                 if self.position == self.current_buffer_size:             # <<<<<<<<<<<<<<
 *                     self.read_into_buffer()
 *                     # `read_into_buffer` can override buffer
 */
      __pyx_t_2 = ((__pyx_v_self->position == __pyx_v_self->current_buffer_size) != 0);
      if (__pyx_t_2) {

        /* "clickhouse_driver/bufferedreader.pyx":96
 *             while True:
 *                 if self.position == self.current_buffer_size:
 *                     self.read_into_buffer()             # <<<<<<<<<<<<<<
 *                     # `read_into_buffer` can override buffer
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_into_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __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;

        /* "clickhouse_driver/bufferedreader.pyx":98
 *                     self.read_into_buffer()
 *                     # `read_into_buffer` can override buffer
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)             # <<<<<<<<<<<<<<
 *                     self.position = 0
 * 
 */
        __pyx_t_1 = __pyx_v_self->buffer;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "clickhouse_driver/bufferedreader.pyx":99
 *                     # `read_into_buffer` can override buffer
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)
 *                     self.position = 0             # <<<<<<<<<<<<<<
 * 
 *                 b = buffer_ptr[self.position]
 */
        __pyx_v_self->position = 0;

        /* "clickhouse_driver/bufferedreader.pyx":95
 *             # Read string size
 *             while True:
 *                 if self.position == self.current_buffer_size:             # <<<<<<<<<<<<<<
 *                     self.read_into_buffer()
 *                     # `read_into_buffer` can override buffer
 */
      }

      /* "clickhouse_driver/bufferedreader.pyx":101
 *                     self.position = 0
 * 
 *                 b = buffer_ptr[self.position]             # <<<<<<<<<<<<<<
 *                 self.position += 1
 * 
 */
      __pyx_v_b = (__pyx_v_buffer_ptr[__pyx_v_self->position]);

      /* "clickhouse_driver/bufferedreader.pyx":102
 * 
 *                 b = buffer_ptr[self.position]
 *                 self.position += 1             # <<<<<<<<<<<<<<
 * 
 *                 size |= (b & 0x7f) << shift
 */
      __pyx_v_self->position = (__pyx_v_self->position + 1);

      /* "clickhouse_driver/bufferedreader.pyx":104
 *                 self.position += 1
 * 
 *                 size |= (b & 0x7f) << shift             # <<<<<<<<<<<<<<
 *                 if b < 0x80:
 *                     break
 */
      __pyx_v_size = (__pyx_v_size | ((__pyx_v_b & 0x7f) << __pyx_v_shift));

      /* "clickhouse_driver/bufferedreader.pyx":105
 * 
 *                 size |= (b & 0x7f) << shift
 *                 if b < 0x80:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
      __pyx_t_2 = ((__pyx_v_b < 0x80) != 0);
      if (__pyx_t_2) {

        /* "clickhouse_driver/bufferedreader.pyx":106
 *                 size |= (b & 0x7f) << shift
 *                 if b < 0x80:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 shift += 7
 */
        goto __pyx_L8_break;

        /* "clickhouse_driver/bufferedreader.pyx":105
 * 
 *                 size |= (b & 0x7f) << shift
 *                 if b < 0x80:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
      }

      /* "clickhouse_driver/bufferedreader.pyx":108
 *                     break
 * 
 *                 shift += 7             # <<<<<<<<<<<<<<
 * 
 *             right = self.position + size
 */
      __pyx_v_shift = (__pyx_v_shift + 7);
    }
    __pyx_L8_break:;

    /* "clickhouse_driver/bufferedreader.pyx":110
 *                 shift += 7
 * 
 *             right = self.position + size             # <<<<<<<<<<<<<<
 * 
 *             if c_encoding:
 */
    __pyx_v_right = (__pyx_v_self->position + __pyx_v_size);

    /* "clickhouse_driver/bufferedreader.pyx":112
 *             right = self.position + size
 * 
 *             if c_encoding:             # <<<<<<<<<<<<<<
 *                 if size + 1 > c_string_size:
 *                     c_string_size = size + 1
 */
    __pyx_t_2 = (__pyx_v_c_encoding != 0);
    if (__pyx_t_2) {

      /* "clickhouse_driver/bufferedreader.pyx":113
 * 
 *             if c_encoding:
 *                 if size + 1 > c_string_size:             # <<<<<<<<<<<<<<
 *                     c_string_size = size + 1
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 */
      __pyx_t_2 = (((__pyx_v_size + 1) > __pyx_v_c_string_size) != 0);
      if (__pyx_t_2) {

        /* "clickhouse_driver/bufferedreader.pyx":114
 *             if c_encoding:
 *                 if size + 1 > c_string_size:
 *                     c_string_size = size + 1             # <<<<<<<<<<<<<<
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 *                     if c_string is NULL:
 */
        __pyx_v_c_string_size = (__pyx_v_size + 1);

        /* "clickhouse_driver/bufferedreader.pyx":115
 *                 if size + 1 > c_string_size:
 *                     c_string_size = size + 1
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)             # <<<<<<<<<<<<<<
 *                     if c_string is NULL:
 *                         raise MemoryError()
 */
        __pyx_v_c_string = ((char *)PyMem_Realloc(__pyx_v_c_string, __pyx_v_c_string_size));

        /* "clickhouse_driver/bufferedreader.pyx":116
 *                     c_string_size = size + 1
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 *                     if c_string is NULL:             # <<<<<<<<<<<<<<
 *                         raise MemoryError()
 *                 c_string[size] = 0
 */
        __pyx_t_2 = ((__pyx_v_c_string == NULL) != 0);
        if (unlikely(__pyx_t_2)) {

          /* "clickhouse_driver/bufferedreader.pyx":117
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 *                     if c_string is NULL:
 *                         raise MemoryError()             # <<<<<<<<<<<<<<
 *                 c_string[size] = 0
 *                 bytes_read = 0
 */
          PyErr_NoMemory(); __PYX_ERR(0, 117, __pyx_L1_error)

          /* "clickhouse_driver/bufferedreader.pyx":116
 *                     c_string_size = size + 1
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 *                     if c_string is NULL:             # <<<<<<<<<<<<<<
 *                         raise MemoryError()
 *                 c_string[size] = 0
 */
        }

        /* "clickhouse_driver/bufferedreader.pyx":113
 * 
 *             if c_encoding:
 *                 if size + 1 > c_string_size:             # <<<<<<<<<<<<<<
 *                     c_string_size = size + 1
 *                     c_string = <char *> PyMem_Realloc(c_string, c_string_size)
 */
      }

      /* "clickhouse_driver/bufferedreader.pyx":118
 *                     if c_string is NULL:
 *                         raise MemoryError()
 *                 c_string[size] = 0             # <<<<<<<<<<<<<<
 *                 bytes_read = 0
 * 
 */
      (__pyx_v_c_string[__pyx_v_size]) = 0;

      /* "clickhouse_driver/bufferedreader.pyx":119
 *                         raise MemoryError()
 *                 c_string[size] = 0
 *                 bytes_read = 0             # <<<<<<<<<<<<<<
 * 
 *             # Decoding pure c strings in Cython is faster than in pure Python.
 */
      __pyx_v_bytes_read = 0;

      /* "clickhouse_driver/bufferedreader.pyx":112
 *             right = self.position + size
 * 
 *             if c_encoding:             # <<<<<<<<<<<<<<
 *                 if size + 1 > c_string_size:
 *                     c_string_size = size + 1
 */
    }

    /* "clickhouse_driver/bufferedreader.pyx":124
 *             # We need to copy it into buffer for adding null symbol at the end.
 *             # In ClickHouse block there is no null
 *             if right > self.current_buffer_size:             # <<<<<<<<<<<<<<
 *                 if c_encoding:
 *                     memcpy(&c_string[bytes_read], &buffer_ptr[self.position],
 */
    __pyx_t_2 = ((__pyx_v_right > __pyx_v_self->current_buffer_size) != 0);
    if (__pyx_t_2) {

      /* "clickhouse_driver/bufferedreader.pyx":125
 *             # In ClickHouse block there is no null
 *             if right > self.current_buffer_size:
 *                 if c_encoding:             # <<<<<<<<<<<<<<
 *                     memcpy(&c_string[bytes_read], &buffer_ptr[self.position],
 *                            self.current_buffer_size - self.position)
 */
      __pyx_t_2 = (__pyx_v_c_encoding != 0);
      if (__pyx_t_2) {

        /* "clickhouse_driver/bufferedreader.pyx":126
 *             if right > self.current_buffer_size:
 *                 if c_encoding:
 *                     memcpy(&c_string[bytes_read], &buffer_ptr[self.position],             # <<<<<<<<<<<<<<
 *                            self.current_buffer_size - self.position)
 *                 else:
 */
        (void)(memcpy((&(__pyx_v_c_string[__pyx_v_bytes_read])), (&(__pyx_v_buffer_ptr[__pyx_v_self->position])), (__pyx_v_self->current_buffer_size - __pyx_v_self->position)));

        /* "clickhouse_driver/bufferedreader.pyx":125
 *             # In ClickHouse block there is no null
 *             if right > self.current_buffer_size:
 *                 if c_encoding:             # <<<<<<<<<<<<<<
 *                     memcpy(&c_string[bytes_read], &buffer_ptr[self.position],
 *                            self.current_buffer_size - self.position)
 */
        goto __pyx_L15;
      }

      /* "clickhouse_driver/bufferedreader.pyx":129
 *                            self.current_buffer_size - self.position)
 *                 else:
 *                     rv = PyBytes_FromStringAndSize(             # <<<<<<<<<<<<<<
 *                         &buffer_ptr[self.position],
 *                         self.current_buffer_size - self.position
 */
      /*else*/ {

        /* "clickhouse_driver/bufferedreader.pyx":131
 *                     rv = PyBytes_FromStringAndSize(
 *                         &buffer_ptr[self.position],
 *                         self.current_buffer_size - self.position             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
        __pyx_t_1 = PyBytes_FromStringAndSize((&(__pyx_v_buffer_ptr[__pyx_v_self->position])), (__pyx_v_self->current_buffer_size - __pyx_v_self->position)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_1);
        __pyx_t_1 = 0;
      }
      __pyx_L15:;

      /* "clickhouse_driver/bufferedreader.pyx":134
 *                     )
 * 
 *                 bytes_read = self.current_buffer_size - self.position             # <<<<<<<<<<<<<<
 *                 # Read the rest of the string.
 *                 while bytes_read != size:
 */
      __pyx_v_bytes_read = (__pyx_v_self->current_buffer_size - __pyx_v_self->position);

      /* "clickhouse_driver/bufferedreader.pyx":136
 *                 bytes_read = self.current_buffer_size - self.position
 *                 # Read the rest of the string.
 *                 while bytes_read != size:             # <<<<<<<<<<<<<<
 *                     self.position = size - bytes_read
 * 
 */
      while (1) {
        __pyx_t_2 = ((__pyx_v_bytes_read != __pyx_v_size) != 0);
        if (!__pyx_t_2) break;

        /* "clickhouse_driver/bufferedreader.pyx":137
 *                 # Read the rest of the string.
 *                 while bytes_read != size:
 *                     self.position = size - bytes_read             # <<<<<<<<<<<<<<
 * 
 *                     self.read_into_buffer()
 */
        __pyx_v_self->position = (__pyx_v_size - __pyx_v_bytes_read);

        /* "clickhouse_driver/bufferedreader.pyx":139
 *                     self.position = size - bytes_read
 * 
 *                     self.read_into_buffer()             # <<<<<<<<<<<<<<
 *                     # `read_into_buffer` can override buffer
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_into_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __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;

        /* "clickhouse_driver/bufferedreader.pyx":141
 *                     self.read_into_buffer()
 *                     # `read_into_buffer` can override buffer
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)             # <<<<<<<<<<<<<<
 *                     # There can be not enough data in buffer.
 *                     self.position = min(
 */
        __pyx_t_1 = __pyx_v_self->buffer;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "clickhouse_driver/bufferedreader.pyx":144
 *                     # There can be not enough data in buffer.
 *                     self.position = min(
 *                         self.position, self.current_buffer_size             # <<<<<<<<<<<<<<
 *                     )
 *                     if c_encoding:
 */
        __pyx_t_9 = __pyx_v_self->current_buffer_size;
        __pyx_t_10 = __pyx_v_self->position;
        if (((__pyx_t_9 < __pyx_t_10) != 0)) {
          __pyx_t_11 = __pyx_t_9;
        } else {
          __pyx_t_11 = __pyx_t_10;
        }

        /* "clickhouse_driver/bufferedreader.pyx":143
 *                     buffer_ptr = PyByteArray_AsString(self.buffer)
 *                     # There can be not enough data in buffer.
 *                     self.position = min(             # <<<<<<<<<<<<<<
 *                         self.position, self.current_buffer_size
 *                     )
 */
        __pyx_v_self->position = __pyx_t_11;

        /* "clickhouse_driver/bufferedreader.pyx":146
 *                         self.position, self.current_buffer_size
 *                     )
 *                     if c_encoding:             # <<<<<<<<<<<<<<
 *                         memcpy(
 *                             &c_string[bytes_read], buffer_ptr, self.position
 */
        __pyx_t_2 = (__pyx_v_c_encoding != 0);
        if (__pyx_t_2) {

          /* "clickhouse_driver/bufferedreader.pyx":147
 *                     )
 *                     if c_encoding:
 *                         memcpy(             # <<<<<<<<<<<<<<
 *                             &c_string[bytes_read], buffer_ptr, self.position
 *                         )
 */
          (void)(memcpy((&(__pyx_v_c_string[__pyx_v_bytes_read])), __pyx_v_buffer_ptr, __pyx_v_self->position));

          /* "clickhouse_driver/bufferedreader.pyx":146
 *                         self.position, self.current_buffer_size
 *                     )
 *                     if c_encoding:             # <<<<<<<<<<<<<<
 *                         memcpy(
 *                             &c_string[bytes_read], buffer_ptr, self.position
 */
          goto __pyx_L18;
        }

        /* "clickhouse_driver/bufferedreader.pyx":151
 *                         )
 *                     else:
 *                         rv += PyBytes_FromStringAndSize(             # <<<<<<<<<<<<<<
 *                             buffer_ptr, self.position
 *                         )
 */
        /*else*/ {

          /* "clickhouse_driver/bufferedreader.pyx":152
 *                     else:
 *                         rv += PyBytes_FromStringAndSize(
 *                             buffer_ptr, self.position             # <<<<<<<<<<<<<<
 *                         )
 *                     bytes_read += self.position
 */
          __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_buffer_ptr, __pyx_v_self->position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);

          /* "clickhouse_driver/bufferedreader.pyx":151
 *                         )
 *                     else:
 *                         rv += PyBytes_FromStringAndSize(             # <<<<<<<<<<<<<<
 *                             buffer_ptr, self.position
 *                         )
 */
          __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_rv, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
          __pyx_t_3 = 0;
        }
        __pyx_L18:;

        /* "clickhouse_driver/bufferedreader.pyx":154
 *                             buffer_ptr, self.position
 *                         )
 *                     bytes_read += self.position             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
        __pyx_v_bytes_read = (__pyx_v_bytes_read + __pyx_v_self->position);
      }

      /* "clickhouse_driver/bufferedreader.pyx":124
 *             # We need to copy it into buffer for adding null symbol at the end.
 *             # In ClickHouse block there is no null
 *             if right > self.current_buffer_size:             # <<<<<<<<<<<<<<
 *                 if c_encoding:
 *                     memcpy(&c_string[bytes_read], &buffer_ptr[self.position],
 */
      goto __pyx_L14;
    }

    /* "clickhouse_driver/bufferedreader.pyx":157
 * 
 *             else:
 *                 if c_encoding:             # <<<<<<<<<<<<<<
 *                     memcpy(c_string, &buffer_ptr[self.position], size)
 *                 else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_c_encoding != 0);
      if (__pyx_t_2) {

        /* "clickhouse_driver/bufferedreader.pyx":158
 *             else:
 *                 if c_encoding:
 *                     memcpy(c_string, &buffer_ptr[self.position], size)             # <<<<<<<<<<<<<<
 *                 else:
 *                     rv = PyBytes_FromStringAndSize(
 */
        (void)(memcpy(__pyx_v_c_string, (&(__pyx_v_buffer_ptr[__pyx_v_self->position])), __pyx_v_size));

        /* "clickhouse_driver/bufferedreader.pyx":157
 * 
 *             else:
 *                 if c_encoding:             # <<<<<<<<<<<<<<
 *                     memcpy(c_string, &buffer_ptr[self.position], size)
 *                 else:
 */
        goto __pyx_L19;
      }

      /* "clickhouse_driver/bufferedreader.pyx":160
 *                     memcpy(c_string, &buffer_ptr[self.position], size)
 *                 else:
 *                     rv = PyBytes_FromStringAndSize(             # <<<<<<<<<<<<<<
 *                         &buffer_ptr[self.position], size
 *                     )
 */
      /*else*/ {

        /* "clickhouse_driver/bufferedreader.pyx":161
 *                 else:
 *                     rv = PyBytes_FromStringAndSize(
 *                         &buffer_ptr[self.position], size             # <<<<<<<<<<<<<<
 *                     )
 *                 self.position = right
 */
        __pyx_t_3 = PyBytes_FromStringAndSize((&(__pyx_v_buffer_ptr[__pyx_v_self->position])), __pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L19:;

      /* "clickhouse_driver/bufferedreader.pyx":163
 *                         &buffer_ptr[self.position], size
 *                     )
 *                 self.position = right             # <<<<<<<<<<<<<<
 * 
 *             if c_encoding:
 */
      __pyx_v_self->position = __pyx_v_right;
    }
    __pyx_L14:;

    /* "clickhouse_driver/bufferedreader.pyx":165
 *                 self.position = right
 * 
 *             if c_encoding:             # <<<<<<<<<<<<<<
 *                 try:
 *                     rv = c_string[:size].decode(c_encoding)
 */
    __pyx_t_2 = (__pyx_v_c_encoding != 0);
    if (__pyx_t_2) {

      /* "clickhouse_driver/bufferedreader.pyx":166
 * 
 *             if c_encoding:
 *                 try:             # <<<<<<<<<<<<<<
 *                     rv = c_string[:size].decode(c_encoding)
 *                 except UnicodeDecodeError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "clickhouse_driver/bufferedreader.pyx":167
 *             if c_encoding:
 *                 try:
 *                     rv = c_string[:size].decode(c_encoding)             # <<<<<<<<<<<<<<
 *                 except UnicodeDecodeError:
 *                     rv = PyBytes_FromStringAndSize(c_string, size)
 */
          __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_c_string, 0, __pyx_v_size, __pyx_v_c_encoding, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "clickhouse_driver/bufferedreader.pyx":166
 * 
 *             if c_encoding:
 *                 try:             # <<<<<<<<<<<<<<
 *                     rv = c_string[:size].decode(c_encoding)
 *                 except UnicodeDecodeError:
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L28_try_end;
        __pyx_L21_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "clickhouse_driver/bufferedreader.pyx":168
 *                 try:
 *                     rv = c_string[:size].decode(c_encoding)
 *                 except UnicodeDecodeError:             # <<<<<<<<<<<<<<
 *                     rv = PyBytes_FromStringAndSize(c_string, size)
 * 
 */
        __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_15) {
          __Pyx_AddTraceback("clickhouse_driver.bufferedreader.BufferedReader.read_strings", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 168, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);

          /* "clickhouse_driver/bufferedreader.pyx":169
 *                     rv = c_string[:size].decode(c_encoding)
 *                 except UnicodeDecodeError:
 *                     rv = PyBytes_FromStringAndSize(c_string, size)             # <<<<<<<<<<<<<<
 * 
 *             Py_INCREF(rv)
 */
          __pyx_t_16 = PyBytes_FromStringAndSize(__pyx_v_c_string, __pyx_v_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 169, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_16);
          __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L22_exception_handled;
        }
        goto __pyx_L23_except_error;
        __pyx_L23_except_error:;

        /* "clickhouse_driver/bufferedreader.pyx":166
 * 
 *             if c_encoding:
 *                 try:             # <<<<<<<<<<<<<<
 *                     rv = c_string[:size].decode(c_encoding)
 *                 except UnicodeDecodeError:
 */
        __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);
        goto __pyx_L1_error;
        __pyx_L22_exception_handled:;
        __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_L28_try_end:;
      }

      /* "clickhouse_driver/bufferedreader.pyx":165
 *                 self.position = right
 * 
 *             if c_encoding:             # <<<<<<<<<<<<<<
 *                 try:
 *                     rv = c_string[:size].decode(c_encoding)
 */
    }

    /* "clickhouse_driver/bufferedreader.pyx":171
 *                     rv = PyBytes_FromStringAndSize(c_string, size)
 * 
 *             Py_INCREF(rv)             # <<<<<<<<<<<<<<
 *             PyTuple_SET_ITEM(items, i, rv)
 * 
 */
    Py_INCREF(__pyx_v_rv);

    /* "clickhouse_driver/bufferedreader.pyx":172
 * 
 *             Py_INCREF(rv)
 *             PyTuple_SET_ITEM(items, i, rv)             # <<<<<<<<<<<<<<
 * 
 *         if c_string:
 */
    PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_rv);
  }

  /* "clickhouse_driver/bufferedreader.pyx":174
 *             PyTuple_SET_ITEM(items, i, rv)
 * 
 *         if c_string:             # <<<<<<<<<<<<<<
 *             PyMem_Free(c_string)
 * 
 */
  __pyx_t_2 = (__pyx_v_c_string != 0);
  if (__pyx_t_2) {

    /* "clickhouse_driver/bufferedreader.pyx":175
 * 
 *         if c_string:
 *             PyMem_Free(c_string)             # <<<<<<<<<<<<<<
 * 
 *         return items
 */
    PyMem_Free(__pyx_v_c_string);

    /* "clickhouse_driver/bufferedreader.pyx":174
 *             PyTuple_SET_ITEM(items, i, rv)
 * 
 *         if c_string:             # <<<<<<<<<<<<<<
 *             PyMem_Free(c_string)
 * 
 */
  }

  /* "clickhouse_driver/bufferedreader.pyx":177
 *             PyMem_Free(c_string)
 * 
 *         return items             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_items);
  __pyx_r = __pyx_v_items;
  goto __pyx_L0;

  /* "clickhouse_driver/bufferedreader.pyx":62
 *         return rv
 * 
 *     def read_strings(self, unsigned long long n_items, encoding=None):             # <<<<<<<<<<<<<<
 *         """
 *         Python has great overhead between function calls.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("clickhouse_driver.bufferedreader.BufferedReader.read_strings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_pf_17clickhouse_driver_14bufferedreader_14BufferedReader_8read_strings(struct __pyx_obj_17clickhouse_driver_14bufferedreader_BufferedReader *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_n_items, PyObject *__pyx_v_encoding) {
  PyObject *__pyx_v_items = NULL;
  unsigned PY_LONG_LONG __pyx_v_i;
  char *__pyx_v_buffer_ptr;
  unsigned PY_LONG_LONG __pyx_v_right;
  unsigned PY_LONG_LONG __pyx_v_size;
  unsigned PY_LONG_LONG __pyx_v_shift;
  unsigned PY_LONG_LONG __pyx_v_bytes_read;
  unsigned PY_LONG_LONG __pyx_v_b;
  char *__pyx_v_c_string;
  unsigned PY_LONG_LONG __pyx_v_c_string_size;
  char *__pyx_v_c_encoding;
  PyObject *__pyx_v_rv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  unsigned PY_LONG_LONG __pyx_t_6;
  unsigned PY_LONG_LONG __pyx_t_7;
  unsigned PY_LONG_LONG __pyx_t_8;
  unsigned PY_LONG_LONG __pyx_t_9;
  unsigned PY_LONG_LONG __pyx_t_10;
  unsigned PY_LONG_LONG __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_strings", 0);
  __Pyx_INCREF(__pyx_v_encoding);

   
  __pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_items = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

   
  __pyx_t_1 = __pyx_v_self->buffer;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

   
  __pyx_v_c_string = NULL;

   
  __pyx_v_c_string_size = 0x400;

   
  __pyx_v_c_encoding = NULL;

   
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
  if (__pyx_t_2) {

     
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_1);
    __pyx_t_1 = 0;

     
    __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
    __pyx_v_c_encoding = __pyx_t_5;

     
  }

   
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

   
  __pyx_t_2 = (__pyx_v_c_encoding != 0);
  if (__pyx_t_2) {

     
    __pyx_v_c_string = ((char *)PyMem_Realloc(NULL, __pyx_v_c_string_size));

     
  }

   
  __pyx_t_6 = __pyx_v_n_items;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

     
    __pyx_v_shift = 0;
    __pyx_v_size = 0;

     
    while (1) {

       
      __pyx_t_2 = ((__pyx_v_self->position == __pyx_v_self->current_buffer_size) != 0);
      if (__pyx_t_2) {

         
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_into_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __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;

         
        __pyx_t_1 = __pyx_v_self->buffer;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

         
        __pyx_v_self->position = 0;

         
      }

       
      __pyx_v_b = (__pyx_v_buffer_ptr[__pyx_v_self->position]);

       
      __pyx_v_self->position = (__pyx_v_self->position + 1);

       
      __pyx_v_size = (__pyx_v_size | ((__pyx_v_b & 0x7f) << __pyx_v_shift));

       
      __pyx_t_2 = ((__pyx_v_b < 0x80) != 0);
      if (__pyx_t_2) {

         
        goto __pyx_L8_break;

         
      }

       
      __pyx_v_shift = (__pyx_v_shift + 7);
    }
    __pyx_L8_break:;

     
    __pyx_v_right = (__pyx_v_self->position + __pyx_v_size);

     
    __pyx_t_2 = (__pyx_v_c_encoding != 0);
    if (__pyx_t_2) {

       
      __pyx_t_2 = (((__pyx_v_size + 1) > __pyx_v_c_string_size) != 0);
      if (__pyx_t_2) {

         
        __pyx_v_c_string_size = (__pyx_v_size + 1);

         
        __pyx_v_c_string = ((char *)PyMem_Realloc(__pyx_v_c_string, __pyx_v_c_string_size));

         
        __pyx_t_2 = ((__pyx_v_c_string == NULL) != 0);
        if (unlikely(__pyx_t_2)) {

           
          PyErr_NoMemory(); __PYX_ERR(0, 117, __pyx_L1_error)

           
        }

         
      }

       
      (__pyx_v_c_string[__pyx_v_size]) = 0;

       
      __pyx_v_bytes_read = 0;

       
    }

     
    __pyx_t_2 = ((__pyx_v_right > __pyx_v_self->current_buffer_size) != 0);
    if (__pyx_t_2) {

       
      __pyx_t_2 = (__pyx_v_c_encoding != 0);
      if (__pyx_t_2) {

         
        (void)(memcpy((&(__pyx_v_c_string[__pyx_v_bytes_read])), (&(__pyx_v_buffer_ptr[__pyx_v_self->position])), (__pyx_v_self->current_buffer_size - __pyx_v_self->position)));

         
        goto __pyx_L15;
      }

       
        {

         
        __pyx_t_1 = PyBytes_FromStringAndSize((&(__pyx_v_buffer_ptr[__pyx_v_self->position])), (__pyx_v_self->current_buffer_size - __pyx_v_self->position)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_1);
        __pyx_t_1 = 0;
      }
      __pyx_L15:;

       
      __pyx_v_bytes_read = (__pyx_v_self->current_buffer_size - __pyx_v_self->position);

       
      while (1) {
        __pyx_t_2 = ((__pyx_v_bytes_read != __pyx_v_size) != 0);
        if (!__pyx_t_2) break;

         
        __pyx_v_self->position = (__pyx_v_size - __pyx_v_bytes_read);

         
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_into_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __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;

         
        __pyx_t_1 = __pyx_v_self->buffer;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_v_buffer_ptr = PyByteArray_AsString(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

         
        __pyx_t_9 = __pyx_v_self->current_buffer_size;
        __pyx_t_10 = __pyx_v_self->position;
        if (((__pyx_t_9 < __pyx_t_10) != 0)) {
          __pyx_t_11 = __pyx_t_9;
        } else {
          __pyx_t_11 = __pyx_t_10;
        }

         
        __pyx_v_self->position = __pyx_t_11;

         
        __pyx_t_2 = (__pyx_v_c_encoding != 0);
        if (__pyx_t_2) {

           
          (void)(memcpy((&(__pyx_v_c_string[__pyx_v_bytes_read])), __pyx_v_buffer_ptr, __pyx_v_self->position));

           
          goto __pyx_L18;
        }

         
          {

           
          __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_buffer_ptr, __pyx_v_self->position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);

           
          __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_rv, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
          __pyx_t_3 = 0;
        }
        __pyx_L18:;

         
        __pyx_v_bytes_read = (__pyx_v_bytes_read + __pyx_v_self->position);
      }

       
      goto __pyx_L14;
    }

     
      {
      __pyx_t_2 = (__pyx_v_c_encoding != 0);
      if (__pyx_t_2) {

         
        (void)(memcpy(__pyx_v_c_string, (&(__pyx_v_buffer_ptr[__pyx_v_self->position])), __pyx_v_size));

         
        goto __pyx_L19;
      }

       
        {

         
        __pyx_t_3 = PyBytes_FromStringAndSize((&(__pyx_v_buffer_ptr[__pyx_v_self->position])), __pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L19:;

       
      __pyx_v_self->position = __pyx_v_right;
    }
    __pyx_L14:;

     
    __pyx_t_2 = (__pyx_v_c_encoding != 0);
    if (__pyx_t_2) {

       
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
          {

           
          __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_c_string, 0, __pyx_v_size, __pyx_v_c_encoding, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_3);
          __pyx_t_3 = 0;

           
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L28_try_end;
        __pyx_L21_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

         
        __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
        if (__pyx_t_15) {
          __Pyx_AddTraceback("clickhouse_driver.bufferedreader.BufferedReader.read_strings", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 168, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);

           
          __pyx_t_16 = PyBytes_FromStringAndSize(__pyx_v_c_string, __pyx_v_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 169, __pyx_L23_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_16);
          __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L22_exception_handled;
        }
        goto __pyx_L23_except_error;
        __pyx_L23_except_error:;

         
        __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);
        goto __pyx_L1_error;
        __pyx_L22_exception_handled:;
        __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_L28_try_end:;
      }

       
    }

     
    Py_INCREF(__pyx_v_rv);

     
    PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_rv);
  }

   
  __pyx_t_2 = (__pyx_v_c_string != 0);
  if (__pyx_t_2) {

     
    PyMem_Free(__pyx_v_c_string);

     
  }

   
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_items);
  __pyx_r = __pyx_v_items;
  goto __pyx_L0;

   

   
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("clickhouse_driver.bufferedreader.BufferedReader.read_strings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}