/* Generated by Pyrex 0.9.8.5 on Thu Nov 25 16:59:32 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)	PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "python-compat.h"
#include "stdlib.h"
#include "string.h"
#include "_static_tuple_c.h"


typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static char __pyx_mdoc[] = "Pyrex extensions to btree node parsing.";

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

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

static PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i); /*proto*/

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

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

static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/

static PyObject *__Pyx_ImportModule(char *name); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from bzrlib._static_tuple_c */

static PyTypeObject *__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = 0;

/* Declarations from bzrlib._btree_serializer_pyx */


/* Declarations from implementation of bzrlib._btree_serializer_pyx */

struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser {
  PyObject_HEAD
  struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_vtab;
  PyObject *bytes;
  int key_length;
  int ref_list_length;
  PyObject *keys;
  char *_cur_str;
  char *_end_str;
  char *_start;
  int _header_found;
};


struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser {
  PyObject *(*extract_key)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *,char *);
  int (*process_line)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *);
};
static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser;

static PyTypeObject *__pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = 0;
static void *__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(void *,int,size_t); /*proto*/
static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(char *,Py_ssize_t); /*proto*/
static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(char *,Py_ssize_t); /*proto*/

static char __pyx_k1[] = "tried to create a string with an invalid size: %d @0x%x";
static char __pyx_k2[] = "invalid key, wanted segment from ";
static char __pyx_k3[] = "sha1:";
static char __pyx_k4[] = "last < self._start";
static char __pyx_k5[] = "type=leaf";
static char __pyx_k6[] = "Node did not start with \"type=leaf\": %r";
static char __pyx_k7[] = "Failed to find the value area";
static char __pyx_k8[] = " 0 0";
static char __pyx_k9[] = "invalid key, loop_counter != self.ref_list_length";
static char __pyx_k10[] = "unexpected reference data present";
static char __pyx_k11[] = "self.bytes is not a string.";
static char __pyx_k12[] = "parse";
static char __pyx_k13[] = "We expected a tuple() or StaticTuple() for node not: %s";
static char __pyx_k14[] = "With ref_lists, we expected 4 entries not: %s";
static char __pyx_k15[] = "Without ref_lists, we need at least 3 entries not: %s";
static char __pyx_k16[] = "\0";
static char __pyx_k17[] = "join";
static char __pyx_k18[] = "We expect references to be tuples not: %s";
static char __pyx_k19[] = "We expect reference bits to be strings not: %s";
static char __pyx_k20[] = "Expected a plain str for value not: %s";
static char __pyx_k21[] = "bzrlib";
static char __pyx_k22[] = "_static_tuple_c";

static PyObject *__pyx_n__static_tuple_c;
static PyObject *__pyx_n_bzrlib;
static PyObject *__pyx_n_join;
static PyObject *__pyx_n_parse;

