Beispiel #1
0
// void PyErr_SetString(PyObject *type, const char *message)
// This is the most common way to set the error indicator. The first argument specifies the exception type; it is normally one of the standard exceptions, e.g. PyExc_RuntimeError. You need not increment its reference count. The second argument is an error message; it is converted to a string object.
func PyErr_SetString(typ *PyObject, message string) {
	c_message := C.CString(message)
	defer C.free(unsafe.Pointer(c_message))
	C.PyErr_SetString(topy(typ), c_message)
}
Beispiel #2
0
Datei: err.go Projekt: gemrs/gem
func Raise(err error) {
	C.PyErr_SetString(C.PyExc_RuntimeError, C.CString(err.Error()))
}