allow passing a named argument to varkwargs function

This commit is contained in:
Jeong YunWon
2021-11-21 05:25:27 +09:00
parent 69491800e1
commit 78f3ef27f0

View File

@@ -136,10 +136,10 @@ impl PyFunction {
);
}
*slot = Some(value);
} else if argpos(0..code.posonlyarg_count, &name).is_some() {
posonly_passed_as_kwarg.push(name);
} else if let Some(kwargs) = kwargs.as_ref() {
kwargs.set_item(name, value, vm)?;
} else if argpos(0..code.posonlyarg_count, &name).is_some() {
posonly_passed_as_kwarg.push(name);
} else {
return Err(
vm.new_type_error(format!("got an unexpected keyword argument '{}'", name))