static PyObject *__pyx_k1p;
static PyObject *__pyx_k2p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k6p;
static PyObject *__pyx_k7p;
static PyObject *__pyx_k9p;
static PyObject *__pyx_k10p;
static PyObject *__pyx_k11p;
static PyObject *__pyx_k13p;
static PyObject *__pyx_k14p;
static PyObject *__pyx_k15p;
static PyObject *__pyx_k16p;
static PyObject *__pyx_k18p;
static PyObject *__pyx_k19p;
static PyObject *__pyx_k20p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n__static_tuple_c, 1, __pyx_k22, sizeof(__pyx_k22)},
  {&__pyx_n_bzrlib, 1, __pyx_k21, sizeof(__pyx_k21)},
  {&__pyx_n_join, 1, __pyx_k17, sizeof(__pyx_k17)},
  {&__pyx_n_parse, 1, __pyx_k12, sizeof(__pyx_k12)},
  {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_k2p, 0, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_k6p, 0, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_k7p, 0, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_k9p, 0, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_k10p, 0, __pyx_k10, sizeof(__pyx_k10)},
  {&__pyx_k11p, 0, __pyx_k11, sizeof(__pyx_k11)},
  {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_k14p, 0, __pyx_k14, sizeof(__pyx_k14)},
  {&__pyx_k15p, 0, __pyx_k15, sizeof(__pyx_k15)},
  {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
  {&__pyx_k18p, 0, __pyx_k18, sizeof(__pyx_k18)},
  {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
  {&__pyx_k20p, 0, __pyx_k20, sizeof(__pyx_k20)},
  {0, 0, 0, 0}
};



/* Implementation of bzrlib._btree_serializer_pyx */

static void *__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(void *__pyx_v_s,int __pyx_v_c,size_t __pyx_v_n) {
  char *__pyx_v_pos;
  char *__pyx_v_start;
  void *__pyx_r;
  int __pyx_1;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":74 */
  __pyx_v_start = ((char *)__pyx_v_s);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":75 */
  __pyx_v_pos = ((__pyx_v_start + __pyx_v_n) - 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":76 */
  while (1) {
    __pyx_1 = (__pyx_v_pos >= __pyx_v_start);
    if (!__pyx_1) break;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":77 */
    __pyx_1 = ((__pyx_v_pos[0]) == __pyx_v_c);
    if (__pyx_1) {
      __pyx_r = __pyx_v_pos;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":79 */
    __pyx_v_pos = (__pyx_v_pos - 1);
  }

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":80 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(char *__pyx_v_s,Py_ssize_t __pyx_v_size) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":85 */
  __pyx_1 = (__pyx_v_size < 0);
  if (__pyx_1) {
    __pyx_2 = PyInt_FromSsize_t(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(((int)__pyx_v_s)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
    __pyx_2 = 0;
    __pyx_3 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_4 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":89 */
  __pyx_2 = PyString_FromStringAndSize(__pyx_v_s,__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.safe_string_from_size");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(char *__pyx_v_s,Py_ssize_t __pyx_v_size) {
  PyObject *__pyx_v_py_str;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  __pyx_v_result = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":94 */
  __pyx_1 = (__pyx_v_size < 0);
  if (__pyx_1) {
    __pyx_2 = PyInt_FromSsize_t(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(((int)__pyx_v_s)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
    __pyx_2 = 0;
    __pyx_3 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_4 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":98 */
  __pyx_v_py_str = PyString_FromStringAndSize(__pyx_v_s,__pyx_v_size);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":99 */
  PyString_InternInPlace((&__pyx_v_py_str));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":100 */
  Py_INCREF(((PyObject *)__pyx_v_py_str));
  Py_DECREF(__pyx_v_result);
  __pyx_v_result = ((PyObject *)__pyx_v_py_str);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":103 */
  Py_DECREF(__pyx_v_py_str);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":104 */
  Py_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.safe_interned_string_from_size");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_result);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bytes = 0;
  PyObject *__pyx_v_key_length = 0;
  PyObject *__pyx_v_ref_list_length = 0;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"bytes","key_length","ref_list_length",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_bytes, &__pyx_v_key_length, &__pyx_v_ref_list_length)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_bytes);
  Py_INCREF(__pyx_v_key_length);
  Py_INCREF(__pyx_v_ref_list_length);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":142 */
  Py_INCREF(__pyx_v_bytes);
  Py_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes);
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes = __pyx_v_bytes;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":143 */
  __pyx_1 = PyInt_AsLong(__pyx_v_key_length); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->key_length = __pyx_1;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":144 */
  __pyx_1 = PyInt_AsLong(__pyx_v_ref_list_length); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->ref_list_length = __pyx_1;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":145 */
  __pyx_2 = PyList_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys);
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":146 */
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str = NULL;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":147 */
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str = NULL;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":148 */
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_header_found = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_bytes);
  Py_DECREF(__pyx_v_key_length);
  Py_DECREF(__pyx_v_ref_list_length);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_extract_key(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_v_self,char *__pyx_v_last) {
  char *__pyx_v_temp_ptr;
  int __pyx_v_loop_counter;
  StaticTuple *__pyx_v_key;
  PyObject *__pyx_v_failure_string;
  PyObject *__pyx_v_key_element;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  int __pyx_3;
  PyObject *__pyx_4 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_key = ((StaticTuple *)Py_None); Py_INCREF(Py_None);
  __pyx_v_failure_string = Py_None; Py_INCREF(Py_None);
  __pyx_v_key_element = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":161 */
  __pyx_1 = ((PyObject *)StaticTuple_New(__pyx_v_self->key_length)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_key));
  __pyx_v_key = ((StaticTuple *)__pyx_1);
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":162 */
  __pyx_2 = __pyx_v_self->key_length;
  for (__pyx_v_loop_counter = 0; __pyx_v_loop_counter < __pyx_2; ++__pyx_v_loop_counter) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":164 */
    __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start,'\0',(__pyx_v_last - __pyx_v_self->_start)));

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":165 */
    __pyx_3 = (__pyx_v_temp_ptr == NULL);
    if (__pyx_3) {
      __pyx_3 = ((__pyx_v_loop_counter + 1) == __pyx_v_self->key_length);
      if (__pyx_3) {
        __pyx_v_temp_ptr = __pyx_v_last;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":171 */
        __pyx_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start,(__pyx_v_last - __pyx_v_self->_start)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
        __pyx_4 = PyObject_Repr(__pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_1 = PyNumber_Add(__pyx_k2p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        Py_DECREF(__pyx_v_failure_string);
        __pyx_v_failure_string = __pyx_1;
        __pyx_1 = 0;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":174 */
        __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
        Py_INCREF(__pyx_v_failure_string);
        PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_failure_string);
        __pyx_1 = PyObject_CallObject(PyExc_AssertionError, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        __Pyx_Raise(__pyx_1, 0, 0);
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":176 */
    __pyx_3 = (__pyx_v_self->key_length == 1);
    if (__pyx_3) {
      __pyx_3 = ((__pyx_v_temp_ptr - __pyx_v_self->_start) == 45);
      if (__pyx_3) {
        __pyx_3 = (strncmp(__pyx_v_self->_start,__pyx_k3,5) == 0);
      }
    }
    if (__pyx_3) {
      __pyx_4 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start,(__pyx_v_temp_ptr - __pyx_v_self->_start)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
      Py_DECREF(__pyx_v_key_element);
      __pyx_v_key_element = __pyx_4;
      __pyx_4 = 0;
      goto __pyx_L6;
    }
    /*else*/ {
      __pyx_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(__pyx_v_self->_start,(__pyx_v_temp_ptr - __pyx_v_self->_start)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
      Py_DECREF(__pyx_v_key_element);
      __pyx_v_key_element = __pyx_1;
      __pyx_1 = 0;
    }
    __pyx_L6:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":185 */
    __pyx_v_self->_start = (__pyx_v_temp_ptr + 1);

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":186 */
    Py_INCREF(__pyx_v_key_element);

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":187 */
    StaticTuple_SET_ITEM(__pyx_v_key,__pyx_v_loop_counter,__pyx_v_key_element);
  }

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":188 */
  __pyx_4 = ((PyObject *)StaticTuple_Intern(__pyx_v_key)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_key));
  __pyx_v_key = ((StaticTuple *)__pyx_4);
  __pyx_4 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":189 */
  Py_INCREF(((PyObject *)__pyx_v_key));
  __pyx_r = ((PyObject *)__pyx_v_key);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.extract_key");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_key);
  Py_DECREF(__pyx_v_failure_string);
  Py_DECREF(__pyx_v_key_element);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_process_line(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_v_self) {
  char *__pyx_v_last;
  char *__pyx_v_temp_ptr;
  char *__pyx_v_ref_ptr;
  char *__pyx_v_next_start;
  int __pyx_v_loop_counter;
  Py_ssize_t __pyx_v_str_len;
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_ref_lists;
  PyObject *__pyx_v_ref_list;
  PyObject *__pyx_v_node_value;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_key = Py_None; Py_INCREF(Py_None);
  __pyx_v_value = Py_None; Py_INCREF(Py_None);
  __pyx_v_ref_lists = Py_None; Py_INCREF(Py_None);
  __pyx_v_ref_list = Py_None; Py_INCREF(Py_None);
  __pyx_v_node_value = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":200 */
  __pyx_v_self->_start = __pyx_v_self->_cur_str;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":202 */
  __pyx_v_last = ((char *)memchr(__pyx_v_self->_start,'\n',(__pyx_v_self->_end_str - __pyx_v_self->_start)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":203 */
  __pyx_1 = (__pyx_v_last == NULL);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":205 */
    __pyx_v_last = __pyx_v_self->_end_str;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":206 */
    __pyx_v_self->_cur_str = __pyx_v_self->_end_str;
    goto __pyx_L2;
  }
  /*else*/ {
    __pyx_v_self->_cur_str = (__pyx_v_last + 1);
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":212 */
  __pyx_1 = (__pyx_v_last == __pyx_v_self->_start);
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":215 */
  __pyx_1 = (__pyx_v_last < __pyx_v_self->_start);
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
    Py_INCREF(__pyx_k4p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k4p);
    __pyx_3 = PyObject_CallObject(PyExc_AssertionError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":218 */
  __pyx_1 = (0 == __pyx_v_self->_header_found);
  if (__pyx_1) {
    __pyx_1 = (strncmp(__pyx_k5,__pyx_v_self->_start,(__pyx_v_last - __pyx_v_self->_start)) == 0);
    if (__pyx_1) {

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":221 */
      __pyx_v_self->_header_found = 1;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":222 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {
      __pyx_2 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start,(__pyx_v_last - __pyx_v_self->_start)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
      __pyx_3 = PyNumber_Remainder(__pyx_k6p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
      __pyx_3 = 0;
      __pyx_3 = PyObject_CallObject(PyExc_AssertionError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __Pyx_Raise(__pyx_3, 0, 0);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":227 */
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self->__pyx_vtab)->extract_key(__pyx_v_self,__pyx_v_last); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
  Py_DECREF(__pyx_v_key);
  __pyx_v_key = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":229 */
  __pyx_v_temp_ptr = ((char *)__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(__pyx_v_self->_start,'\0',(__pyx_v_last - __pyx_v_self->_start)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":230 */
  __pyx_1 = (__pyx_v_temp_ptr == NULL);
  if (__pyx_1) {
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    Py_INCREF(__pyx_k7p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k7p);
    __pyx_2 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":240 */
    __pyx_v_str_len = ((__pyx_v_last - __pyx_v_temp_ptr) - 1);

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":241 */
    __pyx_1 = (__pyx_v_str_len > 4);
    if (__pyx_1) {
      __pyx_1 = (strncmp(__pyx_k8,(__pyx_v_last - 4),4) == 0);
    }
    if (__pyx_1) {
      __pyx_3 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size((__pyx_v_temp_ptr + 1),__pyx_v_str_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
      Py_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L8;
    }
    /*else*/ {
      __pyx_2 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size((__pyx_v_temp_ptr + 1),__pyx_v_str_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
      Py_DECREF(__pyx_v_value);
      __pyx_v_value = __pyx_2;
      __pyx_2 = 0;
    }
    __pyx_L8:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":249 */
    __pyx_v_last = __pyx_v_temp_ptr;
  }
  __pyx_L7:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":251 */
  __pyx_1 = __pyx_v_self->ref_list_length;
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":252 */
    __pyx_3 = ((PyObject *)StaticTuple_New(__pyx_v_self->ref_list_length)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
    Py_DECREF(__pyx_v_ref_lists);
    __pyx_v_ref_lists = __pyx_3;
    __pyx_3 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":253 */
    __pyx_v_loop_counter = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":254 */
    while (1) {
      __pyx_1 = (__pyx_v_loop_counter < __pyx_v_self->ref_list_length);
      if (!__pyx_1) break;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":255 */
      __pyx_2 = PyList_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
      Py_DECREF(__pyx_v_ref_list);
      __pyx_v_ref_list = __pyx_2;
      __pyx_2 = 0;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":257 */
      __pyx_v_loop_counter = (__pyx_v_loop_counter + 1);

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":258 */
      __pyx_1 = (__pyx_v_last < __pyx_v_self->_start);
      if (__pyx_1) {
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
        Py_INCREF(__pyx_k4p);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k4p);
        __pyx_2 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __Pyx_Raise(__pyx_2, 0, 0);
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":261 */
      __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start,'\t',(__pyx_v_last - __pyx_v_self->_start)));

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":262 */
      __pyx_1 = (__pyx_v_temp_ptr == NULL);
      if (__pyx_1) {
        __pyx_1 = (__pyx_v_loop_counter != __pyx_v_self->ref_list_length);
        if (__pyx_1) {
          __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
          Py_INCREF(__pyx_k9p);
          PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k9p);
          __pyx_2 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
          Py_DECREF(__pyx_3); __pyx_3 = 0;
          __Pyx_Raise(__pyx_2, 0, 0);
          Py_DECREF(__pyx_2); __pyx_2 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":270 */
          __pyx_v_ref_ptr = __pyx_v_last;

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":271 */
          __pyx_v_next_start = __pyx_v_last;
        }
        __pyx_L14:;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":274 */
        __pyx_v_ref_ptr = __pyx_v_temp_ptr;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":275 */
        __pyx_v_next_start = (__pyx_v_temp_ptr + 1);
      }
      __pyx_L13:;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":277 */
      while (1) {
        __pyx_1 = (__pyx_v_self->_start < __pyx_v_ref_ptr);
        if (!__pyx_1) break;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":279 */
        __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start,'\r',(__pyx_v_ref_ptr - __pyx_v_self->_start)));

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":281 */
        __pyx_1 = (__pyx_v_temp_ptr == NULL);
        if (__pyx_1) {
          __pyx_v_temp_ptr = __pyx_v_ref_ptr;
          goto __pyx_L17;
        }
        __pyx_L17:;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":285 */
        __pyx_3 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self->__pyx_vtab)->extract_key(__pyx_v_self,__pyx_v_temp_ptr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
        __pyx_1 = PyList_Append(__pyx_v_ref_list,__pyx_3); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
      }

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":286 */
      __pyx_2 = PySequence_Tuple(__pyx_v_ref_list); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
      __pyx_3 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_2 = ((PyObject *)StaticTuple_Intern(((StaticTuple *)__pyx_3))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_v_ref_list);
      __pyx_v_ref_list = __pyx_2;
      __pyx_2 = 0;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":287 */
      Py_INCREF(__pyx_v_ref_list);

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":288 */
      if (!__Pyx_TypeTest(__pyx_v_ref_lists, __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
      StaticTuple_SET_ITEM(((StaticTuple *)__pyx_v_ref_lists),(__pyx_v_loop_counter - 1),__pyx_v_ref_list);

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":290 */
      __pyx_v_self->_start = __pyx_v_next_start;
    }

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":291 */
    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
    Py_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_value);
    Py_INCREF(__pyx_v_ref_lists);
    PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_ref_lists);
    __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_node_value);
    __pyx_v_node_value = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":293 */
    __pyx_1 = (__pyx_v_last != __pyx_v_self->_start);
    if (__pyx_1) {
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      Py_INCREF(__pyx_k10p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k10p);
      __pyx_2 = PyObject_CallObject(PyExc_AssertionError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":296 */
    __pyx_3 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    Py_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_value);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_v_node_value);
    __pyx_v_node_value = __pyx_3;
    __pyx_3 = 0;
  }
  __pyx_L9:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":297 */
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;}
  Py_INCREF(__pyx_v_key);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_key);
  Py_INCREF(__pyx_v_node_value);
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_node_value);
  __pyx_3 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyList_Append(__pyx_v_self->keys,__pyx_3); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":298 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.process_line");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_key);
  Py_DECREF(__pyx_v_value);
  Py_DECREF(__pyx_v_ref_lists);
  Py_DECREF(__pyx_v_ref_list);
  Py_DECREF(__pyx_v_node_value);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  Py_ssize_t __pyx_v_byte_count;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  char *__pyx_4;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":302 */
  __pyx_1 = (!PyString_CheckExact(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes));
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
    Py_INCREF(__pyx_k11p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k11p);
    __pyx_3 = PyObject_CallObject(PyExc_AssertionError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":304 */
  __pyx_v_byte_count = PyString_Size(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":305 */
  __pyx_4 = PyString_AsString(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str = __pyx_4;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":307 */
  ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str + __pyx_v_byte_count);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":308 */
  while (1) {
    __pyx_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str < ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str);
    if (!__pyx_1) break;
    __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->__pyx_vtab)->process_line(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
  }

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":310 */
  Py_INCREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys);
  __pyx_r = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.parse");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bytes = 0;
  PyObject *__pyx_v_key_length = 0;
  PyObject *__pyx_v_ref_list_length = 0;
  PyObject *__pyx_v_parser;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"bytes","key_length","ref_list_length",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_bytes, &__pyx_v_key_length, &__pyx_v_ref_list_length)) return 0;
  Py_INCREF(__pyx_v_bytes);
  Py_INCREF(__pyx_v_key_length);
  Py_INCREF(__pyx_v_ref_list_length);
  __pyx_v_parser = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":314 */
  __pyx_1 = PyTuple_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
  Py_INCREF(__pyx_v_bytes);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_bytes);
  Py_INCREF(__pyx_v_key_length);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_key_length);
  Py_INCREF(__pyx_v_ref_list_length);
  PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_ref_list_length);
  __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_parser);
  __pyx_v_parser = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":315 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_parser, __pyx_n_parse); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._parse_leaf_lines");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_parser);
  Py_DECREF(__pyx_v_bytes);
  Py_DECREF(__pyx_v_key_length);
  Py_DECREF(__pyx_v_ref_list_length);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__flatten_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__flatten_node[] = "Convert a node into the serialized form.\n\n    :param node: A tuple representing a node:\n        (index, key_tuple, value, references)\n    :param reference_lists: Does this index have reference lists?\n    :return: (string_key, flattened)\n        string_key  The serialized key for referencing this node\n        flattened   A string with the serialized form for the contents\n    ";
