summaryrefslogtreecommitdiff
path: root/coverage/execfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/execfile.py')
-rw-r--r--coverage/execfile.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py
index 3283a3f7..587c2d3c 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -110,7 +110,7 @@ def run_python_file(filename, args, package=None):
# We have the source. `compile` still needs the last line to be clean,
# so make sure it is, then compile a code object from it.
- if source[-1] != '\n':
+ if not source or source[-1] != '\n':
source += '\n'
code = compile(source, filename, "exec")