summaryrefslogtreecommitdiff
path: root/coverage/inorout.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-18 21:58:36 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-11-25 14:34:14 -0500
commitb489fe6f84d6705fe46b123d36ab50a04f70a9bd (patch)
treee6bd4ef4273adcf67cb98632d9eb16f6e505df62 /coverage/inorout.py
parente6b883903e6f0eb396d35d43ff82c3c5644af84c (diff)
downloadpython-coveragepy-git-b489fe6f84d6705fe46b123d36ab50a04f70a9bd.tar.gz
Don't try to use PyPy 'filenames' like '<builtin>/lib_pypy/_structseq.py'
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r--coverage/inorout.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py
index 15e496af..3e0613a3 100644
--- a/coverage/inorout.py
+++ b/coverage/inorout.py
@@ -155,13 +155,15 @@ class InOrOut(object):
if _structseq and not hasattr(_structseq, '__file__'):
# PyPy 2.4 has no __file__ in the builtin modules, but the code
# objects still have the file names. So dig into one to find
- # the path to exclude.
+ # the path to exclude. The "filename" might be synthetic,
+ # don't be fooled by those.
structseq_new = _structseq.structseq_new
try:
structseq_file = structseq_new.func_code.co_filename
except AttributeError:
structseq_file = structseq_new.__code__.co_filename
- self.pylib_paths.add(canonical_path(structseq_file))
+ if not structseq_file.startswith("<"):
+ self.pylib_paths.add(canonical_path(structseq_file))
# To avoid tracing the coverage.py code itself, we skip anything
# located where we are.