From dc3b431829afa616f11f3d781bfabe573e54f40c Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Wed, 5 Jun 2013 22:40:03 -0700 Subject: Fix Python 3 compatibility of BytecodeCache by checking for `if isinstance(filename, text_type)` instead of `if isinstance(filename, unicode)` --- jinja2/bccache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jinja2/bccache.py b/jinja2/bccache.py index b534e27..f2f9db6 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() -- cgit v1.2.1