Kaydet (Commit) a050171e authored tarafından Raymond Hettinger's avatar Raymond Hettinger

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

Make sure the start argument is not negative.
üst 40333cee
...@@ -756,7 +756,7 @@ def getframeinfo(frame, context=1): ...@@ -756,7 +756,7 @@ def getframeinfo(frame, context=1):
lines = index = None lines = index = None
else: else:
start = max(start, 1) start = max(start, 1)
start = min(start, len(lines) - context) start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context] lines = lines[start:start+context]
index = lineno - 1 - start index = lineno - 1 - start
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment