diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-03-05 18:19:43 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-03-05 18:19:43 -0500 |
commit | c9f4f661ccb7decb55055d80a1e9a1cbb825b27f (patch) | |
tree | 1081167367bd007aca979c1da247b3ec6516edb6 /coverage/python.py | |
parent | 99f376db423b5b2051d4edc8d67367b875df4cfd (diff) | |
download | python-coveragepy-git-c9f4f661ccb7decb55055d80a1e9a1cbb825b27f.tar.gz |
In 3.7, namespace modules can have: mod.__file__ is None
Diffstat (limited to 'coverage/python.py')
-rw-r--r-- | coverage/python.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/python.py b/coverage/python.py index 5edfc54d..834bc332 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. |