diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 6032d725c..970824132 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -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) {