[Django] #28485: Stack trace report silently drops frames without source code

7 views
Skip to first unread message

Django

unread,
Aug 9, 2017, 10:42:46 PM8/9/17
to django-...@googlegroups.com
#28485: Stack trace report silently drops frames without source code
---------------------------------------------+------------------------
Reporter: Martin von Gagern | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
Recently I encountered a strange situation: I got an exception for a bad
method signature, but the stack trace shown by Django in the error
response did not even mention the method in question. I added a
{{{traceback.print_exc()}}} to the last report function, and there on
standard error I could see some more frames. They were without source
code, but with file name, line number and method name. The reason why they
were without source code was that their source was not directly accessible
as a file on disk. They had been loaded via a custom loading procedure.
The fact that there was no indication at all in the report was quite
confusing.

In [https://github.com/django/django/pull/8880 GitHub #8880] I'm proposing
a fix for this. If we fail to load the source file, we no longer drop the
frame but present what information we have, namely file name, line number
and function name, plus a warning about the unavability of the source file
in place of the actual source test.

Note that having a [https://www.python.org/dev/peps/pep-0302/#optional-
extensions-to-the-importer-protocol PEP 302] {{{__loader__}}} to the
generated module to provide a {{{get_source}}} method is a way of
supporting source code even for generated or custom-loaded code, and it is
supported by Django. So this change here does not affect all generated or
custom-loaded code, only those parts which don't make use of such a
loader.

--
Ticket URL: <https://code.djangoproject.com/ticket/28485>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 9, 2017, 10:43:36 PM8/9/17
to django-...@googlegroups.com
#28485: Stack trace report silently drops frames without source code
-----------------------------------+--------------------------------------

Reporter: Martin von Gagern | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Martin von Gagern):

* Attachment "f51ded156e1b8ef8b59bc10b01100de6c3021ab3.patch" added.

GitHub8880.patch

Django

unread,
Aug 10, 2017, 5:33:48 AM8/10/17
to django-...@googlegroups.com
#28485: Stack trace report silently drops frames without source code
-----------------------------------+--------------------------------------

Reporter: Martin von Gagern | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by Srinivas Reddy Thatiparthy):

PR is here - https://github.com/django/django/pull/8880

--
Ticket URL: <https://code.djangoproject.com/ticket/28485#comment:1>

Django

unread,
Aug 10, 2017, 10:02:17 AM8/10/17
to django-...@googlegroups.com
#28485: Make ExceptionReporter.get_traceback_frames() include frames without source
code
-----------------------------------+------------------------------------

Reporter: Martin von Gagern | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28485#comment:2>

Django

unread,
Aug 12, 2017, 8:56:22 PM8/12/17
to django-...@googlegroups.com
#28485: Make ExceptionReporter.get_traceback_frames() include frames without source
code
-------------------------------------+-------------------------------------
Reporter: Martin von Gagern | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed

Component: Error reporting | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* owner: (none) => Tim Graham <timograham@…>
* resolution: => fixed


Comment:

In [changeset:"71d39571f46701a5a65adf8bf21005a177cda11f" 71d39571]:
{{{
#!CommitTicketReference repository=""
revision="71d39571f46701a5a65adf8bf21005a177cda11f"
Fixed #28485 -- Made ExceptionReporter.get_traceback_frames() include
frames without source code.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28485#comment:3>

Reply all
Reply to author
Forward
0 new messages