diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index abd0c67b9..1ed23fb91 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -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::to_string(lineno) - + "): " + handle(f_code->co_name).cast() + '\n'; + result += " "; + result += handle(f_code->co_filename).cast(); + result += '('; + result += std::to_string(lineno); + result += "):) "; + result += handle(f_code->co_name).cast(); + result += '\n'; frame = frame->f_back; Py_DECREF(f_code); }