SF bug #973092: inspect.getframeinfo bug if 'context' is to big

Make sure the start argument is not negative.
This commit is contained in:
Raymond Hettinger 2004-06-15 11:22:53 +00:00
parent 40333ceeac
commit a050171ee9
1 changed files with 1 additions and 1 deletions

View File

@ -756,7 +756,7 @@ def getframeinfo(frame, context=1):
lines = index = None
else:
start = max(start, 1)
start = min(start, len(lines) - context)
start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context]
index = lineno - 1 - start
else: