From 097530ba14637df14054e6cd66a65da4d33f3591 Mon Sep 17 00:00:00 2001 From: akarin Date: Sun, 5 Mar 2023 22:55:13 +0900 Subject: [PATCH] src/cython/vapoursynth.pyx: include Python traceback in map errors Signed-off-by: akarin --- src/cython/vapoursynth.pyx | 4 ++-- test/async_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cython/vapoursynth.pyx b/src/cython/vapoursynth.pyx index c381251b7..7f7ebf3d2 100644 --- a/src/cython/vapoursynth.pyx +++ b/src/cython/vapoursynth.pyx @@ -2616,7 +2616,7 @@ cdef void __stdcall publicFilterFunction(const VSMap *inm, VSMap *outm, void *us ret = {'clip':ret} dictToMap(ret, outm, core, _vsapi) except BaseException, e: - emsg = str(e).encode('utf-8') + emsg = (str(e) + '\n\n' + traceback.format_exc()).encode('utf-8') _vsapi.mapSetError(outm, emsg) cdef Plugin createPlugin(VSPlugin *plugin, const VSAPI *funcs, Core core): @@ -2826,7 +2826,7 @@ cdef void __stdcall publicFunction(const VSMap *inm, VSMap *outm, void *userData ret = {'val':ret} dictToMap(ret, outm, core, vsapi) except BaseException, e: - emsg = str(e).encode('utf-8') + emsg = (str(e) + '\n\n' + traceback.format_exc()).encode('utf-8') vsapi.mapSetError(outm, emsg) diff --git a/test/async_test.py b/test/async_test.py index fc44cfb02..ee2265038 100644 --- a/test/async_test.py +++ b/test/async_test.py @@ -63,7 +63,7 @@ def test_raw_cb_fail(self): self.assertEqual(self.cb_node, self.fail_filter) self.assertEqual(self.cb_n, 0) self.assertIsInstance(self.cb_result, vs.Error) - self.assertEqual(str(self.cb_result), "Fail") + self.assertEqual(str(self.cb_result)[:6], "Fail\n\n") def test_raw_cb_fut_slow(self): fut = Future()