Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c44378

Browse files
committed
revert-subscript-changes
1 parent 3548feb commit 5c44378

2 files changed

Lines changed: 0 additions & 41 deletions

File tree

IPython/core/guarded_eval.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -608,34 +608,6 @@ def _handle_assign(node: ast.Assign, context: EvaluationContext):
608608
transient_locals[targets[i].id] = values[
609609
len(values) - (len(targets) - i)
610610
]
611-
elif isinstance(target, ast.Subscript):
612-
if isinstance(target.value, ast.Name):
613-
name = target.value.id
614-
container = transient_locals.get(name)
615-
if container is None:
616-
container = context.locals.get(name)
617-
if container is None:
618-
container = context.globals.get(name)
619-
if container is None:
620-
raise NameError(
621-
f"{name} not found in locals, globals, nor builtins"
622-
)
623-
624-
key = eval_node(target.slice, context)
625-
if policy.can_call(container.__setitem__):
626-
container[key] = value
627-
628-
elif isinstance(
629-
target.value, ast.Attribute
630-
) and _is_instance_attribute_assignment(target.value, context):
631-
attr = target.value.attr
632-
container = class_transients.get(attr, None)
633-
if container is None:
634-
raise NameError(f"{attr} not found in class transients")
635-
636-
key = eval_node(target.slice, context)
637-
if policy.can_call(container.__setitem__):
638-
container[key] = value
639611
elif _is_instance_attribute_assignment(target, context):
640612
class_transients[target.attr] = value
641613
else:
@@ -1320,7 +1292,6 @@ def _list_methods(cls, source=None):
13201292
collections.Counter.most_common,
13211293
object.__dir__,
13221294
type.__dir__,
1323-
dict.__setitem__,
13241295
}
13251296

13261297
BUILTIN_GETATTR: set[MayHaveGetattr] = {

tests/test_completer.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,18 +2240,6 @@ def _(expected):
22402240
),
22412241
"append",
22422242
],
2243-
[
2244-
"\n".join(
2245-
[
2246-
"def test():",
2247-
" a = {}",
2248-
" a['b'] = []",
2249-
" return a",
2250-
"test()['b'].",
2251-
]
2252-
),
2253-
"append",
2254-
],
22552243
[
22562244
"\n".join(
22572245
[

0 commit comments

Comments
 (0)