From e09f78b987c1c3aa958d8ac0c722abed101c03ce Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 7 Nov 2022 18:05:34 +0100 Subject: [PATCH] interrogate: Do not consider `make()` with explicit kwargs for coercion Unless this parameter has a default value --- dtool/src/interrogate/functionRemap.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index c4c1282a68..52ff496dac 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -872,8 +872,13 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak } else if (fname == "make") { if (!_has_this && _parameters.size() >= 1 && TypeManager::is_pointer(_return_type->get_new_type())) { - // We can use this for coercion. - _flags |= F_coerce_constructor; + // We can use this for coercion, except if this is a kwargs param that + // does not have a default value. + if ((_flags & F_explicit_args) == 0 || + _parameters.size() != first_param + 2 || + _parameters[first_param + 1]._remap->has_default_value()) { + _flags |= F_coerce_constructor; + } } if (_args_type == InterfaceMaker::AT_varargs) {