summaryrefslogtreecommitdiff
path: root/coverage/inorout.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-01-01 12:41:15 -0500
committerNed Batchelder <ned@nedbatchelder.com>2020-01-01 13:15:42 -0500
commit016af5f6352d69206ac8f7537c2b18828767bcae (patch)
tree0b93d1381754486e769e480835ee7bf011c4720f /coverage/inorout.py
parent5bb5da50b182583036b7808bb32f2c8c191d9d26 (diff)
downloadpython-coveragepy-git-016af5f6352d69206ac8f7537c2b18828767bcae.tar.gz
Don't trace non-encodable file names. #891
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r--coverage/inorout.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py
index 0eea62ae..d5e8b226 100644
--- a/coverage/inorout.py
+++ b/coverage/inorout.py
@@ -333,6 +333,12 @@ class InOrOut(object):
if self.omit_match and self.omit_match.match(filename):
return "is inside an --omit pattern"
+ # No point tracing a file we can't later write to SQLite.
+ try:
+ filename.encode("utf8")
+ except UnicodeEncodeError:
+ return "non-encodable filename"
+
# No reason found to skip this file.
return None