catch IndexError exceptions when getting exception source location

This commit is contained in:
Anatoly Bubenkov
2015-09-15 01:14:58 +02:00
committed by Ryan Wooden
parent 310bada6f5
commit cf9a09e988
3 changed files with 48 additions and 1 deletions

View File

@@ -1774,7 +1774,7 @@ class FixtureLookupError(LookupError):
fspath, lineno = getfslineno(function)
try:
lines, _ = inspect.getsourcelines(get_real_func(function))
except IOError:
except (IOError, IndexError):
error_msg = "file %s, line %s: source code not available"
addline(error_msg % (fspath, lineno+1))
else: