If you look into the THPUtils_invalidArguments function, you can see here 1 that it raises a python error with the string provided by the format_invalid_args function.
Also in the generated code template here 4, you can see that all the functions are encapsulated by the HANDLE_TH_ERRORS macro.
These macros are defined here 3 and as you can see they let all python error go through without modifying them.