Nick Coghlan added the comment:

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__)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to