[py3] Decoded the parsed source file encoding in debug view

This commit is contained in:
Claude Paroz 2012-10-08 10:04:29 +02:00
parent 88cc002e16
commit 4797ad80da
2 changed files with 4 additions and 1 deletions

View File

@ -360,7 +360,7 @@ class ExceptionReporter(object):
# (http://www.python.org/dev/peps/pep-0263/) # (http://www.python.org/dev/peps/pep-0263/)
match = re.search(br'coding[:=]\s*([-\w.]+)', line) match = re.search(br'coding[:=]\s*([-\w.]+)', line)
if match: if match:
encoding = match.group(1) encoding = match.group(1).decode('ascii')
break break
source = [six.text_type(sline, encoding, 'replace') for sline in source] source = [six.text_type(sline, encoding, 'replace') for sline in source]

View File

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import inspect import inspect