Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit900cf06

Browse files
committed
Also handle Name nodes for indexing (fixes#809)
1 parentbaa92a0 commit900cf06

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
returnsafe_getitem(obj,index)
163163
elifsys.version_info[:2]>= (3,9)andisinstance(node,ast.Subscript)andisinstance(
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
returnsafe_getitem(obj,index)
169169

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp