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

Commit

Permalink
Fix parser hanging when there's a comment directly after __all__.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nurdok committed Aug 2, 2019
2 parents 0a2f3ef + 1ab2463 commit 49183a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Bug Fixes

* D401: Fixed a false positive where one stem had multiple imperative forms,
e.g., init and initialize / initiate (#382).
* Fix parser hanging when there's a comment directly after ``__all__``
(#391, #366).

4.0.0 - July 6th, 2019
---------------------------
Expand Down
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 49183a3

Please sign in to comment.