MCPcopy Create free account
hub / github.com/ceph/ceph / peek_pyerror

Function peek_pyerror

src/mgr/PyModule.cc:146–158  ·  view source on GitHub ↗

* Get the single-line exception message, without clearing any * exception state. */

Source from the content-addressed store, hash-verified

144 * exception state.
145 */
146std::string peek_pyerror()
147{
148 PyObject *ptype, *pvalue, *ptraceback;
149 PyErr_Fetch(&ptype, &pvalue, &ptraceback);
150 ceph_assert(ptype);
151 ceph_assert(pvalue);
152 PyObject *pvalue_str = PyObject_Str(pvalue);
153 std::string exc_msg = PyUnicode_AsUTF8(pvalue_str);
154 Py_DECREF(pvalue_str);
155 PyErr_Restore(ptype, pvalue, ptraceback);
156
157 return exc_msg;
158}
159
160std::span<std::byte const> py_bytes_as_span(PyObject *bytes)
161{

Callers 4

serveMethod · 0.85
handle_commandMethod · 0.85
handle_pyerrorFunction · 0.85
load_subclass_ofMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected