Beispiel #1
0
func exception() error {
	if C.PyErr_Occurred() == nil {
		return syscall.EFAULT
	}

	var t, v, tb *C.PyObject
	C.PyErr_Fetch(&t, &v, &tb)

	return newError(newObject(t), newObject(v), tb)
}
Beispiel #2
0
func exception() error {
	if C.PyErr_Occurred() == nil {
		return nil
	}

	var t, v, tb *C.PyObject

	defer C.xdecref(v)

	C.PyErr_Fetch(&t, &v, &tb)

	return &Error{newObject(t), newObject(v), tb}
}
Beispiel #3
0
// PyObject* PyErr_Occurred()
// Return value: Borrowed reference.
// Test whether the error indicator is set. If set, return the exception type (the first argument to the last call to one of the PyErr_Set*() functions or to PyErr_Restore()). If not set, return NULL. You do not own a reference to the return value, so you do not need to Py_DECREF() it.
//
// Note Do not compare the return value to a specific exception; use PyErr_ExceptionMatches() instead, shown below. (The comparison could easily fail since the exception may be an instance instead of a class, in the case of a class exception, or it may the a subclass of the expected exception.)
func PyErr_Occurred() *PyObject {
	return togo(C.PyErr_Occurred())
}
Beispiel #4
0
func exceptionRaised() bool {
	return C.PyErr_Occurred() != nil
}