#48 _trim_arity can swallow genuine TypeErrors

v1.0 (example)
closed-fixed
nobody
None
5
2016-09-10
2011-11-15
Benno Rice
No

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__):
raise
if limit[0] <= maxargs:
limit[0] += 1
continue
raise

then the exceptions that are unrelated to the function are more likely to get through.

Related

Patches: #9

Discussion

  • Paul McGuire

    Paul McGuire - 2016-01-18

    Benno -
    I have taken several passes at this problem, but I think my latest efforts will be successful. I have checked into SVN an updated pyparsing.py that fixes this problem, and it will be included in the next full pyparsing release. Feel free to pull this version from SVN and give it a try.
    Thanks,
    -- Paul

     
  • Paul McGuire

    Paul McGuire - 2016-01-18
    • status: open --> pending-fixed
    • Group: --> v1.0 (example)
     
  • Paul McGuire

    Paul McGuire - 2016-09-10
    • status: pending-fixed --> closed-fixed
     
  • Paul McGuire

    Paul McGuire - 2016-09-10

    Latest releases of pyparsing address this issue, thanks for raising it!

     

Log in to post a comment.