Skip to content

Commit 900cf06

Browse files
committed
Also handle Name nodes for indexing (fixes #809)
1 parent baa92a0 commit 900cf06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bpython/simpleeval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ def _convert(node):
161161
index = _convert(node.slice.value)
162162
return safe_getitem(obj, index)
163163
elif sys.version_info[:2] >= (3, 9) and isinstance(node, ast.Subscript) and isinstance(
164-
node.slice, ast.Constant
164+
node.slice, (ast.Constant, ast.Name)
165165
):
166166
obj = _convert(node.value)
167-
index = node.slice.value
167+
index = _convert(node.slice)
168168
return safe_getitem(obj, index)
169169

170170
# this is a deviation from literal_eval: we allow attribute access

0 commit comments

Comments
 (0)