mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-02 01:47:12 +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);
|
||||
# endif
|
||||
int lineno = PyFrame_GetLineNumber(frame);
|
||||
result += std::string(" ") + handle(f_code->co_filename).cast<std::string>() + '('
|
||||
+ std::to_string(lineno)
|
||||
+ "): " + handle(f_code->co_name).cast<std::string>() + '\n';
|
||||
result += " ";
|
||||
result += handle(f_code->co_filename).cast<std::string>();
|
||||
result += '(';
|
||||
result += std::to_string(lineno);
|
||||
result += "):) ";
|
||||
result += handle(f_code->co_name).cast<std::string>();
|
||||
result += '\n';
|
||||
frame = frame->f_back;
|
||||
Py_DECREF(f_code);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user