Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
fix parser dead loop when meet comment after __all__
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanaasagi committed Aug 1, 2019
1 parent cc5a96b commit 69debff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pydocstyle/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ def parse_dunder_all(self):
self.dunder_all = None
self.dunder_all_error = 'Could not evaluate contents of __all__. '
return
self.stream.move()

def parse_module(self):
"""Parse a module (and its children) and return a Module object."""
Expand Down
3 changes: 3 additions & 0 deletions src/tests/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ def nested_3(self):
__all__ = 'foo', 'bar'
foo = 1
"""),
CodeSnippet("""\
__all__ = ['foo', 'bar'] # never freeze
"""),
))
def test_dunder_all(code):
"""Test that __all__ is parsed correctly."""
Expand Down

0 comments on commit 69debff

Please sign in to comment.