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

unindented comment breaks parsing #139

Open
Psycojoker opened this issue Aug 11, 2018 · 2 comments
Open

unindented comment breaks parsing #139

Psycojoker opened this issue Aug 11, 2018 · 2 comments
Labels

Comments

@Psycojoker
Copy link
Member

This isolated situation broke baron parsing, if the comment is indented everything is fine.

def a():
#   stuff
    pass

if __name__ == '__main__':
    pass
@Psycojoker Psycojoker added the bug label Aug 11, 2018
@Psycojoker
Copy link
Member Author

Another case

try:
    pass
except:
# 
    def a():
        pass

benjyw added a commit to benjyw/boolean.py that referenced this issue Mar 6, 2020
RedBaron chokes on unindented comments (See
PyCQA/baron#139).
@asterbini
Copy link

asterbini commented Jul 26, 2020

I am still forced to remove all comments from code before parsing because wrongly indented comments break the parser.
Could comment-only lines be tokenized as a whole, together with their initial space?
This would probably fix the wrong indentation entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants