diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-11-17 16:06:16 +0000 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-11-17 16:06:16 +0000 |
commit | 3243add2eee93ee3c23afa1f04bc15d72dab479e (patch) | |
tree | 6958a4437e5ed808a6a31f3c9457f91a4115cb33 /coverage/files.py | |
parent | 724dba8e31ca636a120a71c3cc74449ef470a5e1 (diff) | |
download | python-coveragepy-3243add2eee93ee3c23afa1f04bc15d72dab479e.tar.gz |
Don't collapse in an ascii-only file-world. #533
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py index 9de4849..af2fe52 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 |