Skip to content

Commit 42bc068

Browse files
committed
use pybind11::builtin_exception
1 parent 4a236bb commit 42bc068

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_exceptions.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
// shared exceptions for cross_module_tests
66

7-
class tmp_e : public std::runtime_error {
7+
class PYBIND11_EXPORT tmp_e : public pybind11::builtin_exception {
88
public:
9-
explicit tmp_e() : std::runtime_error("") {}
9+
using builtin_exception::builtin_exception;
10+
explicit tmp_e() : tmp_e("") {}
11+
void set_error() const override { PyErr_SetString(PyExc_RuntimeError, what()); }
1012
};

0 commit comments

Comments
 (0)