Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print statements in the loaded code break the output #24

Closed
pawamoy opened this issue Apr 25, 2020 · 1 comment
Closed

print statements in the loaded code break the output #24

pawamoy opened this issue Apr 25, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@pawamoy
Copy link
Member

pawamoy commented Apr 25, 2020

Describe the bug
I just thought about the case where the user could have added print statements that are executed at import time. In that case pytkdocs JSON output would be broken/corrupted.

To Reproduce

$ echo -e '"""Module docstring."""\n\nprint("finished loading")\n' > corrupt.py
$ echo '{"objects": [{"path": "corrupt"}]}' | poetry run pytkdocs | jq
parse error: Invalid literal at line 1, column 9

Expected behavior
The output of the imported code should be discarded.

System (please complete the following information):

  • pytkdocs version 0.3.0
  • Python version: irrelevant
  • OS: irrelevant

Additional context
Possibly related to rdilweb/docs@cc20660 and mkdocstrings/mkdocstrings#91

@pawamoy pawamoy changed the title Would "print" statements in the loaded code break the output? print statements in the loaded code break the output Apr 25, 2020
@pawamoy pawamoy added the bug Something isn't working label Apr 25, 2020
pawamoy added a commit that referenced this issue May 6, 2020
@pawamoy
Copy link
Member Author

pawamoy commented May 6, 2020

Fixed by 17f71af

@pawamoy pawamoy closed this as completed May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant