diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-09 23:07:17 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-09 23:07:17 -0400 |
| commit | e77d640c49188a4fb912dadc15d4582580d3c34d (patch) | |
| tree | beb22ce2ed2720f20eb48b66dc15a33f2edee580 /mako | |
| parent | 50170dd4bd9d8cd902493973c4222c8f7c7fd539 (diff) | |
| download | external_python_mako-e77d640c49188a4fb912dadc15d4582580d3c34d.tar.gz external_python_mako-e77d640c49188a4fb912dadc15d4582580d3c34d.tar.bz2 external_python_mako-e77d640c49188a4fb912dadc15d4582580d3c34d.zip | |
Use utf-8 encoding for traceback source with no encoding in py3k
Added a default encoding of "utf-8" when the :class:`.RichTraceback`
object retrieves Python source lines from a Python traceback; as these
are bytes in Python 3 they need to be decoded so that they can be
formatted in the template.
Fixes: #293
Change-Id: I41a5c09422d6500c7cab2423ed14ac951a64e2f4
Diffstat (limited to 'mako')
| -rw-r--r-- | mako/exceptions.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mako/exceptions.py b/mako/exceptions.py index cb6fb3f..e2d78bd 100644 --- a/mako/exceptions.py +++ b/mako/exceptions.py @@ -214,6 +214,8 @@ class RichTraceback(object): # A normal .py file (not a Template) fp = open(new_trcback[-1][0], 'rb') encoding = util.parse_encoding(fp) + if compat.py3k and not encoding: + encoding = 'utf-8' fp.seek(0) self.source = fp.read() fp.close() |
