/* Generated by Pyrex 0.9.5.1a on Wed Jun 13 13:36:59 2007 */

#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "stdlib.h"
#include "mpi.h"


typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; 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 int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/

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

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

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/

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

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

/* Declarations from cmpi */


/* Declarations from _mpi */


struct __pyx_obj_4_mpi_MPI_Comm {
  PyObject_HEAD
  MPI_Comm comm;
  int permanent;
};


struct __pyx_obj_4_mpi_MPI_Group {
  PyObject_HEAD
  MPI_Group group;
  int permanent;
};

static PyTypeObject *__pyx_ptype_4_mpi_MPI_Comm = 0;
static PyTypeObject *__pyx_ptype_4_mpi_MPI_Group = 0;
static char (__pyx_v_4_mpi_cstring[1024]);
static PyObject *(__pyx_f_4_mpi_permanentCommObj(MPI_Comm )); /*proto*/
static PyObject *(__pyx_f_4_mpi_permanentGroupObj(MPI_Group )); /*proto*/
static PyObject *(__pyx_f_4_mpi_getCommObj(MPI_Comm )); /*proto*/
static PyObject *(__pyx_f_4_mpi_getGroupObj(MPI_Group )); /*proto*/


/* Implementation of _mpi */


static PyObject *__pyx_n_cmpi;
static PyObject *__pyx_n_MPI_COMM_WORLD;
static PyObject *__pyx_n_MPI_COMM_NULL;
static PyObject *__pyx_n_MPI_COMM_SELF;
static PyObject *__pyx_n_MPI_GROUP_NULL;
static PyObject *__pyx_n_MPI_GROUP_EMPTY;
static PyObject *__pyx_n_MPI_Error;
static PyObject *__pyx_n_MPI_Barrier;
static PyObject *__pyx_n_MPI_Comm_create;
static PyObject *__pyx_n_MPI_Comm_group;
static PyObject *__pyx_n_MPI_Comm_rank;
static PyObject *__pyx_n_MPI_Comm_size;
static PyObject *__pyx_n_MPI_Error_string;
static PyObject *__pyx_n_MPI_Group_excl;
static PyObject *__pyx_n_MPI_Group_incl;
static PyObject *__pyx_n_MPI_Group_rank;
static PyObject *__pyx_n_MPI_Group_size;
static PyObject *__pyx_n_EnvironmentError;
static PyObject *__pyx_n___str__;

static int __pyx_f_4_mpi_8MPI_Comm___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4_mpi_8MPI_Comm___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
  Py_INCREF(__pyx_v_self);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":12 */
  ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_self)->comm = MPI_COMM_NULL;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":13 */
  ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_self)->permanent = 0;

  __pyx_r = 0;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static void __pyx_f_4_mpi_8MPI_Comm___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_4_mpi_8MPI_Comm___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_v_error;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":17 */
  __pyx_1 = ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_self)->permanent;
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":18 */
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":19 */
  __pyx_v_error = MPI_Comm_free((&((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_self)->comm));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":20 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":22 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":23 */
  goto __pyx_L0;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_mpi.MPI_Comm.__dealloc__");
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
}

