This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients iritkatriel
Date 2020-11-27.10:11:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606471868.96.0.673168968518.issue42482@roundup.psfhosted.org>
In-reply-to
Content
TracebackException holds a reference to the exc_traceback, which is wrong because (1) it's supposed to capture the output without holding references to real things. (2) it makes comparison wrong for equivalent exceptions, as in this example:

------------------------------------------
import sys
import traceback

excs = []
for _ in range(2):
    try:
        1/0
    except:
        excs.append(traceback.TracebackException(*sys.exc_info()))

print('formats equal: ', list(excs[0].format()) == list(excs[0].format()))
print('excs equal: ', excs[0] == excs[1])
excs[0].exc_traceback = excs[1].exc_traceback = None
print('excs equal w/o exc_traceback: ', excs[0] == excs[1])

------------------------------------------
Output:

formats equal:  True
excs equal:  False
excs equal w/o exc_traceback:  True

------------------------------------------


The good news is that it's only used to check for non-None (added here https://bugs.python.org/issue24695) so should be easy to remove.
History
Date User Action Args
2020-11-27 10:11:08iritkatrielsetrecipients: + iritkatriel
2020-11-27 10:11:08iritkatrielsetmessageid: <1606471868.96.0.673168968518.issue42482@roundup.psfhosted.org>
2020-11-27 10:11:08iritkatriellinkissue42482 messages
2020-11-27 10:11:08iritkatrielcreate