Garrett Berg <googb...@gmail.com> added the comment: I found a workaround, and probably the reason this has not been detected before:
import sys def doclear2() try: 1/0 except ZeroDivisionError: sys.exc_clear() try: 1/0 except ZeroDivisionError: exc = sys.exc_info()[0] print("third exc (before doclear):", exc) doclear2() exc = sys.exc_info()[0] print("third exc (after doclear):", exc) assert sys.exc_info()[0] is ZeroDivisionError The above passes. It seems that being inside a local exception block allows for the spec to hold, only the "local exception" is cleared. I still think this is a pretty major bug, but it is good to know what the workaround/reason it's "been working" is. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32317> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com