diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index 97e2e1841..b2f5890fa 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -482,8 +482,8 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb result += str(value).cast(); } -#if !defined(PYPY_VERSION) if (trace) { +#if !defined(PYPY_VERSION) auto *tb = (PyTracebackObject *) trace; // Get the deepest trace possible. @@ -507,8 +507,8 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb frame = frame->f_back; Py_DECREF(f_code); } - } #endif + } return result; }