From be947ae278c1655d2f949d4e4e17ccc0c11478d6 Mon Sep 17 00:00:00 2001 From: Steven Reitsma Date: Tue, 20 Oct 2026 19:38:42 +0200 Subject: [PATCH] fix: register exception translator as module-local The global exception translator ended with a catch-all for std::exception, so it intercepted C++ exceptions thrown by other pybind11 modules imported before pulsar (e.g. duckdb) and turned them into RuntimeError, bypassing those modules' own translators. Registering it with register_local_exception_translator limits it to exceptions thrown from _pulsar, leaving other modules' translation intact. Fixes #314 --- src/exceptions.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/exceptions.cc b/src/exceptions.cc index b3ec7755..60bf79fc 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -143,7 +143,7 @@ static PythonExceptionMap createPythonExceptionMap(py::module_& m, py::exception void export_exceptions(py::module_& m) { static py::exception base{m, "PulsarException"}; static auto exceptions = createPythonExceptionMap(m, base); - py::register_exception_translator([](std::exception_ptr e) { + py::register_local_exception_translator([](std::exception_ptr e) { try { if (e) { std::rethrow_exception(e);