diff mercurial/parser.py @ 31920: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
parents afb335353d28
children 2156934b7917
line wrap: on
line diff
--- a/mercurial/parser.py	Mon Apr 10 16:50:23 2017 +0200
+++ b/mercurial/parser.py	Sat Apr 08 20:07:37 2017 +0900
@@ -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 = {}