summaryrefslogtreecommitdiff
path: root/coverage/python.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-25 18:13:39 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-25 18:13:39 -0400
commitaf84377e61971aa8ae279b4611ae23dfc6567da8 (patch)
tree0a1d61161a25c9cc9a3715ad9b92f324c8976171 /coverage/python.py
parente23f267505a42513d3ff6b636dda7425ec9052f8 (diff)
downloadpython-coveragepy-af84377e61971aa8ae279b4611ae23dfc6567da8.tar.gz
Use unicode_filename more, and account for missing filesystemencoding
Diffstat (limited to 'coverage/python.py')
-rw-r--r--coverage/python.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/coverage/python.py b/coverage/python.py
index fe32150..a4247ce 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -96,8 +96,7 @@ class PythonFileReporter(FileReporter):
else:
filename = morf
- if env.PY2 and isinstance(filename, str):
- filename = filename.decode(sys.getfilesystemencoding())
+ filename = files.unicode_filename(filename)
# .pyc files should always refer to a .py instead.
if filename.endswith(('.pyc', '.pyo')):
@@ -110,8 +109,7 @@ class PythonFileReporter(FileReporter):
if hasattr(morf, '__name__'):
name = morf.__name__
name = name.replace(".", os.sep) + ".py"
- if isinstance(name, bytes):
- name = name.decode(sys.getfilesystemencoding())
+ name = files.unicode_filename(name)
else:
name = files.relative_filename(filename)
self.relname = name