if I do something like
>>> x = int(1,2,3,4,5)
I immediately get a fatal error (one that would end program execution if it was in
As Ignacio Vazquez-Abrams said:
Raising an exception in C is done by setting the exception object or string and then returning NULL from the function.
There are convenience functions which make this easy to do for common exception types. For example, PyErr_NoMemory can be used like this:
PyObject *my_function(void)
{
return PyErr_NoMemory(); // Sets the exception and returns NULL
}
Raising an exception in C is done by setting the exception object or string and then returning NULL
from the function.