/* Generated by Cython 0.15.1 on Fri Jan 20 16:08:21 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#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 PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__mpi4py__MPE
#define __PYX_HAVE_API__mpi4py__MPE
#include "MPE/mpe-log.h"
#include "MPE/mpe-log.c"
#include "stdio.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "helpers.pxi",
  "MPE.pyx",
  "mpi4py.MPE.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_6mpi4py_3MPE_LogEvent;
struct __pyx_obj_6mpi4py_3MPE_LogState;

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":18
 * # -----------------------------------------------------------------------------
 * 
 * cdef class LogEvent:             # <<<<<<<<<<<<<<
 * 
 *     cdef int commID
 */
struct __pyx_obj_6mpi4py_3MPE_LogEvent {
  PyObject_HEAD
  int commID;
  int eventID[1];
  int isActive;
  PyObject *name;
  PyObject *color;
};


/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":78
 * 
 * 
 * cdef class LogState:             # <<<<<<<<<<<<<<
 * 
 *     cdef int commID
 */
struct __pyx_obj_6mpi4py_3MPE_LogState {
  PyObject_HEAD
  int commID;
  int stateID[2];
  int isActive;
  PyObject *name;
  PyObject *color;
};



#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */

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

#ifndef __PYX_FORCE_INIT_THREADS
  #if PY_VERSION_HEX < 0x02040200
    #define __PYX_FORCE_INIT_THREADS 1
  #else
    #define __PYX_FORCE_INIT_THREADS 0
  #endif
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

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

static int __Pyx_RegisterCleanup(void); /*proto*/
static PyObject* __pyx_module_cleanup(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef cleanup_def = {__Pyx_NAMESTR("__cleanup"), (PyCFunction)&__pyx_module_cleanup, METH_NOARGS, 0};

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

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_check_binary_version(void);

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

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

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

/* Module declarations from 'cython.cython.view' */

/* Module declarations from 'cython' */

/* Module declarations from 'mpi4py.MPE' */
static PyTypeObject *__pyx_ptype_6mpi4py_3MPE_LogEvent = 0;
static PyTypeObject *__pyx_ptype_6mpi4py_3MPE_LogState = 0;
static PyObject *__pyx_v_6mpi4py_3MPE_MPI = 0;
static int __pyx_v_6mpi4py_3MPE_logInitedHere;
static int __pyx_v_6mpi4py_3MPE_logFinishAtExit;
static CYTHON_INLINE PyObject *__pyx_f_6mpi4py_3MPE_toBytes(PyObject *, char **); /*proto*/
static int __pyx_f_6mpi4py_3MPE_PyMPE_Raise(int); /*proto*/
static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_CHKERR(int); /*proto*/
static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_initialize(void); /*proto*/
static int __pyx_f_6mpi4py_3MPE_finalize(void); /*proto*/
static void __pyx_f_6mpi4py_3MPE_atexit(void); /*proto*/
static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_isReady(void); /*proto*/
static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_packArgs(PyObject *, char *); /*proto*/
#define __Pyx_MODULE_NAME "mpi4py.MPE"
int __pyx_module_is_main_mpi4py__MPE = 0;

/* Implementation of 'mpi4py.MPE' */
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_1[] = "MPE logging initialization failed [error code: %d]";
static char __pyx_k_2[] = "warning: could not register cleanup with Py_AtExit()\n";
static char __pyx_k_3[] = "error: in MPE finalization [code: %d]";
static char __pyx_k_4[] = "\nMulti-Processing Environment\n";
static char __pyx_k_5[] = "mpi4py.MPE";
static char __pyx_k__MPI[] = "MPI";
static char __pyx_k__log[] = "log";
static char __pyx_k__red[] = "red";
static char __pyx_k__blue[] = "blue";
static char __pyx_k__exit[] = "exit";
static char __pyx_k__name[] = "name";
static char __pyx_k__color[] = "color";
static char __pyx_k__enter[] = "enter";
static char __pyx_k__encode[] = "encode";
static char __pyx_k__mpi4py[] = "mpi4py";
static char __pyx_k____doc__[] = "__doc__";
static char __pyx_k__initLog[] = "initLog";
static char __pyx_k__logfile[] = "logfile";
static char __pyx_k__stopLog[] = "stopLog";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k__filename[] = "filename";
static char __pyx_k__startLog[] = "startLog";
static char __pyx_k__finishLog[] = "finishLog";
static char __pyx_k__syncClocks[] = "syncClocks";
static char __pyx_k__newLogEvent[] = "newLogEvent";
static char __pyx_k__newLogState[] = "newLogState";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__setLogFileName[] = "setLogFileName";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_n_s_5;
static PyObject *__pyx_n_s__MPI;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s____doc__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s__color;
static PyObject *__pyx_n_s__encode;
static PyObject *__pyx_n_s__enter;
static PyObject *__pyx_n_s__exit;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__finishLog;
static PyObject *__pyx_n_s__initLog;
static PyObject *__pyx_n_s__log;
static PyObject *__pyx_n_s__logfile;
static PyObject *__pyx_n_s__mpi4py;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__newLogEvent;
static PyObject *__pyx_n_s__newLogState;
static PyObject *__pyx_n_s__setLogFileName;
static PyObject *__pyx_n_s__startLog;
static PyObject *__pyx_n_s__stopLog;
static PyObject *__pyx_n_s__syncClocks;

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":3
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline object toBytes(object ob, char *p[]):             # <<<<<<<<<<<<<<
 *     if ob is None:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_6mpi4py_3MPE_toBytes(PyObject *__pyx_v_ob, char **__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toBytes");
  __Pyx_INCREF(__pyx_v_ob);

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":4
 * 
 * cdef inline object toBytes(object ob, char *p[]):
 *     if ob is None:             # <<<<<<<<<<<<<<
 *         return None
 *     if not isinstance(ob, bytes):
 */
  __pyx_t_1 = (__pyx_v_ob == Py_None);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":5
 * cdef inline object toBytes(object ob, char *p[]):
 *     if ob is None:
 *         return None             # <<<<<<<<<<<<<<
 *     if not isinstance(ob, bytes):
 *         ob = ob.encode()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":6
 *     if ob is None:
 *         return None
 *     if not isinstance(ob, bytes):             # <<<<<<<<<<<<<<
 *         ob = ob.encode()
 *     if p:
 */
  __pyx_t_2 = ((PyObject *)((PyObject*)(&PyBytes_Type)));
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ob, __pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":7
 *         return None
 *     if not isinstance(ob, bytes):
 *         ob = ob.encode()             # <<<<<<<<<<<<<<
 *     if p:
 *         p[0] = ob
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_ob);
    __pyx_v_ob = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":8
 *     if not isinstance(ob, bytes):
 *         ob = ob.encode()
 *     if p:             # <<<<<<<<<<<<<<
 *         p[0] = ob
 *     return ob
 */
  __pyx_t_3 = (__pyx_v_p != 0);
  if (__pyx_t_3) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":9
 *         ob = ob.encode()
 *     if p:
 *         p[0] = ob             # <<<<<<<<<<<<<<
 *     return ob
 * 
 */
    __pyx_t_5 = PyBytes_AsString(__pyx_v_ob); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_p[0]) = __pyx_t_5;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":10
 *     if p:
 *         p[0] = ob
 *     return ob             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ob);
  __pyx_r = __pyx_v_ob;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mpi4py.MPE.toBytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ob);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":17
 *     void PyErr_SetObject(object, object)
 * 
 * cdef int PyMPE_Raise(int ierr) except -1 with gil:             # <<<<<<<<<<<<<<
 *     PyErr_SetObject(RuntimeError, <long>ierr)
 *     return 0
 */

