summaryrefslogtreecommitdiff
path: root/django/views/debug.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/views/debug.py')
-rw-r--r--django/views/debug.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 10b4d22030..425ad296b2 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -17,7 +17,7 @@ from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_str
from django.utils.module_loading import import_string
from django.utils.regex_helper import _lazy_re_compile
-from django.utils.version import PY311, get_docs_version
+from django.utils.version import get_docs_version
from django.views.decorators.debug import coroutine_functions_to_sensitive_variables
# Minimal Django templates engine to render the error templates
@@ -567,22 +567,19 @@ class ExceptionReporter:
post_context = []
colno = tb_area_colno = ""
- if PY311:
- _, _, start_column, end_column = next(
- itertools.islice(
- tb.tb_frame.f_code.co_positions(), tb.tb_lasti // 2, None
- )
+ _, _, start_column, end_column = next(
+ itertools.islice(
+ tb.tb_frame.f_code.co_positions(), tb.tb_lasti // 2, None
)
- if start_column and end_column:
- underline = "^" * (end_column - start_column)
- spaces = " " * (start_column + len(str(lineno + 1)) + 2)
- colno = f"\n{spaces}{underline}"
- tb_area_spaces = " " * (
- 4
- + start_column
- - (len(context_line) - len(context_line.lstrip()))
- )
- tb_area_colno = f"\n{tb_area_spaces}{underline}"
+ )
+ if start_column and end_column:
+ underline = "^" * (end_column - start_column)
+ spaces = " " * (start_column + len(str(lineno + 1)) + 2)
+ colno = f"\n{spaces}{underline}"
+ tb_area_spaces = " " * (
+ 4 + start_column - (len(context_line) - len(context_line.lstrip()))
+ )
+ tb_area_colno = f"\n{tb_area_spaces}{underline}"
yield {
"exc_cause": exc_cause,
"exc_cause_explicit": exc_cause_explicit,