[docs] [issue23890] assertRaises increases reference counter
Nick Coghlan
report at bugs.python.org
Sun Feb 19 00:55:16 EST 2017
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 <report at bugs.python.org>
<http://bugs.python.org/issue23890>
_______________________________________
More information about the docs
mailing list