summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-17 16:06:16 +0000
committerNed Batchelder <ned@nedbatchelder.com>2016-11-17 16:06:16 +0000
commit929297eef803362c3b6156751e81b2d84e5ff4c4 (patch)
treeb080839032a47608a9cc823d4732eeb49c71ed25 /coverage/files.py
parentaf724468a47be24056d684ce836251124c052f19 (diff)
downloadpython-coveragepy-git-929297eef803362c3b6156751e81b2d84e5ff4c4.tar.gz
Don't collapse in an ascii-only file-world. #533
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py
index 9de4849c..af2fe52f 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -63,7 +63,11 @@ def canonical_filename(filename):
if path is None:
continue
f = os.path.join(path, filename)
- if os.path.exists(f):
+ try:
+ exists = os.path.exists(f)
+ except UnicodeError:
+ exists = False
+ if exists:
filename = f
break
cf = abs_file(filename)
@@ -147,7 +151,11 @@ else:
def abs_file(filename):
"""Return the absolute normalized form of `filename`."""
path = os.path.expandvars(os.path.expanduser(filename))
- path = os.path.abspath(os.path.realpath(path))
+ try:
+ path = os.path.realpath(path)
+ except UnicodeError:
+ pass
+ path = os.path.abspath(path)
path = actual_path(path)
path = unicode_filename(path)
return path