Stack traces from non-DEBUG exceptions can't find source lines when DEBUG 500 pages can.
|Reported by:||nedbatchelder||Owned by:||mtredinnick|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The DEBUG exception page uses its own code to load source lines and produce a stack trace. If DEBUG is false, the traceback module is used instead. In some environments, the DEBUG code will find source lines when the traceback module will not. For example, we run our code from an egg under 2.4, and traceback can't find the source.
This patch refactors the exception reporting in the debug code so that the non-debug case can make use of it to produce the same simple stack trace, but with the full power to load source from exotic locations.
The refactoring in views/debug.py is significant, but is pure refactoring. There had been a number of functions in the views/debug.py module which manipulated the exception values, and built stack traces. These have been unified into a class. This simplifies the data flow, since we no longer have functions taking and returning three or four values (a sure code smell that a class is appropriate).
Change History (5)
Changed 8 years ago by nedbatchelder
comment:1 Changed 8 years ago by nedbatchelder
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset