'hasKw' is not sufficient to check if a function received kwargs

This commit is contained in:
K. Lange 2022-12-14 06:11:34 +09:00
parent c3e1226e96
commit eef955935d

View File

@ -516,7 +516,7 @@ KRK_Method(map,__call__) {
#define IS_zip(o) (krk_isInstanceOf(o,KRK_BASE_CLASS(zip)))
#define AS_zip(o) (AS_INSTANCE(o))
KRK_Method(zip,__init__) {
if (hasKw) return krk_runtimeError(vm.exceptions->typeError, "%s() takes no keyword arguments", "zip");
if (hasKw && AS_DICT(argv[argc])->count) return krk_runtimeError(vm.exceptions->typeError, "%s() takes no keyword arguments", "zip");
KrkTuple * iters = krk_newTuple(argc - 1);
krk_push(OBJECT_VAL(iters));