Python: improved error handling if response object isn't iterable.
According to the documentation, PyObject_GetIter(): | Raises TypeError and returns NULL if the object cannot be iterated. Previously, this exception wasn't printed or cleared and remained unhandled.
This commit is contained in:
@@ -425,6 +425,7 @@ nxt_python_request_handler(nxt_unit_request_info_t *req)
|
|||||||
if (nxt_slow_path(iterator == NULL)) {
|
if (nxt_slow_path(iterator == NULL)) {
|
||||||
nxt_unit_req_error(req, "the application returned "
|
nxt_unit_req_error(req, "the application returned "
|
||||||
"not an iterable object");
|
"not an iterable object");
|
||||||
|
PyErr_Print();
|
||||||
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user