PyCode analyzer breaks on "partial(lambda p: p('xx'), print)" ... causes autodoc_member_order = "bysource" not to work

Lukas Vacek avatarLukas Vacek created an issue

Hey,

When I use latest sphinx release v1.2b1 (but same problem in 1.1.3) to generate documentation for following:

from functools import partial

def b():
    "b docstring"
    pass

partial(lambda p: p('xx'), print)

def a():
    "a docstring"
    pass

member_order = "bysource" is ignored.

Doing a bit of debugging, it turned out that pycode analyzer raises an exception ParseError("bad input: type=1, value='print', context=('', (83, 20))",)

I have added to line 159 in pycode/pgen2/parse.py (just before the exception would be thrown)

                    if value == "print":
                        return

This is indeed just a quick-fix to solve the problem for me and a more general fix should go in.

Thanks, Lukas

Comments (2)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.