Skip to content

Commit 085e695

Browse files
author
Andy C
committed
[errors] Fix error message for vm.getFrame()
Show the user the index they actually passed.
1 parent 87c4804 commit 085e695

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

builtin/func_reflect.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ def Call(self, rd):
7878

7979
length = len(self.mem.var_stack)
8080
if index < 0:
81-
index += length
82-
if 0 <= index and index < length:
83-
return value.Frame(self.mem.var_stack[index])
81+
i = index + length
82+
else:
83+
i = index
84+
85+
if 0 <= i and i < length:
86+
return value.Frame(self.mem.var_stack[i])
8487
else:
8588
raise error.Structured(3, "Invalid frame %d" % index,
8689
rd.LeftParenToken())

0 commit comments

Comments
 (0)