MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / pybind11_translate_exception

Function pybind11_translate_exception

imperative/python/src/pyext17.h:65–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63// refer to pybind11 for the following exception handling helper
64
65inline void pybind11_translate_exception(std::exception_ptr last_exception) {
66 auto& registered_exception_translators =
67 pybind11::detail::get_internals().registered_exception_translators;
68 for (auto& translator : registered_exception_translators) {
69 try {
70 translator(last_exception);
71 } catch (...) {
72 last_exception = std::current_exception();
73 continue;
74 }
75 return;
76 }
77 PyErr_SetString(
78 PyExc_SystemError, "Exception escaped from default exception translator!");
79}
80
81inline void pybind11_translate_exception() {
82 pybind11_translate_exception(std::current_exception());

Callers 1

init_tensorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected