mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-02 09:57:14 +00:00
Optimize error_string creation
This commit is contained in:
parent
b90bd783f0
commit
3286964fea
@ -502,9 +502,13 @@ error_string(PyObject *exc_type, PyObject *exc_value, PyObject *exc_trace) {
|
|||||||
Py_INCREF(f_code);
|
Py_INCREF(f_code);
|
||||||
# endif
|
# endif
|
||||||
int lineno = PyFrame_GetLineNumber(frame);
|
int lineno = PyFrame_GetLineNumber(frame);
|
||||||
result += std::string(" ") + handle(f_code->co_filename).cast<std::string>() + '('
|
result += " ";
|
||||||
+ std::to_string(lineno)
|
result += handle(f_code->co_filename).cast<std::string>();
|
||||||
+ "): " + handle(f_code->co_name).cast<std::string>() + '\n';
|
result += '(';
|
||||||
|
result += std::to_string(lineno);
|
||||||
|
result += "):) ";
|
||||||
|
result += handle(f_code->co_name).cast<std::string>();
|
||||||
|
result += '\n';
|
||||||
frame = frame->f_back;
|
frame = frame->f_back;
|
||||||
Py_DECREF(f_code);
|
Py_DECREF(f_code);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user