diff mercurial/parser.py @ 32699:a98540ea1e42

parser: verify excessive number of args excluding kwargs in buildargsdict() This makes the next patch slightly simpler. We don't need to check the excessive number of keyword arguments since unknown and duplicated kwargs are rejected.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 08 Apr 2017 20:07:37 +0900 (2017-04-08)
parents afb335353d28
children 2156934b7917
line wrap: on
line diff
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -135,8 +135,9 @@
         raise error.ParseError(_("%(func)s takes at least %(nargs)d positional "
                                  "arguments")
                                % {'func': funcname, 'nargs': len(poskeys)})
-    if not varkey and len(trees) > len(poskeys) + len(keys):
-        raise error.ParseError(_("%(func)s takes at most %(nargs)d arguments")
+    if not varkey and kwstart > len(poskeys) + len(keys):
+        raise error.ParseError(_("%(func)s takes at most %(nargs)d positional "
+                                 "arguments")
                                % {'func': funcname,
                                   'nargs': len(poskeys) + len(keys)})
     args = {}