From c9f4f661ccb7decb55055d80a1e9a1cbb825b27f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 5 Mar 2018 18:19:43 -0500 Subject: In 3.7, namespace modules can have: mod.__file__ is None --- coverage/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/python.py') 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. -- cgit v1.2.1