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:
Valentin Bartenev 2019-11-14 17:48:48 +03:00
parent e189d0a96c
commit e9429324c2

View file

@ -425,6 +425,7 @@ nxt_python_request_handler(nxt_unit_request_info_t *req)
if (nxt_slow_path(iterator == NULL)) {
nxt_unit_req_error(req, "the application returned "
"not an iterable object");
PyErr_Print();
goto fail;
}