Message308269
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. |
|
| Date |
User |
Action |
Args |
| 2017-12-14 00:06:28 | Garrett Berg | set | recipients:
+ Garrett Berg |
| 2017-12-14 00:06:27 | Garrett Berg | set | messageid: <1513209987.98.0.213398074469.issue32317@psf.upfronthosting.co.za> |
| 2017-12-14 00:06:27 | Garrett Berg | link | issue32317 messages |
| 2017-12-14 00:06:27 | Garrett Berg | create | |
|