summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/template/backends/jinja2.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/template/backends/jinja2.py b/django/template/backends/jinja2.py
index d1e5217b51..f0540d389c 100644
--- a/django/template/backends/jinja2.py
+++ b/django/template/backends/jinja2.py
@@ -99,8 +99,7 @@ def get_exception_info(exception):
if source is None:
exception_file = Path(exception.filename)
if exception_file.exists():
- with open(exception_file, 'r') as fp:
- source = fp.read()
+ source = exception_file.read_text()
if source is not None:
lines = list(enumerate(source.strip().split('\n'), start=1))
during = lines[lineno - 1][1]