static int __pyx_f_6mpi4py_3MPE_PyMPE_Raise(int __pyx_v_ierr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("PyMPE_Raise");

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":18
 * 
 * cdef int PyMPE_Raise(int ierr) except -1 with gil:
 *     PyErr_SetObject(RuntimeError, <long>ierr)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  __pyx_t_1 = __pyx_builtin_RuntimeError;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((long)__pyx_v_ierr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyErr_SetObject(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":19
 * cdef int PyMPE_Raise(int ierr) except -1 with gil:
 *     PyErr_SetObject(RuntimeError, <long>ierr)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.PyMPE_Raise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":21
 *     return 0
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:             # <<<<<<<<<<<<<<
 *     if ierr == 0: return 0
 *     PyMPE_Raise(ierr)
 */

static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_CHKERR(int __pyx_v_ierr) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":22
 * 
 * cdef inline int CHKERR(int ierr) nogil except -1:
 *     if ierr == 0: return 0             # <<<<<<<<<<<<<<
 *     PyMPE_Raise(ierr)
 *     return -1
 */
  __pyx_t_1 = (__pyx_v_ierr == 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":23
 * cdef inline int CHKERR(int ierr) nogil except -1:
 *     if ierr == 0: return 0
 *     PyMPE_Raise(ierr)             # <<<<<<<<<<<<<<
 *     return -1
 * 
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_PyMPE_Raise(__pyx_v_ierr); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":24
 *     if ierr == 0: return 0
 *     PyMPE_Raise(ierr)
 *     return -1             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = -1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("mpi4py.MPE.CHKERR", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":44
 * cdef int logFinishAtExit = 0 # finalize at Python process exit
 * 
 * cdef inline int initialize() except -1:             # <<<<<<<<<<<<<<
 *     # Is logging active?
 *     if MPELog.Initialized() == 1:
 */

static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_initialize(void) {
  int __pyx_v_ierr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("initialize");

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":46
 * cdef inline int initialize() except -1:
 *     # Is logging active?
 *     if MPELog.Initialized() == 1:             # <<<<<<<<<<<<<<
 *         return 0
 *     # Initialize logging library
 */
  __pyx_t_1 = ((PyMPELog)->Initialized() == 1);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":47
 *     # Is logging active?
 *     if MPELog.Initialized() == 1:
 *         return 0             # <<<<<<<<<<<<<<
 *     # Initialize logging library
 *     global logInitedHere
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":50
 *     # Initialize logging library
 *     global logInitedHere
 *     cdef int ierr = 0             # <<<<<<<<<<<<<<
 *     ierr = MPELog.Init()
 *     if ierr != 0: raise RuntimeError(
 */
  __pyx_v_ierr = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":51
 *     global logInitedHere
 *     cdef int ierr = 0
 *     ierr = MPELog.Init()             # <<<<<<<<<<<<<<
 *     if ierr != 0: raise RuntimeError(
 *         "MPE logging initialization failed "
 */
  __pyx_v_ierr = (PyMPELog)->Init();

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":52
 *     cdef int ierr = 0
 *     ierr = MPELog.Init()
 *     if ierr != 0: raise RuntimeError(             # <<<<<<<<<<<<<<
 *         "MPE logging initialization failed "
 *         "[error code: %d]" % ierr)
 */
  __pyx_t_1 = (__pyx_v_ierr != 0);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":54
 *     if ierr != 0: raise RuntimeError(
 *         "MPE logging initialization failed "
 *         "[error code: %d]" % ierr)             # <<<<<<<<<<<<<<
 *     logInitedHere = 1
 *     # Register cleanup at Python exit
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_ierr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":55
 *         "MPE logging initialization failed "
 *         "[error code: %d]" % ierr)
 *     logInitedHere = 1             # <<<<<<<<<<<<<<
 *     # Register cleanup at Python exit
 *     global logFinishAtExit
 */
  __pyx_v_6mpi4py_3MPE_logInitedHere = 1;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":58
 *     # Register cleanup at Python exit
 *     global logFinishAtExit
 *     if not logFinishAtExit:             # <<<<<<<<<<<<<<
 *         if Py_AtExit(atexit) < 0:
 *             PySys_WriteStderr(
 */
  __pyx_t_1 = (!__pyx_v_6mpi4py_3MPE_logFinishAtExit);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":59
 *     global logFinishAtExit
 *     if not logFinishAtExit:
 *         if Py_AtExit(atexit) < 0:             # <<<<<<<<<<<<<<
 *             PySys_WriteStderr(
 *                 b"warning: could not register "
 */
    __pyx_t_1 = (Py_AtExit(__pyx_f_6mpi4py_3MPE_atexit) < 0);
    if (__pyx_t_1) {

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":60
 *     if not logFinishAtExit:
 *         if Py_AtExit(atexit) < 0:
 *             PySys_WriteStderr(             # <<<<<<<<<<<<<<
 *                 b"warning: could not register "
 *                 b"cleanup with Py_AtExit()\n", 0)
 */
      PySys_WriteStderr(__pyx_k_2, 0);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":63
 *                 b"warning: could not register "
 *                 b"cleanup with Py_AtExit()\n", 0)
 *         logFinishAtExit = 1             # <<<<<<<<<<<<<<
 *     return 1
 * 
 */
    __pyx_v_6mpi4py_3MPE_logFinishAtExit = 1;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":64
 *                 b"cleanup with Py_AtExit()\n", 0)
 *         logFinishAtExit = 1
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * cdef int finalize() nogil:
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mpi4py.MPE.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":66
 *     return 1
 * 
 * cdef int finalize() nogil:             # <<<<<<<<<<<<<<
 *     # Is logging active?
 *     if MPELog.Initialized() != 1:
 */

static int __pyx_f_6mpi4py_3MPE_finalize(void) {
  int __pyx_v_ierr;
  int __pyx_r;
  int __pyx_t_1;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":68
 * cdef int finalize() nogil:
 *     # Is logging active?
 *     if MPELog.Initialized() != 1:             # <<<<<<<<<<<<<<
 *         return 0
 *     # Do we initialized logging?
 */
  __pyx_t_1 = ((PyMPELog)->Initialized() != 1);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":69
 *     # Is logging active?
 *     if MPELog.Initialized() != 1:
 *         return 0             # <<<<<<<<<<<<<<
 *     # Do we initialized logging?
 *     global logInitedHere
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":72
 *     # Do we initialized logging?
 *     global logInitedHere
 *     if not logInitedHere:             # <<<<<<<<<<<<<<
 *         return 0
 *     # Finalize logging library
 */
  __pyx_t_1 = (!__pyx_v_6mpi4py_3MPE_logInitedHere);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":73
 *     global logInitedHere
 *     if not logInitedHere:
 *         return 0             # <<<<<<<<<<<<<<
 *     # Finalize logging library
 *     cdef int ierr = 0
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":75
 *         return 0
 *     # Finalize logging library
 *     cdef int ierr = 0             # <<<<<<<<<<<<<<
 *     ierr = MPELog.Finish()
 *     return ierr
 */
  __pyx_v_ierr = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":76
 *     # Finalize logging library
 *     cdef int ierr = 0
 *     ierr = MPELog.Finish()             # <<<<<<<<<<<<<<
 *     return ierr
 * 
 */
  __pyx_v_ierr = (PyMPELog)->Finish();

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":77
 *     cdef int ierr = 0
 *     ierr = MPELog.Finish()
 *     return ierr             # <<<<<<<<<<<<<<
 * 
 * cdef void atexit() nogil:
 */
  __pyx_r = __pyx_v_ierr;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":79
 *     return ierr
 * 
 * cdef void atexit() nogil:             # <<<<<<<<<<<<<<
 *     cdef int ierr = 0
 *     ierr = finalize()
 */

static void __pyx_f_6mpi4py_3MPE_atexit(void) {
  int __pyx_v_ierr;
  int __pyx_t_1;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":80
 * 
 * cdef void atexit() nogil:
 *     cdef int ierr = 0             # <<<<<<<<<<<<<<
 *     ierr = finalize()
 *     if ierr != 0: fprintf(stderr,
 */
  __pyx_v_ierr = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":81
 * cdef void atexit() nogil:
 *     cdef int ierr = 0
 *     ierr = finalize()             # <<<<<<<<<<<<<<
 *     if ierr != 0: fprintf(stderr,
 *         b"error: in MPE finalization "
 */
  __pyx_v_ierr = __pyx_f_6mpi4py_3MPE_finalize();

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":82
 *     cdef int ierr = 0
 *     ierr = finalize()
 *     if ierr != 0: fprintf(stderr,             # <<<<<<<<<<<<<<
 *         b"error: in MPE finalization "
 *         b"[code: %d]", ierr); fflush(stderr)
 */
  __pyx_t_1 = (__pyx_v_ierr != 0);
  if (__pyx_t_1) {

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":84
 *     if ierr != 0: fprintf(stderr,
 *         b"error: in MPE finalization "
 *         b"[code: %d]", ierr); fflush(stderr)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int isReady() nogil:
 */
    fprintf(stderr, __pyx_k_3, __pyx_v_ierr);
    fflush(stderr);
    goto __pyx_L3;
  }
  __pyx_L3:;

}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":86
 *         b"[code: %d]", ierr); fflush(stderr)
 * 
 * cdef inline int isReady() nogil:             # <<<<<<<<<<<<<<
 *     return (MPELog.Initialized() == 1)
 * 
 */

static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_isReady(void) {
  int __pyx_r;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":87
 * 
 * cdef inline int isReady() nogil:
 *     return (MPELog.Initialized() == 1)             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = ((PyMPELog)->Initialized() == 1);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":91
 * # -----------------------------------------------------------------------------
 * 
 * cdef inline int packArgs(object arglist, char bytebuf[]) except -1:             # <<<<<<<<<<<<<<
 *     cdef int  pos    = 0
 *     cdef char token  = 0
 */

static CYTHON_INLINE int __pyx_f_6mpi4py_3MPE_packArgs(PyObject *__pyx_v_arglist, char *__pyx_v_bytebuf) {
  int __pyx_v_pos;
  char __pyx_v_token;
  int __pyx_v_count;
  char *__pyx_v_data;
  long __pyx_v_idata;
  double __pyx_v_fdata;
  char *__pyx_v_sdata;
  PyObject *__pyx_v_arg = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  long __pyx_t_6;
  double __pyx_t_7;
  char *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("packArgs");

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":92
 * 
 * cdef inline int packArgs(object arglist, char bytebuf[]) except -1:
 *     cdef int  pos    = 0             # <<<<<<<<<<<<<<
 *     cdef char token  = 0
 *     cdef int  count  = 0
 */
  __pyx_v_pos = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":93
 * cdef inline int packArgs(object arglist, char bytebuf[]) except -1:
 *     cdef int  pos    = 0
 *     cdef char token  = 0             # <<<<<<<<<<<<<<
 *     cdef int  count  = 0
 *     cdef char *data  = NULL
 */
  __pyx_v_token = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":94
 *     cdef int  pos    = 0
 *     cdef char token  = 0
 *     cdef int  count  = 0             # <<<<<<<<<<<<<<
 *     cdef char *data  = NULL
 *     #
 */
  __pyx_v_count = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":95
 *     cdef char token  = 0
 *     cdef int  count  = 0
 *     cdef char *data  = NULL             # <<<<<<<<<<<<<<
 *     #
 *     cdef long   idata = 0
 */
  __pyx_v_data = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":97
 *     cdef char *data  = NULL
 *     #
 *     cdef long   idata = 0             # <<<<<<<<<<<<<<
 *     cdef double fdata = 0
 *     cdef char*  sdata = NULL
 */
  __pyx_v_idata = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":98
 *     #
 *     cdef long   idata = 0
 *     cdef double fdata = 0             # <<<<<<<<<<<<<<
 *     cdef char*  sdata = NULL
 *     #
 */
  __pyx_v_fdata = 0.0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":99
 *     cdef long   idata = 0
 *     cdef double fdata = 0
 *     cdef char*  sdata = NULL             # <<<<<<<<<<<<<<
 *     #
 *     cdef arg = None
 */
  __pyx_v_sdata = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":101
 *     cdef char*  sdata = NULL
 *     #
 *     cdef arg = None             # <<<<<<<<<<<<<<
 *     bytebuf[0] = 0
 *     for arg in arglist:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_arg = Py_None;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":102
 *     #
 *     cdef arg = None
 *     bytebuf[0] = 0             # <<<<<<<<<<<<<<
 *     for arg in arglist:
 *         #
 */
  (__pyx_v_bytebuf[0]) = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":103
 *     cdef arg = None
 *     bytebuf[0] = 0
 *     for arg in arglist:             # <<<<<<<<<<<<<<
 *         #
 *         if isinstance(arg, int):
 */
  if (PyList_CheckExact(__pyx_v_arglist) || PyTuple_CheckExact(__pyx_v_arglist)) {
    __pyx_t_1 = __pyx_v_arglist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_arglist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_v_arg);
    __pyx_v_arg = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":105
 *     for arg in arglist:
 *         #
 *         if isinstance(arg, int):             # <<<<<<<<<<<<<<
 *             if sizeof(long) == 4:
 *                 token = c'd'
 */
    __pyx_t_4 = ((PyObject *)((PyObject*)(&PyInt_Type)));
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_t_4); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":106
 *         #
 *         if isinstance(arg, int):
 *             if sizeof(long) == 4:             # <<<<<<<<<<<<<<
 *                 token = c'd'
 *             else:
 */
      __pyx_t_5 = ((sizeof(long)) == 4);
      if (__pyx_t_5) {

        /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":107
 *         if isinstance(arg, int):
 *             if sizeof(long) == 4:
 *                 token = c'd'             # <<<<<<<<<<<<<<
 *             else:
 *                 token = c'l'
 */
        __pyx_v_token = 'd';
        goto __pyx_L6;
      }
      /*else*/ {

        /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":109
 *                 token = c'd'
 *             else:
 *                 token = c'l'             # <<<<<<<<<<<<<<
 *             idata = arg
 *             count = 1
 */
        __pyx_v_token = 'l';
      }
      __pyx_L6:;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":110
 *             else:
 *                 token = c'l'
 *             idata = arg             # <<<<<<<<<<<<<<
 *             count = 1
 *             data = <char*>&idata
 */
      __pyx_t_6 = __Pyx_PyInt_AsLong(__pyx_v_arg); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_idata = __pyx_t_6;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":111
 *                 token = c'l'
 *             idata = arg
 *             count = 1             # <<<<<<<<<<<<<<
 *             data = <char*>&idata
 *         elif isinstance(arg, float):
 */
      __pyx_v_count = 1;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":112
 *             idata = arg
 *             count = 1
 *             data = <char*>&idata             # <<<<<<<<<<<<<<
 *         elif isinstance(arg, float):
 *             token = c'E'
 */
      __pyx_v_data = ((char *)(&__pyx_v_idata));
      goto __pyx_L5;
    }

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":113
 *             count = 1
 *             data = <char*>&idata
 *         elif isinstance(arg, float):             # <<<<<<<<<<<<<<
 *             token = c'E'
 *             fdata = arg
 */
    __pyx_t_4 = ((PyObject *)((PyObject*)(&PyFloat_Type)));
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_t_4); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":114
 *             data = <char*>&idata
 *         elif isinstance(arg, float):
 *             token = c'E'             # <<<<<<<<<<<<<<
 *             fdata = arg
 *             count = 1
 */
      __pyx_v_token = 'E';

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":115
 *         elif isinstance(arg, float):
 *             token = c'E'
 *             fdata = arg             # <<<<<<<<<<<<<<
 *             count = 1
 *             data = <char*>&fdata
 */
      __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_arg); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_fdata = __pyx_t_7;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":116
 *             token = c'E'
 *             fdata = arg
 *             count = 1             # <<<<<<<<<<<<<<
 *             data = <char*>&fdata
 *         elif isinstance(arg, bytes):
 */
      __pyx_v_count = 1;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":117
 *             fdata = arg
 *             count = 1
 *             data = <char*>&fdata             # <<<<<<<<<<<<<<
 *         elif isinstance(arg, bytes):
 *             token = c's'
 */
      __pyx_v_data = ((char *)(&__pyx_v_fdata));
      goto __pyx_L5;
    }

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":118
 *             count = 1
 *             data = <char*>&fdata
 *         elif isinstance(arg, bytes):             # <<<<<<<<<<<<<<
 *             token = c's'
 *             sdata = arg
 */
    __pyx_t_4 = ((PyObject *)((PyObject*)(&PyBytes_Type)));
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_t_4); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":119
 *             data = <char*>&fdata
 *         elif isinstance(arg, bytes):
 *             token = c's'             # <<<<<<<<<<<<<<
 *             sdata = arg
 *             count = <int>len(arg)
 */
      __pyx_v_token = 's';

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":120
 *         elif isinstance(arg, bytes):
 *             token = c's'
 *             sdata = arg             # <<<<<<<<<<<<<<
 *             count = <int>len(arg)
 *             data = <char*>sdata
 */
      __pyx_t_8 = PyBytes_AsString(__pyx_v_arg); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_sdata = __pyx_t_8;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":121
 *             token = c's'
 *             sdata = arg
 *             count = <int>len(arg)             # <<<<<<<<<<<<<<
 *             data = <char*>sdata
 *         else:
 */
      __pyx_t_9 = PyObject_Length(__pyx_v_arg); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_count = ((int)__pyx_t_9);

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":122
 *             sdata = arg
 *             count = <int>len(arg)
 *             data = <char*>sdata             # <<<<<<<<<<<<<<
 *         else:
 *             token = 0
 */
      __pyx_v_data = ((char *)__pyx_v_sdata);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":124
 *             data = <char*>sdata
 *         else:
 *             token = 0             # <<<<<<<<<<<<<<
 *             count = 0
 *             data  = NULL
 */
      __pyx_v_token = 0;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":125
 *         else:
 *             token = 0
 *             count = 0             # <<<<<<<<<<<<<<
 *             data  = NULL
 *             continue
 */
      __pyx_v_count = 0;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":126
 *             token = 0
 *             count = 0
 *             data  = NULL             # <<<<<<<<<<<<<<
 *             continue
 *         #
 */
      __pyx_v_data = NULL;

      /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":127
 *             count = 0
 *             data  = NULL
 *             continue             # <<<<<<<<<<<<<<
 *         #
 *         CHKERR( MPELog.PackBytes(bytebuf, &pos, token, count, data) )
 */
      goto __pyx_L3_continue;
    }
    __pyx_L5:;

    /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":129
 *             continue
 *         #
 *         CHKERR( MPELog.PackBytes(bytebuf, &pos, token, count, data) )             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
    __pyx_t_10 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->PackBytes(__pyx_v_bytebuf, (&__pyx_v_pos), __pyx_v_token, __pyx_v_count, __pyx_v_data)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":130
 *         #
 *         CHKERR( MPELog.PackBytes(bytebuf, &pos, token, count, data) )
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mpi4py.MPE.packArgs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":26
 *     cdef object color
 * 
 *     def __cinit__(self, name, color=None):             # <<<<<<<<<<<<<<
 *         self.commID = 0
 *         self.eventID[0] = 0
 */

static int __pyx_pf_6mpi4py_3MPE_8LogEvent___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6mpi4py_3MPE_8LogEvent___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_color = 0;
  int __pyx_v_commID;
  char *__pyx_v_cname;
  char *__pyx_v_ccolor;
  char *__pyx_v_cformat;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__color,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_color = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_color);

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":27
 * 
 *     def __cinit__(self, name, color=None):
 *         self.commID = 0             # <<<<<<<<<<<<<<
 *         self.eventID[0] = 0
 *         self.isActive = 0
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->commID = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":28
 *     def __cinit__(self, name, color=None):
 *         self.commID = 0
 *         self.eventID[0] = 0             # <<<<<<<<<<<<<<
 *         self.isActive = 0
 *         #
 */
  (((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->eventID[0]) = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":29
 *         self.commID = 0
 *         self.eventID[0] = 0
 *         self.isActive = 0             # <<<<<<<<<<<<<<
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->isActive = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":31
 *         self.isActive = 0
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD             # <<<<<<<<<<<<<<
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"blue"
 */
  __pyx_v_commID = 2;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":32
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD
 *         cdef char *cname = NULL             # <<<<<<<<<<<<<<
 *         cdef char *ccolor = b"blue"
 *         cdef char *cformat = NULL
 */
  __pyx_v_cname = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":33
 *         cdef int commID = 2 # MPI_COMM_WORLD
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"blue"             # <<<<<<<<<<<<<<
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)
 */
  __pyx_v_ccolor = __pyx_k__blue;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":34
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"blue"
 *         cdef char *cformat = NULL             # <<<<<<<<<<<<<<
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)
 */
  __pyx_v_cformat = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":35
 *         cdef char *ccolor = b"blue"
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)             # <<<<<<<<<<<<<<
 *         color = toBytes(color, &ccolor)
 *         if not isReady(): return
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_toBytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_name);
  __pyx_v_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":36
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)             # <<<<<<<<<<<<<<
 *         if not isReady(): return
 *         CHKERR( MPELog.NewEvent(commID,
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_toBytes(__pyx_v_color, (&__pyx_v_ccolor)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_color);
  __pyx_v_color = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":37
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)
 *         if not isReady(): return             # <<<<<<<<<<<<<<
 *         CHKERR( MPELog.NewEvent(commID,
 *                                 cname, ccolor, cformat,
 */
  __pyx_t_2 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_2) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":40
 *         CHKERR( MPELog.NewEvent(commID,
 *                                 cname, ccolor, cformat,
 *                                 self.eventID) )             # <<<<<<<<<<<<<<
 *         #
 *         self.commID = commID
 */
  __pyx_t_3 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->NewEvent(__pyx_v_commID, __pyx_v_cname, __pyx_v_ccolor, __pyx_v_cformat, ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->eventID)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":42
 *                                 self.eventID) )
 *         #
 *         self.commID = commID             # <<<<<<<<<<<<<<
 *         self.isActive = 1
 *         self.name  = name
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->commID = __pyx_v_commID;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":43
 *         #
 *         self.commID = commID
 *         self.isActive = 1             # <<<<<<<<<<<<<<
 *         self.name  = name
 *         self.color = color
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->isActive = 1;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":44
 *         self.commID = commID
 *         self.isActive = 1
 *         self.name  = name             # <<<<<<<<<<<<<<
 *         self.color = color
 * 
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->name);
  __Pyx_DECREF(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->name);
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->name = __pyx_v_name;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":45
 *         self.isActive = 1
 *         self.name  = name
 *         self.color = color             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self):
 */
  __Pyx_INCREF(__pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __Pyx_GOTREF(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->color);
  __Pyx_DECREF(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->color);
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->color = __pyx_v_color;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_color);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":47
 *         self.color = color
 * 
 *     def __call__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":48
 * 
 *     def __call__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":50
 *         return self
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.log()
 *         return self
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_2__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogEvent_2__enter__[] = "LogEvent.__enter__(self)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_2__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":51
 * 
 *     def __enter__(self):
 *         self.log()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":52
 *     def __enter__(self):
 *         self.log()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":54
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_3__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogEvent_3__exit__[] = "LogEvent.__exit__(self, *exc)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_3__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__");
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":55
 * 
 *     def __exit__(self, *exc):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def log(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":57
 *         return None
 * 
 *     def log(self):             # <<<<<<<<<<<<<<
 *         if not self.isActive: return
 *         if not self.commID: return
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_4log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogEvent_4log[] = "LogEvent.log(self)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_4log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("log", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "log", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":58
 * 
 *     def log(self):
 *         if not self.isActive: return             # <<<<<<<<<<<<<<
 *         if not self.commID: return
 *         if not isReady(): return
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->isActive);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":59
 *     def log(self):
 *         if not self.isActive: return
 *         if not self.commID: return             # <<<<<<<<<<<<<<
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.eventID[0], NULL) )
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->commID);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":60
 *         if not self.isActive: return
 *         if not self.commID: return
 *         if not isReady(): return             # <<<<<<<<<<<<<<
 *         CHKERR( MPELog.LogEvent(self.commID, self.eventID[0], NULL) )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":61
 *         if not self.commID: return
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.eventID[0], NULL) )             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->LogEvent(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->commID, (((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->eventID[0]), NULL)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":64
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.name
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":65
 *     property name:
 *         def __get__(self):
 *             return self.name             # <<<<<<<<<<<<<<
 * 
 *     property active:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->name);
  __pyx_r = ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->name;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":68
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return <bint> self.isActive
 *         def __set__(self, bint active):
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_6active___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_6active___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":69
 *     property active:
 *         def __get__(self):
 *             return <bint> self.isActive             # <<<<<<<<<<<<<<
 *         def __set__(self, bint active):
 *             self.isActive = active
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((int)((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->isActive)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":70
 *         def __get__(self):
 *             return <bint> self.isActive
 *         def __set__(self, bint active):             # <<<<<<<<<<<<<<
 *             self.isActive = active
 * 
 */

static int __pyx_pf_6mpi4py_3MPE_8LogEvent_6active_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_active); /*proto*/
static int __pyx_pf_6mpi4py_3MPE_8LogEvent_6active_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_active) {
  int __pyx_v_active;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_active); {
    __pyx_v_active = __Pyx_PyObject_IsTrue(__pyx_arg_active); if (unlikely((__pyx_v_active == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.active.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":71
 *             return <bint> self.isActive
 *         def __set__(self, bint active):
 *             self.isActive = active             # <<<<<<<<<<<<<<
 * 
 *     property eventID:
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->isActive = __pyx_v_active;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":74
 * 
 *     property eventID:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.eventID[0]
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_7eventID___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogEvent_7eventID___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":75
 *     property eventID:
 *         def __get__(self):
 *             return self.eventID[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_v_self)->eventID[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.LogEvent.eventID.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":86
 *     cdef object color
 * 
 *     def __cinit__(self, name, color=None):             # <<<<<<<<<<<<<<
 *         self.commID = 0
 *         self.stateID[0] = 0
 */

static int __pyx_pf_6mpi4py_3MPE_8LogState___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6mpi4py_3MPE_8LogState___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_color = 0;
  int __pyx_v_commID;
  char *__pyx_v_cname;
  char *__pyx_v_ccolor;
  char *__pyx_v_cformat;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__color,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_color = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogState.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_color);

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":87
 * 
 *     def __cinit__(self, name, color=None):
 *         self.commID = 0             # <<<<<<<<<<<<<<
 *         self.stateID[0] = 0
 *         self.stateID[1] = 0
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":88
 *     def __cinit__(self, name, color=None):
 *         self.commID = 0
 *         self.stateID[0] = 0             # <<<<<<<<<<<<<<
 *         self.stateID[1] = 0
 *         self.isActive = 0
 */
  (((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[0]) = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":89
 *         self.commID = 0
 *         self.stateID[0] = 0
 *         self.stateID[1] = 0             # <<<<<<<<<<<<<<
 *         self.isActive = 0
 *         #
 */
  (((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[1]) = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":90
 *         self.stateID[0] = 0
 *         self.stateID[1] = 0
 *         self.isActive = 0             # <<<<<<<<<<<<<<
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":92
 *         self.isActive = 0
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD             # <<<<<<<<<<<<<<
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"red"
 */
  __pyx_v_commID = 2;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":93
 *         #
 *         cdef int commID = 2 # MPI_COMM_WORLD
 *         cdef char *cname = NULL             # <<<<<<<<<<<<<<
 *         cdef char *ccolor = b"red"
 *         cdef char *cformat = NULL
 */
  __pyx_v_cname = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":94
 *         cdef int commID = 2 # MPI_COMM_WORLD
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"red"             # <<<<<<<<<<<<<<
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)
 */
  __pyx_v_ccolor = __pyx_k__red;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":95
 *         cdef char *cname = NULL
 *         cdef char *ccolor = b"red"
 *         cdef char *cformat = NULL             # <<<<<<<<<<<<<<
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)
 */
  __pyx_v_cformat = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":96
 *         cdef char *ccolor = b"red"
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)             # <<<<<<<<<<<<<<
 *         color = toBytes(color, &ccolor)
 *         if not isReady(): return
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_toBytes(__pyx_v_name, (&__pyx_v_cname)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_name);
  __pyx_v_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":97
 *         cdef char *cformat = NULL
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)             # <<<<<<<<<<<<<<
 *         if not isReady(): return
 *         CHKERR( MPELog.NewState(commID,
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_toBytes(__pyx_v_color, (&__pyx_v_ccolor)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_color);
  __pyx_v_color = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":98
 *         name  = toBytes(name,  &cname)
 *         color = toBytes(color, &ccolor)
 *         if not isReady(): return             # <<<<<<<<<<<<<<
 *         CHKERR( MPELog.NewState(commID,
 *                                 cname, ccolor, cformat,
 */
  __pyx_t_2 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_2) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":101
 *         CHKERR( MPELog.NewState(commID,
 *                                 cname, ccolor, cformat,
 *                                 self.stateID) )             # <<<<<<<<<<<<<<
 *         #
 *         self.commID = commID
 */
  __pyx_t_3 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->NewState(__pyx_v_commID, __pyx_v_cname, __pyx_v_ccolor, __pyx_v_cformat, ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":103
 *                                 self.stateID) )
 *         #
 *         self.commID = commID             # <<<<<<<<<<<<<<
 *         self.isActive = 1
 *         self.name  = name
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID = __pyx_v_commID;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":104
 *         #
 *         self.commID = commID
 *         self.isActive = 1             # <<<<<<<<<<<<<<
 *         self.name  = name
 *         self.color = color
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive = 1;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":105
 *         self.commID = commID
 *         self.isActive = 1
 *         self.name  = name             # <<<<<<<<<<<<<<
 *         self.color = color
 * 
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->name);
  __Pyx_DECREF(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->name);
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->name = __pyx_v_name;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":106
 *         self.isActive = 1
 *         self.name  = name
 *         self.color = color             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self):
 */
  __Pyx_INCREF(__pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __Pyx_GOTREF(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->color);
  __Pyx_DECREF(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->color);
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->color = __pyx_v_color;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.LogState.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_color);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":108
 *         self.color = color
 * 
 *     def __call__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":109
 * 
 *     def __call__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":111
 *         return self
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.enter()
 *         return self
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_2__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogState_2__enter__[] = "LogState.__enter__(self)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_2__enter__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":112
 * 
 *     def __enter__(self):
 *         self.enter()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__enter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":113
 *     def __enter__(self):
 *         self.enter()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.LogState.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":115
 *         return self
 * 
 *     def __exit__(self, *exc):             # <<<<<<<<<<<<<<
 *         self.exit()
 *         return None
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_3__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogState_3__exit__[] = "LogState.__exit__(self, *exc)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_3__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__");
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc = __pyx_args;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":116
 * 
 *     def __exit__(self, *exc):
 *         self.exit()             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__exit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":117
 *     def __exit__(self, *exc):
 *         self.exit()
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def enter(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.LogState.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":119
 *         return None
 * 
 *     def enter(self):             # <<<<<<<<<<<<<<
 *         if not self.isActive: return
 *         if not self.commID: return
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_4enter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogState_4enter[] = "LogState.enter(self)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_4enter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("enter");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("enter", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "enter", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":120
 * 
 *     def enter(self):
 *         if not self.isActive: return             # <<<<<<<<<<<<<<
 *         if not self.commID: return
 *         if not isReady(): return
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":121
 *     def enter(self):
 *         if not self.isActive: return
 *         if not self.commID: return             # <<<<<<<<<<<<<<
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[0], NULL) )
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":122
 *         if not self.isActive: return
 *         if not self.commID: return
 *         if not isReady(): return             # <<<<<<<<<<<<<<
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[0], NULL) )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":123
 *         if not self.commID: return
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[0], NULL) )             # <<<<<<<<<<<<<<
 * 
 *     def exit(self):
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->LogEvent(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID, (((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[0]), NULL)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogState.enter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":125
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[0], NULL) )
 * 
 *     def exit(self):             # <<<<<<<<<<<<<<
 *         if not self.isActive: return
 *         if not self.commID: return
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_5exit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_8LogState_5exit[] = "LogState.exit(self)";
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_5exit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("exit");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("exit", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "exit", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":126
 * 
 *     def exit(self):
 *         if not self.isActive: return             # <<<<<<<<<<<<<<
 *         if not self.commID: return
 *         if not isReady(): return
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":127
 *     def exit(self):
 *         if not self.isActive: return
 *         if not self.commID: return             # <<<<<<<<<<<<<<
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[1], NULL) )
 */
  __pyx_t_1 = (!((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":128
 *         if not self.isActive: return
 *         if not self.commID: return
 *         if not isReady(): return             # <<<<<<<<<<<<<<
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[1], NULL) )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":129
 *         if not self.commID: return
 *         if not isReady(): return
 *         CHKERR( MPELog.LogEvent(self.commID, self.stateID[1], NULL) )             # <<<<<<<<<<<<<<
 * 
 *     property name:
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->LogEvent(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->commID, (((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[1]), NULL)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogState.exit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":132
 * 
 *     property name:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.name
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":133
 *     property name:
 *         def __get__(self):
 *             return self.name             # <<<<<<<<<<<<<<
 * 
 *     property active:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->name);
  __pyx_r = ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->name;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":136
 * 
 *     property active:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return <bint> self.isActive
 *         def __set__(self, bint active):
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_6active___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_6active___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":137
 *     property active:
 *         def __get__(self):
 *             return <bint> self.isActive             # <<<<<<<<<<<<<<
 *         def __set__(self, bint active):
 *             self.isActive = active
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((int)((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.LogState.active.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":138
 *         def __get__(self):
 *             return <bint> self.isActive
 *         def __set__(self, bint active):             # <<<<<<<<<<<<<<
 *             self.isActive = active
 * 
 */

static int __pyx_pf_6mpi4py_3MPE_8LogState_6active_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_active); /*proto*/
static int __pyx_pf_6mpi4py_3MPE_8LogState_6active_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_active) {
  int __pyx_v_active;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_active); {
    __pyx_v_active = __Pyx_PyObject_IsTrue(__pyx_arg_active); if (unlikely((__pyx_v_active == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.LogState.active.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":139
 *             return <bint> self.isActive
 *         def __set__(self, bint active):
 *             self.isActive = active             # <<<<<<<<<<<<<<
 * 
 *     property stateID:
 */
  ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->isActive = __pyx_v_active;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":142
 * 
 *     property stateID:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return (self.stateID[0], self.stateID[1])
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_7stateID___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6mpi4py_3MPE_8LogState_7stateID___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":143
 *     property stateID:
 *         def __get__(self):
 *             return (self.stateID[0], self.stateID[1])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_v_self)->stateID[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mpi4py.MPE.LogState.stateID.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":146
 * 
 * 
 * def initLog(logfile=None):             # <<<<<<<<<<<<<<
 *     initialize()
 *     setLogFileName(logfile)
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_initLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_initLog[] = "initLog(logfile=None)";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_initLog = {__Pyx_NAMESTR("initLog"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_initLog, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_initLog)};
static PyObject *__pyx_pf_6mpi4py_3MPE_initLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_logfile = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__logfile,0};
  __Pyx_RefNannySetupContext("initLog");
  __pyx_self = __pyx_self;
  {
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__logfile);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "initLog") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_logfile = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("initLog", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.initLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":147
 * 
 * def initLog(logfile=None):
 *     initialize()             # <<<<<<<<<<<<<<
 *     setLogFileName(logfile)
 * 
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_initialize(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":148
 * def initLog(logfile=None):
 *     initialize()
 *     setLogFileName(logfile)             # <<<<<<<<<<<<<<
 * 
 * def finishLog():
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__setLogFileName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_logfile);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_logfile);
  __Pyx_GIVEREF(__pyx_v_logfile);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mpi4py.MPE.initLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":150
 *     setLogFileName(logfile)
 * 
 * def finishLog():             # <<<<<<<<<<<<<<
 *     CHKERR( finalize() )
 * 
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_1finishLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_1finishLog[] = "finishLog()";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_1finishLog = {__Pyx_NAMESTR("finishLog"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_1finishLog, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_1finishLog)};
static PyObject *__pyx_pf_6mpi4py_3MPE_1finishLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("finishLog");
  __pyx_self = __pyx_self;
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("finishLog", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "finishLog", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":151
 * 
 * def finishLog():
 *     CHKERR( finalize() )             # <<<<<<<<<<<<<<
 * 
 * def setLogFileName(filename):
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_CHKERR(__pyx_f_6mpi4py_3MPE_finalize()); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.finishLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":153
 *     CHKERR( finalize() )
 * 
 * def setLogFileName(filename):             # <<<<<<<<<<<<<<
 *     cdef char *cfilename = NULL
 *     filename = toBytes(filename, &cfilename)
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_2setLogFileName(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_2setLogFileName[] = "setLogFileName(filename)";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_2setLogFileName = {__Pyx_NAMESTR("setLogFileName"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_2setLogFileName, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_2setLogFileName)};
static PyObject *__pyx_pf_6mpi4py_3MPE_2setLogFileName(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  char *__pyx_v_cfilename;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,0};
  __Pyx_RefNannySetupContext("setLogFileName");
  __pyx_self = __pyx_self;
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setLogFileName") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setLogFileName", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.setLogFileName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_filename);

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":154
 * 
 * def setLogFileName(filename):
 *     cdef char *cfilename = NULL             # <<<<<<<<<<<<<<
 *     filename = toBytes(filename, &cfilename)
 *     CHKERR( MPELog.SetFileName(cfilename) )
 */
  __pyx_v_cfilename = NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":155
 * def setLogFileName(filename):
 *     cdef char *cfilename = NULL
 *     filename = toBytes(filename, &cfilename)             # <<<<<<<<<<<<<<
 *     CHKERR( MPELog.SetFileName(cfilename) )
 * 
 */
  __pyx_t_1 = __pyx_f_6mpi4py_3MPE_toBytes(__pyx_v_filename, (&__pyx_v_cfilename)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_filename);
  __pyx_v_filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":156
 *     cdef char *cfilename = NULL
 *     filename = toBytes(filename, &cfilename)
 *     CHKERR( MPELog.SetFileName(cfilename) )             # <<<<<<<<<<<<<<
 * 
 * def syncClocks():
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->SetFileName(__pyx_v_cfilename)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mpi4py.MPE.setLogFileName", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":158
 *     CHKERR( MPELog.SetFileName(cfilename) )
 * 
 * def syncClocks():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.SyncClocks() )
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_3syncClocks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_3syncClocks[] = "syncClocks()";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_3syncClocks = {__Pyx_NAMESTR("syncClocks"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_3syncClocks, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_3syncClocks)};
static PyObject *__pyx_pf_6mpi4py_3MPE_3syncClocks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("syncClocks");
  __pyx_self = __pyx_self;
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("syncClocks", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "syncClocks", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":159
 * 
 * def syncClocks():
 *     if not isReady(): return             # <<<<<<<<<<<<<<
 *     CHKERR( MPELog.SyncClocks() )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":160
 * def syncClocks():
 *     if not isReady(): return
 *     CHKERR( MPELog.SyncClocks() )             # <<<<<<<<<<<<<<
 * 
 * def startLog():
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->SyncClocks()); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.syncClocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":162
 *     CHKERR( MPELog.SyncClocks() )
 * 
 * def startLog():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.Start() )
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_4startLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_4startLog[] = "startLog()";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_4startLog = {__Pyx_NAMESTR("startLog"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_4startLog, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_4startLog)};
static PyObject *__pyx_pf_6mpi4py_3MPE_4startLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("startLog");
  __pyx_self = __pyx_self;
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("startLog", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "startLog", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":163
 * 
 * def startLog():
 *     if not isReady(): return             # <<<<<<<<<<<<<<
 *     CHKERR( MPELog.Start() )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":164
 * def startLog():
 *     if not isReady(): return
 *     CHKERR( MPELog.Start() )             # <<<<<<<<<<<<<<
 * 
 * def stopLog():
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->Start()); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.startLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":166
 *     CHKERR( MPELog.Start() )
 * 
 * def stopLog():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.Stop() )
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_5stopLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_5stopLog[] = "stopLog()";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_5stopLog = {__Pyx_NAMESTR("stopLog"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_5stopLog, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_5stopLog)};
static PyObject *__pyx_pf_6mpi4py_3MPE_5stopLog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("stopLog");
  __pyx_self = __pyx_self;
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("stopLog", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "stopLog", 0))) return NULL;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":167
 * 
 * def stopLog():
 *     if not isReady(): return             # <<<<<<<<<<<<<<
 *     CHKERR( MPELog.Stop() )
 * 
 */
  __pyx_t_1 = (!__pyx_f_6mpi4py_3MPE_isReady());
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":168
 * def stopLog():
 *     if not isReady(): return
 *     CHKERR( MPELog.Stop() )             # <<<<<<<<<<<<<<
 * 
 * def newLogEvent(name, color=None):
 */
  __pyx_t_2 = __pyx_f_6mpi4py_3MPE_CHKERR((PyMPELog)->Stop()); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mpi4py.MPE.stopLog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":170
 *     CHKERR( MPELog.Stop() )
 * 
 * def newLogEvent(name, color=None):             # <<<<<<<<<<<<<<
 *     cdef LogEvent event = LogEvent(name, color)
 *     return event
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_6newLogEvent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_6newLogEvent[] = "newLogEvent(name, color=None)";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_6newLogEvent = {__Pyx_NAMESTR("newLogEvent"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_6newLogEvent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_6newLogEvent)};
static PyObject *__pyx_pf_6mpi4py_3MPE_6newLogEvent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_color = 0;
  struct __pyx_obj_6mpi4py_3MPE_LogEvent *__pyx_v_event = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__color,0};
  __Pyx_RefNannySetupContext("newLogEvent");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "newLogEvent") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_color = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("newLogEvent", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.newLogEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":171
 * 
 * def newLogEvent(name, color=None):
 *     cdef LogEvent event = LogEvent(name, color)             # <<<<<<<<<<<<<<
 *     return event
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_color);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6mpi4py_3MPE_LogEvent)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_event = ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":172
 * def newLogEvent(name, color=None):
 *     cdef LogEvent event = LogEvent(name, color)
 *     return event             # <<<<<<<<<<<<<<
 * 
 * def newLogState(name, color=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_event));
  __pyx_r = ((PyObject *)__pyx_v_event);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.newLogEvent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_event);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":174
 *     return event
 * 
 * def newLogState(name, color=None):             # <<<<<<<<<<<<<<
 *     cdef LogState state = LogState(name, color)
 *     return state
 */

