catch exceptions out of the python notify callback and ignore them

This commit is contained in:
arvidn 2018-07-23 06:43:21 +02:00 committed by Arvid Norberg
parent dcb8b816a3
commit acbe3c1880
1 changed files with 7 additions and 1 deletions

View File

@ -388,7 +388,7 @@ namespace
}
#endif // TORRENT_ABI_VERSION
void alert_notify(object cb)
void alert_notify(object cb) try
{
lock_gil lock;
if (cb)
@ -396,6 +396,12 @@ namespace
cb();
}
}
catch (boost::python::error_already_set const&)
{
// this callback isn't supposed to throw an error.
// just swallow and ignore the exception
TORRENT_ASSERT_FAIL_VAL("python notify callback threw exception");
}
void set_alert_notify(lt::session& s, object cb)
{