@@ -799,6 +799,7 @@ def _var_ns_as_python_sym(name: str) -> str:
799799_ATTRIB_FIELD_FN_NAME = _load_attr (f"{ _ATTR_ALIAS } .field" )
800800_BASILISP_LOAD_CONSTANT_NAME = _load_attr (f"{ _RUNTIME_ALIAS } ._load_constant" )
801801_COERCE_SEQ_FN_NAME = _load_attr (f"{ _RUNTIME_ALIAS } .to_seq" )
802+ _UNWRAP_REST_ARGS_FN_NAME = _load_attr (f"{ _RUNTIME_ALIAS } ._unwrap_rest_args" )
802803_BASILISP_FN_FN_NAME = _load_attr (f"{ _RUNTIME_ALIAS } ._basilisp_fn" )
803804_FN_WITH_ATTRS_FN_NAME = _load_attr (f"{ _RUNTIME_ALIAS } ._with_attrs" )
804805_BASILISP_TYPE_FN_NAME = _load_attr (f"{ _RUNTIME_ALIAS } ._basilisp_type" )
@@ -1707,7 +1708,7 @@ def __fn_args_to_py_ast(
17071708 value = ast .IfExp (
17081709 test = ast .Name (id = arg_name , ctx = ast .Load ()),
17091710 body = ast .Call (
1710- func = _NEW_LIST_FN_NAME ,
1711+ func = _UNWRAP_REST_ARGS_FN_NAME ,
17111712 args = [ast .Name (id = arg_name , ctx = ast .Load ())],
17121713 keywords = [],
17131714 ),
@@ -1738,6 +1739,8 @@ def __fn_args_to_py_ast(
17381739def __fn_decorator (
17391740 arities : Iterable [int ],
17401741 has_rest_arg : bool = False ,
1742+ * ,
1743+ max_fixed_arity : int ,
17411744) -> ast .Call :
17421745 return ast .Call (
17431746 func = _BASILISP_FN_FN_NAME ,
@@ -1767,7 +1770,8 @@ def __fn_decorator(
17671770 ),
17681771 ctx = ast .Load (),
17691772 ),
1770- )
1773+ ),
1774+ ast .keyword (arg = "max_fixed_arity" , value = ast .Constant (max_fixed_arity )),
17711775 ],
17721776 )
17731777
@@ -1875,6 +1879,7 @@ def __single_arity_fn_to_py_ast( # pylint: disable=too-many-locals
18751879 __fn_decorator (
18761880 (len (fn_args ),),
18771881 has_rest_arg = method .is_variadic ,
1882+ max_fixed_arity = node .max_fixed_arity ,
18781883 )
18791884 ],
18801885 (
@@ -1905,10 +1910,11 @@ def __multi_arity_dispatch_fn( # pylint: disable=too-many-arguments,too-many-lo
19051910 ctx : GeneratorContext ,
19061911 name : str ,
19071912 arity_map : Mapping [int , str ],
1913+ * ,
19081914 return_tags : Iterable [Node | None ],
19091915 default_name : str | None = None ,
19101916 rest_arity_fixed_arity : int | None = None ,
1911- max_fixed_arity : int | None = None ,
1917+ max_fixed_arity : int ,
19121918 meta_node : MetaNode | None = None ,
19131919 is_async : bool = False ,
19141920) -> GeneratedPyAST [ast .expr ]:
@@ -2085,6 +2091,7 @@ def fn(*args):
20852091 )
20862092 ),
20872093 has_rest_arg = default_name is not None ,
2094+ max_fixed_arity = max_fixed_arity ,
20882095 )
20892096 ],
20902097 )
@@ -3688,7 +3695,7 @@ def _const_val_to_py_ast(
36883695 `_const_node_to_py_ast`."""
36893696 try :
36903697 serialized = pickle .dumps (form )
3691- except (pickle .PicklingError , RecursionError ) as e :
3698+ except (pickle .PicklingError , RecursionError ) as e : # pragma: no cover
36923699 # For types without custom "constant" handling code, we defer to pickle
36933700 # to generate a representation that can be reloaded from the generated
36943701 # byte code. There are a few cases where that may not be possible for one
0 commit comments