static int __pyx_f_4_mpi_9MPI_Group___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4_mpi_9MPI_Group___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
  Py_INCREF(__pyx_v_self);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":29 */
  ((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_v_self)->group = MPI_GROUP_NULL;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":30 */
  ((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_v_self)->permanent = 0;

  __pyx_r = 0;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static void __pyx_f_4_mpi_9MPI_Group___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_4_mpi_9MPI_Group___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_v_error;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":34 */
  __pyx_1 = ((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_v_self)->permanent;
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":35 */
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":36 */
  __pyx_v_error = MPI_Group_free((&((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_v_self)->group));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":37 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":38 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":39 */
  goto __pyx_L0;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_mpi.MPI_Group.__dealloc__");
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
}

static PyObject *__pyx_f_4_mpi_permanentCommObj(MPI_Comm __pyx_v_comm) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_obj;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Comm *)Py_None); Py_INCREF(Py_None);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":44 */
  __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Comm), 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_obj));
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_1);
  __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":45 */
  __pyx_v_obj->comm = __pyx_v_comm;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":46 */
  __pyx_v_obj->permanent = 1;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":47 */
  Py_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_mpi.permanentCommObj");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_obj);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_permanentGroupObj(MPI_Group __pyx_v_group) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_obj;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Group *)Py_None); Py_INCREF(Py_None);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":51 */
  __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Group), 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_4_mpi_MPI_Group)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_obj));
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_1);
  __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":52 */
  __pyx_v_obj->group = __pyx_v_group;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":53 */
  __pyx_v_obj->permanent = 1;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":54 */
  Py_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_mpi.permanentGroupObj");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_obj);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_getCommObj(MPI_Comm __pyx_v_comm) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_obj;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Comm *)Py_None); Py_INCREF(Py_None);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":67 */
  __pyx_1 = (__pyx_v_comm == MPI_COMM_WORLD);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":68 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_COMM_WORLD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_1 = (__pyx_v_comm == MPI_COMM_NULL);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":70 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_COMM_NULL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_1 = (__pyx_v_comm == MPI_COMM_SELF);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":72 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_COMM_SELF); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":73 */
  __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Comm), 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
  if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_obj));
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_2);
  __pyx_2 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":74 */
  __pyx_v_obj->comm = __pyx_v_comm;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":75 */
  Py_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_mpi.getCommObj");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_obj);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_getGroupObj(MPI_Group __pyx_v_group) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_obj;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Group *)Py_None); Py_INCREF(Py_None);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":79 */
  __pyx_1 = (__pyx_v_group == MPI_GROUP_NULL);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":80 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_GROUP_NULL); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_1 = (__pyx_v_group == MPI_GROUP_EMPTY);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":82 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_GROUP_EMPTY); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":83 */
  __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Group), 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
  if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_4_mpi_MPI_Group)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_obj));
  __pyx_v_obj = ((struct __pyx_obj_4_mpi_MPI_Group *)__pyx_2);
  __pyx_2 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":84 */
  __pyx_v_obj->group = __pyx_v_group;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":85 */
  Py_INCREF(((PyObject *)__pyx_v_obj));
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_mpi.getGroupObj");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_obj);
  return __pyx_r;
}

static PyObject *__pyx_n_args;

static PyObject *__pyx_f_4_mpi_9MPI_Error___str__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4_mpi_9MPI_Error___str__ = {"__str__", (PyCFunction)__pyx_f_4_mpi_9MPI_Error___str__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_f_4_mpi_9MPI_Error___str__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"self",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_self)) return 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":90 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error_string); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_args); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
  __pyx_4 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __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_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_mpi.MPI_Error.__str__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Barrier(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Barrier(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_comm = 0;
  int __pyx_v_error;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"comm",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_comm)) return 0;
  Py_INCREF(__pyx_v_comm);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_4_mpi_MPI_Comm, 1, "comm")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":95 */
  __pyx_v_error = MPI_Barrier(__pyx_v_comm->comm);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":96 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":97 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":98 */
  __pyx_r = Py_None; Py_INCREF(Py_None);
  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("_mpi.MPI_Barrier");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_comm);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Comm_create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Comm_create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_comm = 0;
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_group = 0;
  int __pyx_v_error;
  MPI_Comm __pyx_v_comm_out;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"comm","group",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_comm, &__pyx_v_group)) return 0;
  Py_INCREF(__pyx_v_comm);
  Py_INCREF(__pyx_v_group);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_4_mpi_MPI_Comm, 1, "comm")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group), __pyx_ptype_4_mpi_MPI_Group, 1, "group")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":104 */
  __pyx_v_error = MPI_Comm_create(__pyx_v_comm->comm,__pyx_v_group->group,(&__pyx_v_comm_out));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":105 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":106 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":107 */
  __pyx_2 = __pyx_f_4_mpi_getCommObj(__pyx_v_comm_out); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; 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("_mpi.MPI_Comm_create");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_comm);
  Py_DECREF(__pyx_v_group);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Comm_group(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Comm_group(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_comm = 0;
  MPI_Group __pyx_v_group;
  PyObject *__pyx_v_error;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"comm",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_comm)) return 0;
  Py_INCREF(__pyx_v_comm);
  __pyx_v_error = Py_None; Py_INCREF(Py_None);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_4_mpi_MPI_Comm, 1, "comm")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":112 */
  __pyx_1 = PyInt_FromLong(MPI_Comm_group(__pyx_v_comm->comm,(&__pyx_v_group))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
  Py_DECREF(__pyx_v_error);
  __pyx_v_error = __pyx_1;
  __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":113 */
  __pyx_1 = PyInt_FromLong(MPI_SUCCESS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_error, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
  __pyx_2 = __pyx_2 != 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_2) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":114 */
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
    Py_INCREF(__pyx_v_error);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_error);
    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    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 = 114; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":115 */
  __pyx_1 = __pyx_f_4_mpi_getGroupObj(__pyx_v_group); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_mpi.MPI_Comm_group");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_error);
  Py_DECREF(__pyx_v_comm);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Comm_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Comm_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_comm = 0;
  int __pyx_v_error;
  int __pyx_v_rank;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"comm",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_comm)) return 0;
  Py_INCREF(__pyx_v_comm);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_4_mpi_MPI_Comm, 1, "comm")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":121 */
  __pyx_v_error = MPI_Comm_rank(__pyx_v_comm->comm,(&__pyx_v_rank));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":122 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":123 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":124 */
  __pyx_2 = PyInt_FromLong(__pyx_v_rank); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; 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("_mpi.MPI_Comm_rank");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_comm);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Comm_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Comm_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Comm *__pyx_v_comm = 0;
  int __pyx_v_error;
  int __pyx_v_size;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"comm",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_comm)) return 0;
  Py_INCREF(__pyx_v_comm);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_comm), __pyx_ptype_4_mpi_MPI_Comm, 1, "comm")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":130 */
  __pyx_v_error = MPI_Comm_size(__pyx_v_comm->comm,(&__pyx_v_size));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":131 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":132 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":133 */
  __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; 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("_mpi.MPI_Comm_size");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_comm);
  return __pyx_r;
}

