mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
SF bug #973092: inspect.getframeinfo bug if 'context' is to big
Make sure the start argument is not negative.
This commit is contained in:
parent
40333ceeac
commit
a050171ee9
1 changed files with 1 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue