Catch a pending Python exception and return the corresponding Status. If no exception is pending, Status::OK() is returned.
| 47 | // Catch a pending Python exception and return the corresponding Status. |
| 48 | // If no exception is pending, Status::OK() is returned. |
| 49 | inline Status CheckPyError(StatusCode code = StatusCode::UnknownError) { |
| 50 | if (ARROW_PREDICT_TRUE(!PyErr_Occurred())) { |
| 51 | return Status::OK(); |
| 52 | } else { |
| 53 | return ConvertPyError(code); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | #define RETURN_IF_PYERROR() ARROW_RETURN_NOT_OK(CheckPyError()) |
| 58 |