diff options
author | ptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b> | 2012-12-16 08:03:22 +0000 |
---|---|---|
committer | ptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b> | 2012-12-16 08:03:22 +0000 |
commit | 6321ab369b4bb0087e257700a544364a85b0da02 (patch) | |
tree | eb55fb0fb89513b140ccf09171b5de7cde10a082 /src | |
parent | b8fe8e592d8f0a7ff7d61af3069a3c45969c7ab2 (diff) | |
download | pyparsing_1.5.x.tar.gz |
Add latch to _trim_arity so that once the correct arg count has been found, future TypeErrors get correctly raised and don't continue to try updating the argcountpyparsing_1.5.x
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/branches/pyparsing_1.5.x@253 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
Diffstat (limited to 'src')
-rw-r--r-- | src/pyparsing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py index 7abb9c5..149ccaf 100644 --- a/src/pyparsing.py +++ b/src/pyparsing.py @@ -653,12 +653,15 @@ def _trim_arity(func, maxargs=2): if func in singleArgBuiltins:
return lambda s,l,t: func(t)
limit = [0]
+ foundArity = [False]
def wrapper(*args):
while 1:
try:
- return func(*args[limit[0]:])
+ ret = func(*args[limit[0]:])
+ foundArity[0] = True
+ return ret
except TypeError:
- if limit[0] <= maxargs:
+ if limit[0] <= maxargs and not foundArity[0]:
limit[0] += 1
continue
raise
|