don't swallow Python errors in tree iteration

Summary:
During the sequence of events that led up to S169085 we tried an hg
push that resulted in an error that looked like this: "RuntimeError:
std::exception". I believe that error was caused by an uncaught
pyexception, replacing Python's current thread exception with a
useless one.

Catch the pyexception and deal with it appropriately.

Reviewed By: quark-zju

Differential Revision: D13112735

fbshipit-source-id: 301d899543ae95084b890c19b00322e69ded07b2
This commit is contained in:
Chad Austin 2018-11-20 14:58:47 -08:00 committed by Facebook Github Bot
parent 38cc6a356c
commit e62d26feae

View File

@ -298,6 +298,8 @@ static PyObject* newtreeiter_iternext(py_newtreeiter* self) {
p2Node,
(Py_ssize_t)BIN_NODE_SIZE);
}
} catch (const pyexception&) {
return NULL;
} catch (const std::exception& ex) {
PyErr_SetString(PyExc_RuntimeError, ex.what());
return NULL;