If the function wrapped by _trim_arity raises a TypeError, _trim_arity assumes that it was to do with the function invocation and not anything internal to the invocation.
If the exception handler is changed to look more like this:
except TypeError, exc:
if not exc.message.startswith(func.__name__):
if limit <= maxargs:
limit += 1
then the exceptions that are unrelated to the function are more likely to get through.
Log in to post a comment.