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

Skip to content

Commit a0f72a0

Browse files
committed
fix-missing-args
1 parent c70984d commit a0f72a0

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

IPython/core/guarded_eval.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,9 @@ def eval_node(node: Union[ast.AST, None], context: EvaluationContext):
700700

701701
if func_context.class_transients is not None:
702702
if not is_static and not is_classmethod:
703-
func_context.instance_arg_name = node.args.args[0].arg
703+
func_context.instance_arg_name = (
704+
node.args.args[0].arg if node.args.args else None
705+
)
704706

705707
return_type = eval_node(node.returns, context=context)
706708

tests/test_completer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,18 @@ def _(expected):
22402240
),
22412241
"append",
22422242
],
2243+
[
2244+
"\n".join(
2245+
[
2246+
"class NotYetDefined:",
2247+
" def test():",
2248+
" return []",
2249+
"instance = NotYetDefined()",
2250+
"instance.test().",
2251+
]
2252+
),
2253+
"append",
2254+
],
22432255
[
22442256
"\n".join(
22452257
[

0 commit comments

Comments
 (0)