static PyObject *__pyx_pf_6mpi4py_3MPE_7newLogState(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6mpi4py_3MPE_7newLogState[] = "newLogState(name, color=None)";
static PyMethodDef __pyx_mdef_6mpi4py_3MPE_7newLogState = {__Pyx_NAMESTR("newLogState"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_7newLogState, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_7newLogState)};
static PyObject *__pyx_pf_6mpi4py_3MPE_7newLogState(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_color = 0;
  struct __pyx_obj_6mpi4py_3MPE_LogState *__pyx_v_state = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__color,0};
  __Pyx_RefNannySetupContext("newLogState");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "newLogState") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_color = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("newLogState", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("mpi4py.MPE.newLogState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":175
 * 
 * def newLogState(name, color=None):
 *     cdef LogState state = LogState(name, color)             # <<<<<<<<<<<<<<
 *     return state
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_color);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6mpi4py_3MPE_LogState)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_state = ((struct __pyx_obj_6mpi4py_3MPE_LogState *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":176
 * def newLogState(name, color=None):
 *     cdef LogState state = LogState(name, color)
 *     return state             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_state));
  __pyx_r = ((PyObject *)__pyx_v_state);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mpi4py.MPE.newLogState", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_state);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6mpi4py_3MPE_LogEvent(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6mpi4py_3MPE_LogEvent *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6mpi4py_3MPE_LogEvent *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  p->color = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_6mpi4py_3MPE_8LogEvent___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6mpi4py_3MPE_LogEvent(PyObject *o) {
  struct __pyx_obj_6mpi4py_3MPE_LogEvent *p = (struct __pyx_obj_6mpi4py_3MPE_LogEvent *)o;
  Py_XDECREF(p->name);
  Py_XDECREF(p->color);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6mpi4py_3MPE_LogEvent(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6mpi4py_3MPE_LogEvent *p = (struct __pyx_obj_6mpi4py_3MPE_LogEvent *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->color) {
    e = (*v)(p->color, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6mpi4py_3MPE_LogEvent(PyObject *o) {
  struct __pyx_obj_6mpi4py_3MPE_LogEvent *p = (struct __pyx_obj_6mpi4py_3MPE_LogEvent *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->color);
  p->color = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogEvent_name(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogEvent_4name___get__(o);
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogEvent_active(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogEvent_6active___get__(o);
}

static int __pyx_setprop_6mpi4py_3MPE_8LogEvent_active(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6mpi4py_3MPE_8LogEvent_6active_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogEvent_eventID(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogEvent_7eventID___get__(o);
}

static PyMethodDef __pyx_methods_6mpi4py_3MPE_LogEvent[] = {
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogEvent_2__enter__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogEvent_2__enter__)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogEvent_3__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogEvent_3__exit__)},
  {__Pyx_NAMESTR("log"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogEvent_4log, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogEvent_4log)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6mpi4py_3MPE_LogEvent[] = {
  {(char *)"name", __pyx_getprop_6mpi4py_3MPE_8LogEvent_name, 0, 0, 0},
  {(char *)"active", __pyx_getprop_6mpi4py_3MPE_8LogEvent_active, __pyx_setprop_6mpi4py_3MPE_8LogEvent_active, 0, 0},
  {(char *)"eventID", __pyx_getprop_6mpi4py_3MPE_8LogEvent_eventID, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LogEvent = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  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_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

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

static PyBufferProcs __pyx_tp_as_buffer_LogEvent = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6mpi4py_3MPE_LogEvent = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("mpi4py.MPE.LogEvent"), /*tp_name*/
  sizeof(struct __pyx_obj_6mpi4py_3MPE_LogEvent), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6mpi4py_3MPE_LogEvent, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_LogEvent, /*tp_as_number*/
  &__pyx_tp_as_sequence_LogEvent, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LogEvent, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_6mpi4py_3MPE_8LogEvent_1__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LogEvent, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6mpi4py_3MPE_LogEvent, /*tp_traverse*/
  __pyx_tp_clear_6mpi4py_3MPE_LogEvent, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6mpi4py_3MPE_LogEvent, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6mpi4py_3MPE_LogEvent, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6mpi4py_3MPE_LogEvent, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_6mpi4py_3MPE_LogState(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6mpi4py_3MPE_LogState *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6mpi4py_3MPE_LogState *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  p->color = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_6mpi4py_3MPE_8LogState___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6mpi4py_3MPE_LogState(PyObject *o) {
  struct __pyx_obj_6mpi4py_3MPE_LogState *p = (struct __pyx_obj_6mpi4py_3MPE_LogState *)o;
  Py_XDECREF(p->name);
  Py_XDECREF(p->color);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6mpi4py_3MPE_LogState(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6mpi4py_3MPE_LogState *p = (struct __pyx_obj_6mpi4py_3MPE_LogState *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->color) {
    e = (*v)(p->color, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6mpi4py_3MPE_LogState(PyObject *o) {
  struct __pyx_obj_6mpi4py_3MPE_LogState *p = (struct __pyx_obj_6mpi4py_3MPE_LogState *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->color);
  p->color = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogState_name(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogState_4name___get__(o);
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogState_active(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogState_6active___get__(o);
}

static int __pyx_setprop_6mpi4py_3MPE_8LogState_active(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6mpi4py_3MPE_8LogState_6active_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6mpi4py_3MPE_8LogState_stateID(PyObject *o, void *x) {
  return __pyx_pf_6mpi4py_3MPE_8LogState_7stateID___get__(o);
}

static PyMethodDef __pyx_methods_6mpi4py_3MPE_LogState[] = {
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogState_2__enter__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogState_2__enter__)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogState_3__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogState_3__exit__)},
  {__Pyx_NAMESTR("enter"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogState_4enter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogState_4enter)},
  {__Pyx_NAMESTR("exit"), (PyCFunction)__pyx_pf_6mpi4py_3MPE_8LogState_5exit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mpi4py_3MPE_8LogState_5exit)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6mpi4py_3MPE_LogState[] = {
  {(char *)"name", __pyx_getprop_6mpi4py_3MPE_8LogState_name, 0, 0, 0},
  {(char *)"active", __pyx_getprop_6mpi4py_3MPE_8LogState_active, __pyx_setprop_6mpi4py_3MPE_8LogState_active, 0, 0},
  {(char *)"stateID", __pyx_getprop_6mpi4py_3MPE_8LogState_stateID, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LogState = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  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*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  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_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

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

static PyBufferProcs __pyx_tp_as_buffer_LogState = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6mpi4py_3MPE_LogState = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("mpi4py.MPE.LogState"), /*tp_name*/
  sizeof(struct __pyx_obj_6mpi4py_3MPE_LogState), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6mpi4py_3MPE_LogState, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_LogState, /*tp_as_number*/
  &__pyx_tp_as_sequence_LogState, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LogState, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pf_6mpi4py_3MPE_8LogState_1__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LogState, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6mpi4py_3MPE_LogState, /*tp_traverse*/
  __pyx_tp_clear_6mpi4py_3MPE_LogState, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6mpi4py_3MPE_LogState, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6mpi4py_3MPE_LogState, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6mpi4py_3MPE_LogState, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("MPE"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_n_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 1},
  {&__pyx_n_s__MPI, __pyx_k__MPI, sizeof(__pyx_k__MPI), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s____doc__, __pyx_k____doc__, sizeof(__pyx_k____doc__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s__color, __pyx_k__color, sizeof(__pyx_k__color), 0, 0, 1, 1},
  {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
  {&__pyx_n_s__enter, __pyx_k__enter, sizeof(__pyx_k__enter), 0, 0, 1, 1},
  {&__pyx_n_s__exit, __pyx_k__exit, sizeof(__pyx_k__exit), 0, 0, 1, 1},
  {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
  {&__pyx_n_s__finishLog, __pyx_k__finishLog, sizeof(__pyx_k__finishLog), 0, 0, 1, 1},
  {&__pyx_n_s__initLog, __pyx_k__initLog, sizeof(__pyx_k__initLog), 0, 0, 1, 1},
  {&__pyx_n_s__log, __pyx_k__log, sizeof(__pyx_k__log), 0, 0, 1, 1},
  {&__pyx_n_s__logfile, __pyx_k__logfile, sizeof(__pyx_k__logfile), 0, 0, 1, 1},
  {&__pyx_n_s__mpi4py, __pyx_k__mpi4py, sizeof(__pyx_k__mpi4py), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__newLogEvent, __pyx_k__newLogEvent, sizeof(__pyx_k__newLogEvent), 0, 0, 1, 1},
  {&__pyx_n_s__newLogState, __pyx_k__newLogState, sizeof(__pyx_k__newLogState), 0, 0, 1, 1},
  {&__pyx_n_s__setLogFileName, __pyx_k__setLogFileName, sizeof(__pyx_k__setLogFileName), 0, 0, 1, 1},
  {&__pyx_n_s__startLog, __pyx_k__startLog, sizeof(__pyx_k__startLog), 0, 0, 1, 1},
  {&__pyx_n_s__stopLog, __pyx_k__stopLog, sizeof(__pyx_k__stopLog), 0, 0, 1, 1},
  {&__pyx_n_s__syncClocks, __pyx_k__syncClocks, sizeof(__pyx_k__syncClocks), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initMPE(void); /*proto*/
PyMODINIT_FUNC initMPE(void)
#else
PyMODINIT_FUNC PyInit_MPE(void); /*proto*/
PyMODINIT_FUNC PyInit_MPE(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_MPE(void)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("MPE"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_mpi4py__MPE) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_6mpi4py_3MPE_MPI = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_6mpi4py_3MPE_LogEvent) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LogEvent", (PyObject *)&__pyx_type_6mpi4py_3MPE_LogEvent) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6mpi4py_3MPE_LogEvent = &__pyx_type_6mpi4py_3MPE_LogEvent;
  if (PyType_Ready(&__pyx_type_6mpi4py_3MPE_LogState) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LogState", (PyObject *)&__pyx_type_6mpi4py_3MPE_LogState) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6mpi4py_3MPE_LogState = &__pyx_type_6mpi4py_3MPE_LogState;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":1
 * __doc__ = """             # <<<<<<<<<<<<<<
 * Multi-Processing Environment
 * """
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____doc__, ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":8
 * 
 * cdef object MPI
 * from mpi4py import MPI             # <<<<<<<<<<<<<<
 * MPI = None
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__MPI));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__MPI));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__MPI));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__mpi4py), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MPI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_6mpi4py_3MPE_MPI);
  __Pyx_DECREF(__pyx_v_6mpi4py_3MPE_MPI);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_6mpi4py_3MPE_MPI = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":9
 * cdef object MPI
 * from mpi4py import MPI
 * MPI = None             # <<<<<<<<<<<<<<
 * 
 * # -----------------------------------------------------------------------------
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_6mpi4py_3MPE_MPI);
  __Pyx_DECREF(__pyx_v_6mpi4py_3MPE_MPI);
  __Pyx_GIVEREF(Py_None);
  __pyx_v_6mpi4py_3MPE_MPI = Py_None;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":41
 *     int Py_AtExit(void (*)())
 * 
 * cdef int logInitedHere = 0 # initialized from this module             # <<<<<<<<<<<<<<
 * cdef int logFinishAtExit = 0 # finalize at Python process exit
 * 
 */
  __pyx_v_6mpi4py_3MPE_logInitedHere = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/helpers.pxi":42
 * 
 * cdef int logInitedHere = 0 # initialized from this module
 * cdef int logFinishAtExit = 0 # finalize at Python process exit             # <<<<<<<<<<<<<<
 * 
 * cdef inline int initialize() except -1:
 */
  __pyx_v_6mpi4py_3MPE_logFinishAtExit = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":146
 * 
 * 
 * def initLog(logfile=None):             # <<<<<<<<<<<<<<
 *     initialize()
 *     setLogFileName(logfile)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_initLog, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__initLog, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":150
 *     setLogFileName(logfile)
 * 
 * def finishLog():             # <<<<<<<<<<<<<<
 *     CHKERR( finalize() )
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_1finishLog, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__finishLog, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":153
 *     CHKERR( finalize() )
 * 
 * def setLogFileName(filename):             # <<<<<<<<<<<<<<
 *     cdef char *cfilename = NULL
 *     filename = toBytes(filename, &cfilename)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_2setLogFileName, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__setLogFileName, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":158
 *     CHKERR( MPELog.SetFileName(cfilename) )
 * 
 * def syncClocks():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.SyncClocks() )
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_3syncClocks, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__syncClocks, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":162
 *     CHKERR( MPELog.SyncClocks() )
 * 
 * def startLog():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.Start() )
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_4startLog, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__startLog, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":166
 *     CHKERR( MPELog.Start() )
 * 
 * def stopLog():             # <<<<<<<<<<<<<<
 *     if not isReady(): return
 *     CHKERR( MPELog.Stop() )
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_5stopLog, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stopLog, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":170
 *     CHKERR( MPELog.Stop() )
 * 
 * def newLogEvent(name, color=None):             # <<<<<<<<<<<<<<
 *     cdef LogEvent event = LogEvent(name, color)
 *     return event
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_6newLogEvent, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__newLogEvent, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/devel/mpi4py-1.3/src/MPE/MPE.pyx":174
 *     return event
 * 
 * def newLogState(name, color=None):             # <<<<<<<<<<<<<<
 *     cdef LogState state = LogState(name, color)
 *     return state
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6mpi4py_3MPE_7newLogState, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__newLogState, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_RegisterCleanup()) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    __Pyx_AddTraceback("init mpi4py.MPE", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init mpi4py.MPE");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static void __Pyx_CleanupGlobals(void) {
}
static PyObject *__pyx_module_cleanup(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *unused) {
  /*--- Global cleanup code ---*/
  Py_DECREF(__pyx_v_6mpi4py_3MPE_MPI); __pyx_v_6mpi4py_3MPE_MPI = 0;
  __Pyx_CleanupGlobals();
  /*--- Type import cleanup code ---*/
  /*--- Builtin cleanup code ---*/
  Py_DECREF(__pyx_builtin_RuntimeError); __pyx_builtin_RuntimeError = 0;
  /*--- Intern cleanup code ---*/
  Py_DECREF(__pyx_empty_tuple); __pyx_empty_tuple = 0;
  Py_INCREF(Py_None); return Py_None;
}

/* Runtime support code */

#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

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

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    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 {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static int __Pyx_RegisterCleanup(void) {
    /* Don't use Py_AtExit because that has a 32-call limit
     * and is called after python finalization.
     */

    PyObject *cleanup_func = 0;
    PyObject *atexit = 0;
    PyObject *reg = 0;
    PyObject *args = 0;
    PyObject *res = 0;
    int ret = -1;

    cleanup_func = PyCFunction_New(&cleanup_def, 0);
    args = PyTuple_New(1);
    if (!cleanup_func || !args)
        goto bad;
    PyTuple_SET_ITEM(args, 0, cleanup_func);
    cleanup_func = 0;

    atexit = __Pyx_ImportModule("atexit");
    if (!atexit)
        goto bad;
    reg = __Pyx_GetAttrString(atexit, "register");
    if (!reg)
        goto bad;
    res = PyObject_CallObject(reg, args);
    if (!res)
        goto bad;
    ret = 0;
bad:
    Py_XDECREF(cleanup_func);
    Py_XDECREF(atexit);
    Py_XDECREF(reg);
    Py_XDECREF(args);
    Py_XDECREF(res);
    return ret;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_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;
    #if PY_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

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

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*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(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
