summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-10-13 09:42:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-10-13 09:42:23 -0400
commitf367d2a09b87d96a9af1f7bbe9b24f291cb1fe35 (patch)
treef8a3289b90f3cf3a04bf5d8e1e74b9abd818025e /coverage/control.py
parent3cc77a351c13f632047ca9f631148dba1fa703a4 (diff)
downloadpython-coveragepy-git-f367d2a09b87d96a9af1f7bbe9b24f291cb1fe35.tar.gz
Jython reports $py.class files in the trace function, so adapt to find the source file.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 28c8850f..cdaf9721 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -231,6 +231,11 @@ class coverage(object):
dunder_file = frame.f_globals.get('__file__')
if dunder_file:
filename = self._source_for_file(dunder_file)
+
+ # Jython reports the .class file to the tracer, use the source file.
+ if filename.endswith("$py.class"):
+ filename = filename[:-9] + ".py"
+
canonical = self.file_locator.canonical_filename(filename)
# If the user specified source, then that's authoritative about what to