static PyObject *__pyx_n_RuntimeError;

static PyObject *__pyx_k2p;

static char (__pyx_k2[]) = "buffer overflow";

static PyObject *__pyx_f_4_mpi_MPI_Error_string(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Error_string(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_errorcode;
  int __pyx_v_error;
  int __pyx_v_resultlen;
  PyObject *__pyx_v_string;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"errorcode",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_errorcode)) return 0;
  __pyx_v_string = Py_None; Py_INCREF(Py_None);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":141 */
  __pyx_v_error = MPI_Error_string(__pyx_v_errorcode,__pyx_v_4_mpi_cstring,(&__pyx_v_resultlen));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":142 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":143 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":144 */
  __pyx_1 = (__pyx_v_resultlen >= 1024);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":145 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
    Py_INCREF(__pyx_k2p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k2p);
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":146 */
  __pyx_2 = PyString_FromString(__pyx_v_4_mpi_cstring); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; goto __pyx_L1;}
  Py_DECREF(__pyx_v_string);
  __pyx_v_string = __pyx_2;
  __pyx_2 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":147 */
  Py_INCREF(__pyx_v_string);
  __pyx_r = __pyx_v_string;
  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("_mpi.MPI_Error_string");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_string);
  return __pyx_r;
}

static PyObject *__pyx_n_len;

