0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Used Path.read_text() in jinja2.get_exception_info().

This commit is contained in:
Mariusz Felisiak 2021-09-27 09:55:02 +02:00 committed by GitHub
parent 5bac1719a2
commit fb05ca420d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,8 +99,7 @@ def get_exception_info(exception):
if source is None: if source is None:
exception_file = Path(exception.filename) exception_file = Path(exception.filename)
if exception_file.exists(): if exception_file.exists():
with open(exception_file, 'r') as fp: source = exception_file.read_text()
source = fp.read()
if source is not None: if source is not None:
lines = list(enumerate(source.strip().split('\n'), start=1)) lines = list(enumerate(source.strip().split('\n'), start=1))
during = lines[lineno - 1][1] during = lines[lineno - 1][1]