From acbe3c1880aa4dae41d5d882a37526fd2121389a Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 23 Jul 2018 06:43:21 +0200 Subject: [PATCH] catch exceptions out of the python notify callback and ignore them --- bindings/python/src/session.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) {