Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#196 Parse of fn with lambda kw argument fails

v3.0
closed-works-for-me
nobody
5
2007-10-08
2007-04-03
Martin Gfeller
No

If a method contains a keyword argument with a lambda as its value, EpyDoc fails with:

Error: Source code parsing failed: Error during parsing: invalid syntax, Bad argument list.

Definition causing the failure:

class foo:
def __init__(self,a,fn=lambda x:x):
....

Discussion

  • Edward Loper
    Edward Loper
    2007-09-23

    • status: open --> pending-works-for-me
     
  • Edward Loper
    Edward Loper
    2007-09-23

    Logged In: YES
    user_id=195958
    Originator: NO

    I was unable to replicate this bug using epydoc's svn head. I tested it using Python versions 2.3, 2.4, and 2.5. In all cases I get output that looks like this:

    Instance Methods [hide private]

    __init__(self, a, fn=<function <lambda> at 0x4030648c>)

    My test file was:

    class foo:
    ....def __init__(self,a,fn=lambda x:x):
    ........pass

    (with leading dots replaced by spaces.)

    I'd appreciate it if you could test using the svn head version of epydoc, to see if this bug still exists. Alternatively, try adding the following line to the beginning of init_arglist() in epydoc/docparser.py:

    log.error(arglist)

    This will show the syntax tree that epydoc's working from. The output I get is:

    [(51, u'('), (1, u'self'), (51, u','), (1, u'a'), (51, u','), (1, u'fn'), (51, u'='), (1, u'lambda'), (1, u'x'), (51, u':'), (1, u'x'), (51, u')')]

     
    • status: pending-works-for-me --> closed-works-for-me
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).