Opened 10 years ago

Closed 6 years ago

#3200 closed defect (worksforme)

[patch] fix missing stack segments in debug.py views

Reported by: robin@… Owned by: nobody
Component: Generic views Version:
Severity: normal Keywords: debug
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The django/views/debug.py function technical_500_response misses stack elements which it cannot find source for. This is a common problem because django imports modules in a peculiar way so that all the filenames seem to miss the leading package. I have a patch which inserts default values when the source isn't found. This allows the full stack trace to be seen in the prettified view and some of the variables at least can be inspected. However, for obvious reasons context cannot be seen.

Attachments (2)

views.py.patch (912 bytes) - added by robin@… 10 years ago.
patch against 4207
debug.py.patch (908 bytes) - added by robin@… 10 years ago.
improved patch against 4207

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by robin@…

Attachment: views.py.patch added

patch against 4207

comment:1 Changed 10 years ago by robin@…

Summary: fix missing stack segments in debug.py views[patch]fix missing stack segments in debug.py views

comment:2 Changed 10 years ago by Simon G. <dev@…>

Keywords: debug added
Summary: [patch]fix missing stack segments in debug.py views[patch] fix missing stack segments in debug.py views
Triage Stage: UnreviewedReady for checkin

comment:3 Changed 10 years ago by robin@…

I have a slightly improved patch. Under certain circumstances evaluating tb.tb_frame.f_locals.items() may cause an error; that creates even greater confusion. The solution is to safely evaluate that list.

Changed 10 years ago by robin@…

Attachment: debug.py.patch added

improved patch against 4207

comment:4 Changed 10 years ago by Adrian Holovaty

Triage Stage: Ready for checkinAccepted

Before I check this in, I'd like to understand it a bit better. Could you provide a situation in which the stack elements are incomplete?

comment:5 Changed 6 years ago by Adam Nelson

Resolution: worksforme
Status: newclosed

I've never seen any issues with tracebacks and they're formatted nicely - maybe this was a problem with pre-1.0 django?

Note: See TracTickets for help on using tickets.
Back to Top