classification
Title: TracebackException saves more data than it needs for format
Type: performance Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, iritkatriel
Priority: normal Keywords: patch

Created on 2021-01-09 19:11 by iritkatriel, last changed 2021-01-15 02:46 by gvanrossum. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24179 merged iritkatriel, 2021-01-09 19:14
Messages (4)
msg384738 - (view) Author: Irit Katriel (iritkatriel) * (Python triager) Date: 2021-01-09 19:11
TracebackException saves both __cause__ and __context__ even though format() ignores the __context__ if there is __cause__.

If we change the constructor to save only what format() needs, it will save space and simplify the code.
msg385082 - (view) Author: Irit Katriel (iritkatriel) * (Python triager) Date: 2021-01-14 19:59
As discussed on the PR: Since __context__ is documented, we can't just optimize it away. Instead we add a new param "compact", defaulted to False, which controls whether this optimization should be applied. 

Module level functions in traceback pass True since they don't access __context__ directly.
msg385096 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-15 02:45
New changeset 4c94d74152a511d977fe26a4f3a32b7352ba9024 by Irit Katriel in branch 'master':
bpo-42877: add the 'compact' param to TracebackException's __init__ (#24179)
https://github.com/python/cpython/commit/4c94d74152a511d977fe26a4f3a32b7352ba9024
msg385097 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-15 02:46
Thanks!
History
Date User Action Args
2021-01-15 02:46:07gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg385097

stage: patch review -> resolved
2021-01-15 02:45:14gvanrossumsetmessages: + msg385096
2021-01-14 19:59:04iritkatrielsetmessages: + msg385082
2021-01-13 14:01:51iritkatrielsettitle: TracebackException saves more data than it needs -> TracebackException saves more data than it needs for format
2021-01-09 19:15:18iritkatrielsetnosy: + gvanrossum
2021-01-09 19:14:18iritkatrielsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23005
2021-01-09 19:11:00iritkatrielcreate