1# -----------------------------------------------------------------------------
2
3cdef inline int comm_set_eh(MPI_Comm ob) nogil except -1:
4    if ob == MPI_COMM_NULL: return 0
5    cdef int opt = options.errors
6    if   opt == 0: pass
7    elif opt == 1: CHKERR( MPI_Comm_set_errhandler(ob, MPI_ERRORS_RETURN) )
8    elif opt == 2: CHKERR( MPI_Comm_set_errhandler(ob, MPI_ERRORS_ARE_FATAL) )
9    return 0
10
11cdef inline int win_set_eh(MPI_Win ob) nogil except -1:
12    if ob == MPI_WIN_NULL: return 0
13    cdef int opt = options.errors
14    if   opt == 0: pass
15    elif opt == 1: CHKERR( MPI_Win_set_errhandler(ob, MPI_ERRORS_RETURN) )
16    elif opt == 2: CHKERR( MPI_Win_set_errhandler(ob, MPI_ERRORS_ARE_FATAL) )
17    return 0
18
19cdef inline int file_set_eh(MPI_File ob) nogil except -1:
20    if ob == MPI_FILE_NULL: return 0
21    cdef int opt = options.errors
22    if   opt == 0: pass
23    elif opt == 1: CHKERR( MPI_File_set_errhandler(ob, MPI_ERRORS_RETURN) )
24    elif opt == 2: CHKERR( MPI_File_set_errhandler(ob, MPI_ERRORS_ARE_FATAL) )
25    return 0
26
27# -----------------------------------------------------------------------------
28