diff options
author | Stephan Richter <stephan.richter@gmail.com> | 2019-01-27 14:37:40 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-01-28 21:37:24 -0500 |
commit | 1655796d48cb67d7247b41a09fe5c2463b32d47a (patch) | |
tree | 44f1ffc1d491ed4161af7af0dcfdb2e4501150ec /coverage/files.py | |
parent | 21d3b37e290796312750f207442b33afbaab14de (diff) | |
download | python-coveragepy-git-1655796d48cb67d7247b41a09fe5c2463b32d47a.tar.gz |
Make sure that the cache is properly filled. (25x speedup on our system that has a large sys.path.)
It is always a bad idea to reassign the cachekey during the computation.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py index b328f653..d9495912 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -59,6 +59,7 @@ def canonical_filename(filename): """ if filename not in CANONICAL_FILENAME_CACHE: + cf = filename if not os.path.isabs(filename): for path in [os.curdir] + sys.path: if path is None: @@ -69,9 +70,9 @@ def canonical_filename(filename): except UnicodeError: exists = False if exists: - filename = f + cf = f break - cf = abs_file(filename) + cf = abs_file(cf) CANONICAL_FILENAME_CACHE[filename] = cf return CANONICAL_FILENAME_CACHE[filename] |