summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-27 09:55:02 +0200
committerGitHub <noreply@github.com>2021-09-27 09:55:02 +0200
commitfb05ca420da1341c0d39cf1f0e2fb659be836c92 (patch)
treef8a80565a66121a4930f096a092f599a1773a1f3 /django/template
parent5bac1719a2fcbee5cb8b9e22c3480e3a24ed6c4c (diff)
Used Path.read_text() in jinja2.get_exception_info().
Diffstat (limited to 'django/template')
-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]