static PyObject *__pyx_f_4_mpi_MPI_Group_excl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Group_excl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_group = 0;
  PyObject *__pyx_v_members = 0;
  int __pyx_v_error;
  int __pyx_v_n;
  int (*__pyx_v_ranks);
  MPI_Group __pyx_v_group_out;
  PyObject *__pyx_v_i;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  long __pyx_5;
  int __pyx_6;
  static char *__pyx_argnames[] = {"group","members",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_group, &__pyx_v_members)) return 0;
  Py_INCREF(__pyx_v_group);
  Py_INCREF(__pyx_v_members);
  __pyx_v_i = Py_None; Py_INCREF(Py_None);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group), __pyx_ptype_4_mpi_MPI_Group, 1, "group")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":156 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  Py_INCREF(__pyx_v_members);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_members);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_v_n = __pyx_4;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":157 */
  __pyx_v_ranks = ((int (*))malloc((__pyx_v_n * (sizeof(int )))));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":158 */
  for (__pyx_5 = 0; __pyx_5 < __pyx_v_n; ++__pyx_5) {
    __pyx_1 = PyInt_FromLong(__pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}
    Py_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_1;
    __pyx_1 = 0;

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":159 */
    __pyx_2 = PyObject_GetItem(__pyx_v_members, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
    __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_6 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
    (__pyx_v_ranks[__pyx_6]) = __pyx_4;
  }

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":161 */
  __pyx_v_error = MPI_Group_excl(__pyx_v_group->group,__pyx_v_n,__pyx_v_ranks,(&__pyx_v_group_out));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":163 */
  free(__pyx_v_ranks);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":165 */
  __pyx_4 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_4) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":166 */
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(__pyx_v_error); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
    __pyx_1 = 0;
    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_1, 0, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":168 */
  __pyx_3 = __pyx_f_4_mpi_getGroupObj(__pyx_v_group_out); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
  __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_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_mpi.MPI_Group_excl");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_i);
  Py_DECREF(__pyx_v_group);
  Py_DECREF(__pyx_v_members);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Group_incl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Group_incl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_group = 0;
  PyObject *__pyx_v_members = 0;
  int __pyx_v_error;
  int __pyx_v_n;
  int (*__pyx_v_ranks);
  MPI_Group __pyx_v_group_out;
  PyObject *__pyx_v_i;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  long __pyx_5;
  int __pyx_6;
  static char *__pyx_argnames[] = {"group","members",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_group, &__pyx_v_members)) return 0;
  Py_INCREF(__pyx_v_group);
  Py_INCREF(__pyx_v_members);
  __pyx_v_i = Py_None; Py_INCREF(Py_None);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group), __pyx_ptype_4_mpi_MPI_Group, 1, "group")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":177 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
  Py_INCREF(__pyx_v_members);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_members);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_v_n = __pyx_4;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":178 */
  __pyx_v_ranks = ((int (*))malloc((__pyx_v_n * (sizeof(int )))));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":179 */
  for (__pyx_5 = 0; __pyx_5 < __pyx_v_n; ++__pyx_5) {
    __pyx_1 = PyInt_FromLong(__pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
    Py_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_1;
    __pyx_1 = 0;

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":180 */
    __pyx_2 = PyObject_GetItem(__pyx_v_members, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_6 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
    (__pyx_v_ranks[__pyx_6]) = __pyx_4;
  }

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":182 */
  __pyx_v_error = MPI_Group_incl(__pyx_v_group->group,__pyx_v_n,__pyx_v_ranks,(&__pyx_v_group_out));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":184 */
  free(__pyx_v_ranks);

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":186 */
  __pyx_4 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_4) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":187 */
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(__pyx_v_error); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
    __pyx_1 = 0;
    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_1, 0, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":189 */
  __pyx_3 = __pyx_f_4_mpi_getGroupObj(__pyx_v_group_out); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; goto __pyx_L1;}
  __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_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_mpi.MPI_Group_incl");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_i);
  Py_DECREF(__pyx_v_group);
  Py_DECREF(__pyx_v_members);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Group_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Group_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_group = 0;
  int __pyx_v_error;
  int __pyx_v_rank;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"group",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_group)) return 0;
  Py_INCREF(__pyx_v_group);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group), __pyx_ptype_4_mpi_MPI_Group, 1, "group")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":195 */
  __pyx_v_error = MPI_Group_rank(__pyx_v_group->group,(&__pyx_v_rank));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":196 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":197 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":198 */
  __pyx_2 = PyInt_FromLong(__pyx_v_rank); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; 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("_mpi.MPI_Group_rank");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_group);
  return __pyx_r;
}

static PyObject *__pyx_f_4_mpi_MPI_Group_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4_mpi_MPI_Group_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_4_mpi_MPI_Group *__pyx_v_group = 0;
  int __pyx_v_error;
  int __pyx_v_size;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"group",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_group)) return 0;
  Py_INCREF(__pyx_v_group);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group), __pyx_ptype_4_mpi_MPI_Group, 1, "group")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":204 */
  __pyx_v_error = MPI_Group_size(__pyx_v_group->group,(&__pyx_v_size));

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":205 */
  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
  if (__pyx_1) {

    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":206 */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":207 */
  __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; 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("_mpi.MPI_Group_size");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_group);
  return __pyx_r;
}

