Nick Coghlan <ncogh...@gmail.com> added the comment: Ah, you're absolutely right. Interestingly though, the old recursive implementation appeared to have the same bug, and I'd deliberately used the recursive approach precisely so that suppressed exceptions *would* get cleared correctly. I must have managed to leave a loophole somewhere :(
I also realised simply overwriting the context isn't correct in all cases, and have adjusted the test cases accordingly. ---------- title: Use __suppress_context__ in contextlib.ExitStack.__exit__ -> Exception context is not suppressed correctly in contextlib.ExitStack.__exit__ type: enhancement -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14969> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com