static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__flatten_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_node = 0;
  PyObject *__pyx_v_reference_lists = 0;
  int __pyx_v_have_reference_lists;
  Py_ssize_t __pyx_v_flat_len;
  Py_ssize_t __pyx_v_key_len;
  Py_ssize_t __pyx_v_node_len;
  char *__pyx_v_value;
  Py_ssize_t __pyx_v_value_len;
  char *__pyx_v_out;
  Py_ssize_t __pyx_v_refs_len;
  Py_ssize_t __pyx_v_next_len;
  int __pyx_v_first_ref_list;
  int __pyx_v_first_reference;
  int __pyx_v_i;
  Py_ssize_t __pyx_v_ref_bit_len;
  PyObject *__pyx_v_string_key;
  PyObject *__pyx_v_ref_lists;
  PyObject *__pyx_v_ref_list;
  PyObject *__pyx_v_reference;
  PyObject *__pyx_v_ref_bit;
  PyObject *__pyx_v_val;
  PyObject *__pyx_v_line;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_ssize_t __pyx_4;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  char *__pyx_8;
  static char *__pyx_argnames[] = {"node","reference_lists",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_node, &__pyx_v_reference_lists)) return 0;
  Py_INCREF(__pyx_v_node);
  Py_INCREF(__pyx_v_reference_lists);
  __pyx_v_string_key = Py_None; Py_INCREF(Py_None);
  __pyx_v_ref_lists = Py_None; Py_INCREF(Py_None);
  __pyx_v_ref_list = Py_None; Py_INCREF(Py_None);
  __pyx_v_reference = Py_None; Py_INCREF(Py_None);
  __pyx_v_ref_bit = Py_None; Py_INCREF(Py_None);
  __pyx_v_val = Py_None; Py_INCREF(Py_None);
  __pyx_v_line = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":342 */
  __pyx_1 = (!PyTuple_CheckExact(__pyx_v_node));
  if (__pyx_1) {
    __pyx_1 = (!StaticTuple_CheckExact(__pyx_v_node));
  }
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
    Py_INCREF(__pyx_v_node);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_node);
    __pyx_3 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k13p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(PyExc_TypeError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":345 */
  __pyx_4 = PyObject_Length(__pyx_v_node); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
  __pyx_v_node_len = __pyx_4;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":346 */
  __pyx_1 = PyInt_AsLong(__pyx_v_reference_lists); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}
  __pyx_v_have_reference_lists = __pyx_1;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":347 */
  __pyx_1 = __pyx_v_have_reference_lists;
  if (__pyx_1) {
    __pyx_1 = (__pyx_v_node_len != 4);
    if (__pyx_1) {
      __pyx_4 = PyObject_Length(__pyx_v_node); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;}
      __pyx_3 = PyInt_FromSsize_t(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;}
      __pyx_2 = PyNumber_Remainder(__pyx_k14p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
      __pyx_2 = 0;
      __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_1 = (__pyx_v_node_len < 3);
  if (__pyx_1) {
    __pyx_4 = PyObject_Length(__pyx_v_node); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;}
    __pyx_3 = PyInt_FromSsize_t(__pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;}
    __pyx_2 = PyNumber_Remainder(__pyx_k15p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":364 */
  __pyx_3 = PyObject_GetAttr(__pyx_k16p, __pyx_n_join); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
  __pyx_2 = __Pyx_GetItemInt(__pyx_v_node, 1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_v_string_key);
  __pyx_v_string_key = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":378 */
  __pyx_v_refs_len = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":379 */
  __pyx_1 = __pyx_v_have_reference_lists;
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":381 */
    __pyx_3 = __Pyx_GetItemInt(__pyx_v_node, 3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
    Py_DECREF(__pyx_v_ref_lists);
    __pyx_v_ref_lists = __pyx_3;
    __pyx_3 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":382 */
    __pyx_4 = PyObject_Length(__pyx_v_ref_lists); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}
    __pyx_v_next_len = __pyx_4;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":383 */
    __pyx_1 = (__pyx_v_next_len > 0);
    if (__pyx_1) {

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":387 */
      __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1));

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":388 */
      __pyx_5 = PyObject_GetIter(__pyx_v_ref_lists); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}
      for (;;) {
        __pyx_2 = PyIter_Next(__pyx_5);
        if (!__pyx_2) {
          if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}
          break;
        }
        Py_DECREF(__pyx_v_ref_list);
        __pyx_v_ref_list = __pyx_2;
        __pyx_2 = 0;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":389 */
        __pyx_4 = PyObject_Length(__pyx_v_ref_list); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; goto __pyx_L1;}
        __pyx_v_next_len = __pyx_4;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":390 */
        __pyx_1 = (__pyx_v_next_len > 0);
        if (__pyx_1) {

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":393 */
          __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1));

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":394 */
          __pyx_3 = PyObject_GetIter(__pyx_v_ref_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;}
          for (;;) {
            __pyx_2 = PyIter_Next(__pyx_3);
            if (!__pyx_2) {
              if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;}
              break;
            }
            Py_DECREF(__pyx_v_reference);
            __pyx_v_reference = __pyx_2;
            __pyx_2 = 0;

            /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":395 */
            __pyx_1 = (!PyTuple_CheckExact(__pyx_v_reference));
            if (__pyx_1) {
              __pyx_1 = (!StaticTuple_CheckExact(__pyx_v_reference));
            }
            if (__pyx_1) {
              __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
              Py_INCREF(__pyx_v_reference);
              PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_reference);
              __pyx_6 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
              Py_DECREF(__pyx_2); __pyx_2 = 0;
              __pyx_2 = PyNumber_Remainder(__pyx_k18p, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
              Py_DECREF(__pyx_6); __pyx_6 = 0;
              __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;}
              PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
              __pyx_2 = 0;
              __pyx_2 = PyObject_CallObject(PyExc_TypeError, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;}
              Py_DECREF(__pyx_6); __pyx_6 = 0;
              __Pyx_Raise(__pyx_2, 0, 0);
              Py_DECREF(__pyx_2); __pyx_2 = 0;
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; goto __pyx_L1;}
              goto __pyx_L12;
            }
            __pyx_L12:;

            /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":400 */
            __pyx_4 = PyObject_Length(__pyx_v_reference); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; goto __pyx_L1;}
            __pyx_v_next_len = __pyx_4;

            /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":401 */
            __pyx_1 = (__pyx_v_next_len > 0);
            if (__pyx_1) {

              /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":404 */
              __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1));

              /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":405 */
              __pyx_6 = PyObject_GetIter(__pyx_v_reference); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; goto __pyx_L1;}
              for (;;) {
                __pyx_2 = PyIter_Next(__pyx_6);
                if (!__pyx_2) {
                  if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; goto __pyx_L1;}
                  break;
                }
                Py_DECREF(__pyx_v_ref_bit);
                __pyx_v_ref_bit = __pyx_2;
                __pyx_2 = 0;

                /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":406 */
                __pyx_1 = (!PyString_CheckExact(__pyx_v_ref_bit));
                if (__pyx_1) {
                  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; goto __pyx_L1;}
                  Py_INCREF(__pyx_v_ref_bit);
                  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_ref_bit);
                  __pyx_7 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; goto __pyx_L1;}
                  Py_DECREF(__pyx_2); __pyx_2 = 0;
                  __pyx_2 = PyNumber_Remainder(__pyx_k19p, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; goto __pyx_L1;}
                  Py_DECREF(__pyx_7); __pyx_7 = 0;
                  __pyx_7 = PyTuple_New(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}
                  PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2);
                  __pyx_2 = 0;
                  __pyx_2 = PyObject_CallObject(PyExc_TypeError, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}
                  Py_DECREF(__pyx_7); __pyx_7 = 0;
                  __Pyx_Raise(__pyx_2, 0, 0);
                  Py_DECREF(__pyx_2); __pyx_2 = 0;
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}
                  goto __pyx_L16;
                }
                __pyx_L16:;

                /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":410 */
                __pyx_v_refs_len = (__pyx_v_refs_len + PyString_GET_SIZE(__pyx_v_ref_bit));
              }
              Py_DECREF(__pyx_6); __pyx_6 = 0;
              goto __pyx_L13;
            }
            __pyx_L13:;
          }
          Py_DECREF(__pyx_3); __pyx_3 = 0;
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":413 */
  __pyx_v_key_len = PyString_Size(__pyx_v_string_key);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":414 */
  __pyx_7 = __Pyx_GetItemInt(__pyx_v_node, 2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; goto __pyx_L1;}
  Py_DECREF(__pyx_v_val);
  __pyx_v_val = __pyx_7;
  __pyx_7 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":415 */
  __pyx_1 = (!PyString_CheckExact(__pyx_v_val));
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}
    Py_INCREF(__pyx_v_val);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_val);
    __pyx_6 = PyObject_CallObject(((PyObject *)(&PyType_Type)), __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_3 = PyNumber_Remainder(__pyx_k20p, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_7 = PyObject_CallObject(PyExc_TypeError, __pyx_5); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_7, 0, 0);
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":418 */
  __pyx_v_value = PyString_AS_STRING(__pyx_v_val);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":419 */
  __pyx_v_value_len = PyString_GET_SIZE(__pyx_v_val);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":420 */
  __pyx_v_flat_len = (((((__pyx_v_key_len + 1) + __pyx_v_refs_len) + 1) + __pyx_v_value_len) + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":421 */
  __pyx_2 = PyString_FromStringAndSize(NULL,__pyx_v_flat_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; goto __pyx_L1;}
  Py_DECREF(__pyx_v_line);
  __pyx_v_line = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":423 */
  __pyx_8 = PyString_AsString(__pyx_v_line); if (__pyx_8 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; goto __pyx_L1;}
  __pyx_v_out = __pyx_8;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":424 */
  __pyx_8 = PyString_AsString(__pyx_v_string_key); if (__pyx_8 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; goto __pyx_L1;}
  memcpy(__pyx_v_out,__pyx_8,__pyx_v_key_len);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":425 */
  __pyx_v_out = (__pyx_v_out + __pyx_v_key_len);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":426 */
  (__pyx_v_out[0]) = '\0';

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":427 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":428 */
  __pyx_1 = (__pyx_v_refs_len > 0);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":429 */
    __pyx_v_first_ref_list = 1;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":430 */
    __pyx_6 = PyObject_GetIter(__pyx_v_ref_lists); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;}
    for (;;) {
      __pyx_3 = PyIter_Next(__pyx_6);
      if (!__pyx_3) {
        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; goto __pyx_L1;}
        break;
      }
      Py_DECREF(__pyx_v_ref_list);
      __pyx_v_ref_list = __pyx_3;
      __pyx_3 = 0;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":431 */
      __pyx_1 = (__pyx_v_first_ref_list == 0);
      if (__pyx_1) {

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":432 */
        (__pyx_v_out[0]) = '\t';

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":433 */
        __pyx_v_out = (__pyx_v_out + 1);
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":434 */
      __pyx_v_first_ref_list = 0;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":435 */
      __pyx_v_first_reference = 1;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":436 */
      __pyx_5 = PyObject_GetIter(__pyx_v_ref_list); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}
      for (;;) {
        __pyx_7 = PyIter_Next(__pyx_5);
        if (!__pyx_7) {
          if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}
          break;
        }
        Py_DECREF(__pyx_v_reference);
        __pyx_v_reference = __pyx_7;
        __pyx_7 = 0;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":437 */
        __pyx_1 = (__pyx_v_first_reference == 0);
        if (__pyx_1) {

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":438 */
          (__pyx_v_out[0]) = '\r';

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":439 */
          __pyx_v_out = (__pyx_v_out + 1);
          goto __pyx_L24;
        }
        __pyx_L24:;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":440 */
        __pyx_v_first_reference = 0;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":441 */
        __pyx_4 = PyObject_Length(__pyx_v_reference); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; goto __pyx_L1;}
        __pyx_v_next_len = __pyx_4;

        /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":442 */
        for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_next_len; ++__pyx_v_i) {

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":443 */
          __pyx_1 = (__pyx_v_i != 0);
          if (__pyx_1) {

            /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":444 */
            (__pyx_v_out[0]) = '\x000';

            /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":445 */
            __pyx_v_out = (__pyx_v_out + 1);
            goto __pyx_L27;
          }
          __pyx_L27:;

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":446 */
          __pyx_2 = __Pyx_GetItemInt(__pyx_v_reference, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; goto __pyx_L1;}
          Py_DECREF(__pyx_v_ref_bit);
          __pyx_v_ref_bit = __pyx_2;
          __pyx_2 = 0;

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":447 */
          __pyx_v_ref_bit_len = PyString_GET_SIZE(__pyx_v_ref_bit);

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":448 */
          memcpy(__pyx_v_out,PyString_AS_STRING(__pyx_v_ref_bit),__pyx_v_ref_bit_len);

          /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":449 */
          __pyx_v_out = (__pyx_v_out + __pyx_v_ref_bit_len);
        }
      }
      Py_DECREF(__pyx_5); __pyx_5 = 0;
    }
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":450 */
  (__pyx_v_out[0]) = '\0';

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":451 */
  __pyx_v_out = (__pyx_v_out + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":452 */
  memcpy(__pyx_v_out,__pyx_v_value,__pyx_v_value_len);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":453 */
  __pyx_v_out = (__pyx_v_out + __pyx_v_value_len);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":454 */
  (__pyx_v_out[0]) = '\n';

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":455 */
  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; goto __pyx_L1;}
  Py_INCREF(__pyx_v_string_key);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_string_key);
  Py_INCREF(__pyx_v_line);
  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_line);
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_7);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._flatten_node");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_string_key);
  Py_DECREF(__pyx_v_ref_lists);
  Py_DECREF(__pyx_v_ref_list);
  Py_DECREF(__pyx_v_reference);
  Py_DECREF(__pyx_v_ref_bit);
  Py_DECREF(__pyx_v_val);
  Py_DECREF(__pyx_v_line);
  Py_DECREF(__pyx_v_node);
  Py_DECREF(__pyx_v_reference_lists);
  return __pyx_r;
}
static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser __pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser;

