Author ncoghlan
Recipients Vjacheslav.Fyodorov, docs@python, ezio.melotti, michael.foord, ncoghlan, r.david.murray, rbcollins, subho, vstinner
Date 2017-02-19.05:55:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487483716.05.0.864910383037.issue23890@psf.upfronthosting.co.za>
In-reply-to
Content
I've been looking into this further, and a reproducer that's independent of assertRaises() is to just bind the function to a local variable name in an outer function:

    def outer():
        callable_obj = f
        try:
            callable_obj()
        except Exception as exc:
            return exc

That should make it easier to test a basic recursive "clear_all_frames" operation like:

    def clear_all_frames(exc):
        cause = exc.__cause__
        if cause is not None:
            clear_all_frames(cause)
        context = exc.__context__
        if context is not None:
            clear_all_frames(context)
        traceback.clear_frames(exc.__traceback__)
History
Date User Action Args
2017-02-19 05:55:16ncoghlansetrecipients: + ncoghlan, vstinner, rbcollins, ezio.melotti, r.david.murray, michael.foord, docs@python, Vjacheslav.Fyodorov, subho
2017-02-19 05:55:16ncoghlansetmessageid: <1487483716.05.0.864910383037.issue23890@psf.upfronthosting.co.za>
2017-02-19 05:55:16ncoghlanlinkissue23890 messages
2017-02-19 05:55:15ncoghlancreate