mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
add some cases
This commit is contained in:
parent
f62ec6d316
commit
fd082c20e6
@ -897,9 +897,7 @@ PyObject* VM::vectorcall(int ARGC, int KWARGC, bool op_call){
|
|||||||
co->name, "() takes ", decl->args.size(), " positional arguments but ", args.size(), " were given"
|
co->name, "() takes ", decl->args.size(), " positional arguments but ", args.size(), " were given"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if(!kwargs.empty()){
|
if(!kwargs.empty()) TypeError(_S(co->name, "() takes no keyword arguments"));
|
||||||
TypeError(_S(co->name, "() takes no keyword arguments"));
|
|
||||||
}
|
|
||||||
s_data.reset(_base + co_nlocals);
|
s_data.reset(_base + co_nlocals);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// prepare args
|
// prepare args
|
||||||
|
@ -119,3 +119,24 @@ def f(a=((1,2),3), b=(4,)):
|
|||||||
return a, b
|
return a, b
|
||||||
|
|
||||||
assert f() == (((1,2),3), (4,))
|
assert f() == (((1,2),3), (4,))
|
||||||
|
|
||||||
|
def f(a, b):
|
||||||
|
return a + b
|
||||||
|
|
||||||
|
try:
|
||||||
|
f(a=1)
|
||||||
|
exit(1)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
f(1)
|
||||||
|
exit(1)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
f(1, 2, 3)
|
||||||
|
exit(1)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user