Message 152294 - Python tracker (original) (raw)

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).