add some cases

This commit is contained in:
blueloveTH 2024-03-17 18:36:08 +08:00
parent f62ec6d316
commit fd082c20e6
2 changed files with 22 additions and 3 deletions

View File

@ -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

View File

@ -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