From faaf1777e4c2f6f134b8e9a6f11f98d7aab28b86 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 17 Apr 2019 21:10:08 +0200 Subject: [PATCH] Fix the argument parsing TypeError message - parens are already added by the _LOCATION at call site - fix plural-"s" logic --- src/derive_utils.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/derive_utils.rs b/src/derive_utils.rs index cd9c9ca7..b578bd40 100644 --- a/src/derive_utils.rs +++ b/src/derive_utils.rs @@ -46,11 +46,10 @@ pub fn parse_fn_args<'p>( let nkeywords = kwargs.map_or(0, PyDict::len); if !accept_args && !accept_kwargs && (nargs + nkeywords > params.len()) { return Err(TypeError::py_err(format!( - "{}{} takes at most {} argument{} ({} given)", + "{} takes at most {} argument{} ({} given)", fname.unwrap_or("function"), - if fname.is_some() { "()" } else { "" }, params.len(), - if params.len() == 1 { "s" } else { "" }, + if params.len() == 1 { "" } else { "s" }, nargs + nkeywords ))); }