summaryrefslogtreecommitdiff
path: root/coverage/python.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-03-05 18:19:43 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-03-05 18:19:43 -0500
commit421062f1ff81dafa8a391458c753f3608035c342 (patch)
treea0197c6281b199b3c5b4d6b16b90a7cd3ac0afbf /coverage/python.py
parentcff5b3620b9e7d0a40445f5dfe3e9fb74e794979 (diff)
downloadpython-coveragepy-421062f1ff81dafa8a391458c753f3608035c342.tar.gz
In 3.7, namespace modules can have: mod.__file__ is None
Diffstat (limited to 'coverage/python.py')
-rw-r--r--coverage/python.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/python.py b/coverage/python.py
index 5edfc54..834bc33 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -131,7 +131,7 @@ def source_for_file(filename):
def source_for_morf(morf):
"""Get the source filename for the module-or-file `morf`."""
- if hasattr(morf, '__file__'):
+ if hasattr(morf, '__file__') and morf.__file__:
filename = morf.__file__
elif isinstance(morf, types.ModuleType):
# A module should have had .__file__, otherwise we can't use it.