static __Pyx_InternTabEntry __pyx_intern_tab[] = {
  {&__pyx_n_EnvironmentError, "EnvironmentError"},
  {&__pyx_n_MPI_Barrier, "MPI_Barrier"},
  {&__pyx_n_MPI_COMM_NULL, "MPI_COMM_NULL"},
  {&__pyx_n_MPI_COMM_SELF, "MPI_COMM_SELF"},
  {&__pyx_n_MPI_COMM_WORLD, "MPI_COMM_WORLD"},
  {&__pyx_n_MPI_Comm_create, "MPI_Comm_create"},
  {&__pyx_n_MPI_Comm_group, "MPI_Comm_group"},
  {&__pyx_n_MPI_Comm_rank, "MPI_Comm_rank"},
  {&__pyx_n_MPI_Comm_size, "MPI_Comm_size"},
  {&__pyx_n_MPI_Error, "MPI_Error"},
  {&__pyx_n_MPI_Error_string, "MPI_Error_string"},
  {&__pyx_n_MPI_GROUP_EMPTY, "MPI_GROUP_EMPTY"},
  {&__pyx_n_MPI_GROUP_NULL, "MPI_GROUP_NULL"},
  {&__pyx_n_MPI_Group_excl, "MPI_Group_excl"},
  {&__pyx_n_MPI_Group_incl, "MPI_Group_incl"},
  {&__pyx_n_MPI_Group_rank, "MPI_Group_rank"},
  {&__pyx_n_MPI_Group_size, "MPI_Group_size"},
  {&__pyx_n_RuntimeError, "RuntimeError"},
  {&__pyx_n___str__, "__str__"},
  {&__pyx_n_args, "args"},
  {&__pyx_n_cmpi, "cmpi"},
  {&__pyx_n_len, "len"},
  {0, 0}
};

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
  {0, 0, 0}
};

static PyObject *__pyx_tp_new_4_mpi_MPI_Comm(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  return o;
}

