From: Marc Abramowitz Date: Thu, 6 Jun 2013 05:40:03 +0000 (-0700) Subject: Fix Python 3 compatibility of BytecodeCache by checking for `if X-Git-Tag: 2.7.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc3b431829afa616f11f3d781bfabe573e54f40c;p=thirdparty%2Fjinja.git Fix Python 3 compatibility of BytecodeCache by checking for `if isinstance(filename, text_type)` instead of `if isinstance(filename, unicode)` --- diff --git a/jinja2/bccache.py b/jinja2/bccache.py index b534e271..f2f9db61 100644 --- a/jinja2/bccache.py +++ b/jinja2/bccache.py @@ -21,7 +21,7 @@ import tempfile import fnmatch from hashlib import sha1 from jinja2.utils import open_if_exists -from jinja2._compat import BytesIO, pickle, PY2 +from jinja2._compat import BytesIO, pickle, PY2, text_type # marshal works better on 3.x, one hack less required @@ -160,7 +160,7 @@ class BytecodeCache(object): hash = sha1(name.encode('utf-8')) if filename is not None: filename = '|' + filename - if isinstance(filename, unicode): + if isinstance(filename, text_type): filename = filename.encode('utf-8') hash.update(filename) return hash.hexdigest()