New submission from Anton Abrosimov <abrosimov....@gmail.com>:
1. Move internal dependencies (`FrameSummary`, `StackSummary`) to class attributes. Reduce coupling. 2. Separate receiving, processing and presenting traceback information. How to replace `repr` with `pformat` in `FrameSummary`? def __init__(...): ... self.locals = {k: repr(v) for k, v in locals.items()} if locals else None ... 3. Move formatting templates to class attributes. 4. ... Motivation: 1. For the sake of small changes to the view, you have to rewrite the entire `TracebackException` hierarchy. Or use string parsing. 2.1. During development, I want to see as much information as possible. 2.2. During production, displaying unnecessary information can lead to security problems. 2.3. In large projects, it is more convenient to use JSON for further processing in the system environment. I have not found any PEPs describing `traceback.py`. I can make a prototype of the changes if anyone is interested. ---------- components: Library (Lib) messages: 401528 nosy: abrosimov.a.a priority: normal severity: normal status: open title: Refactor traceback.py to make TracebackException more extensible. type: enhancement versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45158> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com