Skip to content

Commit cc3207e

Browse files
committed
Fix: do not consider implicit self to be a user-supplied argument
1 parent ab34c2f commit cc3207e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_call.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,16 @@ def f24(*args, a, b=5):
167167
def f25(*args, a, b=5, **kwds):
168168
pass
169169

170+
170171
def f26(**kw):
171172
return kw
172173

174+
175+
class F27:
176+
def f27(*args, a=5):
177+
return (args, a)
178+
179+
173180
def assert_parses(call_expr):
174181
raised = False
175182
try:
@@ -362,3 +369,11 @@ def test_runtime_args():
362369
kw = f26(b = mydict.pop('b', 22), **mydict)
363370
assert 'b' in kw
364371
assert kw['b'] == 2
372+
373+
f27_object = F27()
374+
assert f27_object.f27() == ((f27_object,), 5)
375+
assert f27_object.f27(1,2,3) == ((f27_object,1,2,3), 5)
376+
assert f27_object.f27(1,2,3,a=10) == ((f27_object,1,2,3), 10)
377+
assert F27.f27() == (tuple(), 5)
378+
assert F27.f27(1,2,3) == ((1,2,3), 5)
379+
assert F27.f27(1,2,3,a=10) == ((1,2,3), 10)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/argument/CreateArgumentsNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ int doIt(Object[] args_w, Object[] scope_w, int upfront, int co_argcount, int nu
510510
@Specialization(guards = "upfront >= co_argcount")
511511
@SuppressWarnings("unused")
512512
int doNothing(Object[] args_w, Object[] scope_w, int upfront, int co_argcount, int num_args) {
513-
return upfront;
513+
return 0;
514514
}
515515

516516
protected static ApplyPositionalArguments create() {

0 commit comments

Comments
 (0)