Message152294
This was discussed a little more in the python-dev thread for PEP 409, but both Guido and I have been burned in the past by badly written libraries that replaced detailed exceptions that explained *exactly* what was going wrong with bland, generic "it broke!" exceptions that told us nothing. What should have been a 5 minute fix turns into a long bug hunt because useful information was being thrown away.
With __context__ always being set, all you need to do to cope with inappropriate use of "raise X from None" by libraries is write your own exception handler that always reports the entire exception chain, regardless of the __cause__ setting. If "raise X from None" actually *clobbers* the context, though, you instead have to go in and try to get hold of the detailed exception information *before* it gets clobbered (which is a lot harder to do). |
|
Date |
User |
Action |
Args |
2012-01-30 00:22:25 | ncoghlan | set | recipients:
+ ncoghlan, georg.brandl, rhettinger, pitrou, draghuram, aronacher, ezio.melotti, eric.araujo, mrabarnett, steven.daprano, poke, ethan.furman, catalin.iacob |
2012-01-30 00:22:25 | ncoghlan | set | messageid: <1327882945.46.0.467662392754.issue6210@psf.upfronthosting.co.za> |
2012-01-30 00:22:24 | ncoghlan | link | issue6210 messages |
2012-01-30 00:22:24 | ncoghlan | create | |
|