static PyObject *__pyx_tp_new_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o);
  *(struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser **)&p->__pyx_vtab = __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser;
  p->bytes = Py_None; Py_INCREF(Py_None);
  p->keys = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o) {
  struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o;
  Py_XDECREF(p->bytes);
  Py_XDECREF(p->keys);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o;
  if (p->bytes) {
    e = (*v)(p->bytes, a); if (e) return e;
  }
  if (p->keys) {
    e = (*v)(p->keys, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o) {
  struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o;
  PyObject *t;
  t = p->bytes; 
  p->bytes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->keys; 
  p->keys = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  return 0;
}

static struct PyMethodDef __pyx_methods_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser[] = {
  {"parse", (PyCFunction)__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BTreeLeafParser = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BTreeLeafParser = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BTreeLeafParser = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BTreeLeafParser = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "bzrlib._btree_serializer_pyx.BTreeLeafParser", /*tp_name*/
  sizeof(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_BTreeLeafParser, /*tp_as_number*/
  &__pyx_tp_as_sequence_BTreeLeafParser, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BTreeLeafParser, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BTreeLeafParser, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Parse the leaf nodes of a BTree index.\n\n    :ivar bytes: The PyString object containing the uncompressed text for the\n        node.\n    :ivar key_length: An integer describing how many pieces the keys have for\n        this index.\n    :ivar ref_list_length: An integer describing how many references this index\n        contains.\n    :ivar keys: A PyList of keys found in this node.\n\n    :ivar _cur_str: A pointer to the start of the next line to parse\n    :ivar _end_str: A pointer to the end of bytes\n    :ivar _start: Pointer to the location within the current line while\n        parsing.\n    :ivar _header_found: True when we have parsed the header for this node\n    ", /*tp_doc*/
  __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_traverse*/
  __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*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_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"_parse_leaf_lines", (PyCFunction)__pyx_f_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines, METH_VARARGS|METH_KEYWORDS, 0},
  {"_flatten_node", (PyCFunction)__pyx_f_6bzrlib_21_btree_serializer_pyx__flatten_node, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_21_btree_serializer_pyx__flatten_node},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_btree_serializer_pyx(void); /*proto*/
PyMODINIT_FUNC init_btree_serializer_pyx(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_btree_serializer_pyx", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;};
  __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = &__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser;
  *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.extract_key = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_extract_key;
  *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.process_line = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_process_line;
  __pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.tp_dict, __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "BTreeLeafParser", (PyObject *)&__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
  __pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = &__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser;
  __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = __Pyx_ImportType("bzrlib._static_tuple_c", "StaticTuple", sizeof(StaticTuple)); if (!__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":106 */
  __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
  Py_INCREF(__pyx_n__static_tuple_c);
  PyList_SET_ITEM(__pyx_1, 0, __pyx_n__static_tuple_c);
  __pyx_2 = __Pyx_Import(__pyx_n_bzrlib, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n__static_tuple_c); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n__static_tuple_c, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":108 */
  __pyx_3 = import_static_tuple_c(); if (__pyx_3 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_btree_serializer_pyx.pyx":318 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._btree_serializer_pyx");
}

static char *__pyx_filenames[] = {
  "_btree_serializer_pyx.pyx",
  "_static_tuple_c.pxd",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_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;
            }
        #endif
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        obj->ob_type->tp_name, type->tp_name);
    return 0;
}

static PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i) {
    PyTypeObject *t = o->ob_type;
    PyObject *r;
    if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
        r = PySequence_GetItem(o, i);
    else {
        PyObject *j = PyInt_FromLong(i);
        if (!j)
            return 0;
        r = PyObject_GetItem(o, j);
        Py_DECREF(j);
    }
    return r;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
    long size) 
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    result = PyObject_GetAttrString(py_module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s does not appear to be the correct type object",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(char *name) {
    PyObject *py_name = 0;
    
    py_name = PyString_FromString(name);
    if (!py_name)
        goto bad;
    return PyImport_Import(py_name);
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    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;
    module = PyObject_CallFunction(__import__, "OOOO",
        name, global_dict, empty_dict, list);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
