There are functions that may not be called with an error set, for example:
/* PyObject_Repr() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
caller loses its exception */
assert(!_PyErr_Occurred(tstate));
But this is not asserted for most of the C API functions.
In Python, it is not possible to execute code when there is an in-flight exception so C API should not allow that either and it should be checked for all API functions.