summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-23 06:43:32 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-11-23 06:43:32 -0500
commitff212b66ddbdbf123cc0c43811fa7a331ce7de92 (patch)
treef92a6adf1ce462a865389ce1930c5d995112aecb
parent54b6c9b9189cdd4575a41158ad6159a92753e159 (diff)
downloadpython-coveragepy-ff212b66ddbdbf123cc0c43811fa7a331ce7de92.tar.gz
Use a 2/3 name for unicode
-rw-r--r--coverage/phystokens.py4
-rw-r--r--tests/helpers.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index 9a697b6..a2b23cf 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -11,7 +11,7 @@ import token
import tokenize
from coverage import env
-from coverage.backward import iternext
+from coverage.backward import iternext, unicode_class
from coverage.misc import contract
@@ -281,7 +281,7 @@ def compile_unicode(source, filename, mode):
"""
source = neuter_encoding_declaration(source)
- if env.PY2 and isinstance(filename, unicode):
+ if env.PY2 and isinstance(filename, unicode_class):
filename = filename.encode(sys.getfilesystemencoding(), "replace")
code = compile(source, filename, mode)
return code
diff --git a/tests/helpers.py b/tests/helpers.py
index f4bff2b..ebc15cd 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -8,6 +8,7 @@ import subprocess
import sys
from coverage import env
+from coverage.backward import unicode_class
from coverage.misc import output_encoding
@@ -17,7 +18,7 @@ def run_command(cmd):
Returns the exit status code and the combined stdout and stderr.
"""
- if env.PY2 and isinstance(cmd, unicode):
+ if env.PY2 and isinstance(cmd, unicode_class):
cmd = cmd.encode(sys.getfilesystemencoding())
# In some strange cases (PyPy3 in a virtualenv!?) the stdout encoding of