static void __pyx_tp_dealloc_4_mpi_MPI_Comm(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_4_mpi_8MPI_Comm___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_4_mpi_MPI_Comm(PyObject *o, visitproc v, void *a) {
  return 0;
}

static int __pyx_tp_clear_4_mpi_MPI_Comm(PyObject *o) {
  return 0;
}

static struct PyMethodDef __pyx_methods_4_mpi_MPI_Comm[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_MPI_Comm = {
  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*/
};

static PySequenceMethods __pyx_tp_as_sequence_MPI_Comm = {
  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_MPI_Comm = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4_mpi_MPI_Comm = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_mpi.MPI_Comm", /*tp_name*/
  sizeof(struct __pyx_obj_4_mpi_MPI_Comm), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4_mpi_MPI_Comm, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_MPI_Comm, /*tp_as_number*/
  &__pyx_tp_as_sequence_MPI_Comm, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MPI_Comm, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_MPI_Comm, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4_mpi_MPI_Comm, /*tp_traverse*/
  __pyx_tp_clear_4_mpi_MPI_Comm, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4_mpi_MPI_Comm, /*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_4_mpi_8MPI_Comm___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4_mpi_MPI_Comm, /*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 PyObject *__pyx_tp_new_4_mpi_MPI_Group(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  return o;
}

static void __pyx_tp_dealloc_4_mpi_MPI_Group(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_4_mpi_9MPI_Group___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_4_mpi_MPI_Group(PyObject *o, visitproc v, void *a) {
  return 0;
}

static int __pyx_tp_clear_4_mpi_MPI_Group(PyObject *o) {
  return 0;
}

static struct PyMethodDef __pyx_methods_4_mpi_MPI_Group[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_MPI_Group = {
  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*/
};

static PySequenceMethods __pyx_tp_as_sequence_MPI_Group = {
  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_MPI_Group = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4_mpi_MPI_Group = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_mpi.MPI_Group", /*tp_name*/
  sizeof(struct __pyx_obj_4_mpi_MPI_Group), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4_mpi_MPI_Group, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_MPI_Group, /*tp_as_number*/
  &__pyx_tp_as_sequence_MPI_Group, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MPI_Group, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_MPI_Group, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4_mpi_MPI_Group, /*tp_traverse*/
  __pyx_tp_clear_4_mpi_MPI_Group, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4_mpi_MPI_Group, /*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_4_mpi_9MPI_Group___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4_mpi_MPI_Group, /*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[] = {
  {"MPI_Barrier", (PyCFunction)__pyx_f_4_mpi_MPI_Barrier, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Comm_create", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_create, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Comm_group", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_group, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Comm_rank", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_rank, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Comm_size", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_size, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Error_string", (PyCFunction)__pyx_f_4_mpi_MPI_Error_string, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Group_excl", (PyCFunction)__pyx_f_4_mpi_MPI_Group_excl, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Group_incl", (PyCFunction)__pyx_f_4_mpi_MPI_Group_incl, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Group_rank", (PyCFunction)__pyx_f_4_mpi_MPI_Group_rank, METH_VARARGS|METH_KEYWORDS, 0},
  {"MPI_Group_size", (PyCFunction)__pyx_f_4_mpi_MPI_Group_size, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

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

PyMODINIT_FUNC init_mpi(void); /*proto*/
PyMODINIT_FUNC init_mpi(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_mpi", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
  if (PyType_Ready(&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "MPI_Comm", (PyObject *)&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  __pyx_ptype_4_mpi_MPI_Comm = &__pyx_type_4_mpi_MPI_Comm;
  if (PyType_Ready(&__pyx_type_4_mpi_MPI_Group) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "MPI_Group", (PyObject *)&__pyx_type_4_mpi_MPI_Group) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
  __pyx_ptype_4_mpi_MPI_Group = &__pyx_type_4_mpi_MPI_Group;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":57 */
  __pyx_1 = __pyx_f_4_mpi_permanentCommObj(MPI_COMM_WORLD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_COMM_WORLD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":58 */
  __pyx_1 = __pyx_f_4_mpi_permanentCommObj(MPI_COMM_NULL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_COMM_NULL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":59 */
  __pyx_1 = __pyx_f_4_mpi_permanentCommObj(MPI_COMM_SELF); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_COMM_SELF, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":61 */
  __pyx_1 = __pyx_f_4_mpi_permanentGroupObj(MPI_GROUP_NULL); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_GROUP_NULL, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":62 */
  __pyx_1 = __pyx_f_4_mpi_permanentGroupObj(MPI_GROUP_EMPTY); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_GROUP_EMPTY, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":88 */
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_EnvironmentError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_MPI_Error, "_mpi"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":89 */
  __pyx_3 = PyCFunction_New(&__pyx_mdef_4_mpi_9MPI_Error___str__, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
  __pyx_4 = PyMethod_New(__pyx_3, 0, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (PyObject_SetAttr(__pyx_2, __pyx_n___str__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_Error, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":201 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_mpi");
}

static char *__pyx_filenames[] = {
  "_mpi.pyx",
};

/* Runtime support code */

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

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, obj->ob_type->tp_name);
    return 0;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;
    
    py_modname = PyString_FromString(modname);
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    result = PyClass_New(bases, dict, name);
bad:
    Py_XDECREF(py_modname);
    return result;
}

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);
    }
    /* Next, repeatedly, replace a tuple exception with its first item */
    while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
        PyObject *tmp = type;
        type = PyTuple_GET_ITEM(type, 0);
        Py_INCREF(type);
        Py_DECREF(tmp);
    }
    if (PyString_Check(type)) {
        if (PyErr_Warn(PyExc_DeprecationWarning,
                "raising a string exception is deprecated"))
            goto raise_error;
    }
    else if (PyType_Check(type) || PyClass_Check(type))
        ; /*PyErr_NormalizeException(&type, &value, &tb);*/
    else {
        /* 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 (PyInstance_Check(type))
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
        else
            type = (PyObject*) type->ob_type;
        Py_INCREF(type);
    }
    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 int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    while (t->p) {
        *t->p = PyString_InternFromString(t->s);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

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

#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);
}
