summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-10-11 22:10:22 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-10-11 22:10:22 -0400
commita42ed2905db033b68d2f24a35dd4b360bf4376c2 (patch)
treebfa000b54a9f6a751156a5cd59475844c639e771 /coverage/control.py
parentc84ee62303ba0a4feb12d36db5e1bb2f0938a9c6 (diff)
downloadpython-coveragepy-a42ed2905db033b68d2f24a35dd4b360bf4376c2.tar.gz
Fix a problem with PyPy 2.4
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 43e440b..e351b00 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -244,6 +244,12 @@ class Coverage(object):
for m in (atexit, os, platform, random, socket, _structseq):
if m is not None and hasattr(m, "__file__"):
self.pylib_dirs.add(self._canonical_dir(m))
+ if _structseq and not hasattr(_structseq, '__file__'):
+ # Pypy 2.4 has no __file__ in the builtin modules, but the code
+ # objects still have the filenames. So dig into one to find
+ # the path to exclude.
+ structseq_file = _structseq.structseq_new.func_code.co_filename
+ self.pylib_dirs.add(self._canonical_dir(structseq_file))
# To avoid tracing the coverage code itself, we skip anything located
# where we are.