Issue 8992: convertsimple() doesn't need to call converterr() if an exception was already raised (original) (raw)

If convertitem() result is not NULL, an error occured and seterror() is called (by the function calling convertitem()). seterror() does nothing if an exception was raised (if PyErr_Occurred() is non zero).

convertitem() doesn't need to call converterr() if an exception occurred because the string formatted by converterr() will be ignored. We just need to return a non NULL pointer: msgbuf.

Attached patch creates a RETURN_ERR_OCCURRED macro. convertsimple() should be a little bit faster and the code is more readable. Details: