summaryrefslogtreecommitdiff
path: root/coverage/codeunit.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-04-15 13:22:51 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-04-15 13:22:51 -0400
commit341ae4222fbba91987dac1ff0d2debe5c0c8ef99 (patch)
treec2492004e594b7a61c3750fc0d365d38f014dbc5 /coverage/codeunit.py
parentc2284d65bdb56cd1eb56c3e53228892824189732 (diff)
downloadpython-coveragepy-git-341ae4222fbba91987dac1ff0d2debe5c0c8ef99.tar.gz
If a module was loaded from a .pyc, report its file as .py
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 221d677a..96ed43bb 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__'):