refactor: walk tracebacks by attribute in error_already_set::what() (#6228)
* refactor: walk tracebacks by attribute in error_already_set::what()
Read tb_next, tb_frame, f_back, co_filename and co_name through attribute
access and use the public PyFrame_GetCode/PyFrame_GetLineNumber functions,
instead of poking traceback, frame and code object struct fields, which are
not part of the stable ABI.
See https://github.com/pybind/pybind11/discussions/6104 (B6).
Assisted-by: ClaudeCode:claude-opus-5-5
* docs: clarify secondary exception suppression during formatting
— codex GPT-6 on behalf of Ralf —
Document that failed notes and traceback attribute lookups silently discard
all secondary exception types, including KeyboardInterrupt and SystemError.
Also note the audit hooks triggered by tb_frame access.
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2 files changed