Opened 13 months ago

Closed 6 months ago

#33701 closed New feature (fixed)

Highlight error location in the technical 500 debug page on Python 3.11+.

Reported by: Adam Johnson Owned by: Giebisch
Component: Error reporting Version: dev
Severity: Normal Keywords:
Cc: Hrushikesh Vaidya, Keryn Knight Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Johnson)

Similar to these tickets for extending the debug page for Python 3.11 exception changes: #33747, #33752.

Python 3.11 adds "where in the line" highlighting to tracebacks:

$ python3.11 t.py
Traceback (most recent call last):
  File "/.../example.py", line 5, in <module>
    formula(1, 0)
    ^^^^^^^^^^^^^
  File "/.../example.py", line 2, in formula
    return a / b + b / a
           ~~^~~
ZeroDivisionError: division by zero

Release note: https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-error-locations-in-tracebacks

It would be good if we could use this on Django's error pages as well.

The new code column information API may be required: https://docs.python.org/3.11/whatsnew/3.11.html#column-information-for-code-objects . Note it can be disabled.

Change History (15)

comment:1 Changed 13 months ago by Mariusz Felisiak

Summary: Python 3.11 error location traceback highlightingHighlight error location in the technical 500 debug page on Python 3.11+.
Triage Stage: UnreviewedSomeday/Maybe

Thanks for the ticket. Let's wait for the final release first.

comment:2 Changed 13 months ago by Hrushikesh Vaidya

Cc: Hrushikesh Vaidya added

comment:3 Changed 12 months ago by Adam Johnson

Relatedly I also opened #33747 to show exception notes, another feature in Python 3.11

comment:4 Changed 12 months ago by Keryn Knight

Cc: Keryn Knight added

comment:5 Changed 12 months ago by Adam Johnson

Description: modified (diff)

comment:6 Changed 7 months ago by Mariusz Felisiak

Triage Stage: Someday/MaybeAccepted

comment:7 Changed 7 months ago by Giebisch

Owner: set to Giebisch
Status: newassigned

comment:8 Changed 7 months ago by Giebisch

Has patch: set

I've created a PR (https://github.com/django/django/pull/16250).
Somehow I am not completely satisfied with the code, so I appreciate feedback.
Still passes all tests and works also with older Python versions.

comment:9 Changed 7 months ago by Mariusz Felisiak

Needs tests: set
Patch needs improvement: set

comment:10 Changed 7 months ago by Giebisch

Needs tests: unset
Patch needs improvement: unset

comment:11 Changed 7 months ago by Adam Johnson

Patch needs improvement: set

comment:12 Changed 7 months ago by Giebisch

Patch needs improvement: unset

comment:13 Changed 7 months ago by Mariusz Felisiak

Patch needs improvement: set

comment:14 Changed 6 months ago by Mariusz Felisiak

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:15 Changed 6 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 85b52d22:

Fixed #33701 -- Added fine-grained error locations to the technical 500 debug page.

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