summaryrefslogtreecommitdiff
path: root/coverage/codeunit.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/codeunit.py')
-rw-r--r--coverage/codeunit.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py
index 221d677..96ed43b 100644
--- a/coverage/codeunit.py
+++ b/coverage/codeunit.py
@@ -57,6 +57,9 @@ class CodeUnit:
f = morf.__file__
else:
f = morf
+ # .pyc files should always refer to a .py instead.
+ if f.endswith('.pyc'):
+ f = f[:-1]
self.filename = file_locator.canonical_filename(f)
if hasattr(morf, '__name__'):