diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2012-12-16 08:03:22 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2012-12-16 08:03:22 +0000 |
commit | e9c1122fedc3e12ba6688e527a054aa022be9309 (patch) | |
tree | eb55fb0fb89513b140ccf09171b5de7cde10a082 | |
parent | 97b7136b68c932a09ce1f4312a15d26d8c2af680 (diff) | |
download | pyparsing-git-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
-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
|