mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* Closes #5076: [ext/napoleon] explicitly catch StopIteration Per PEP 479, Python 3.7 no longer allows bubbling up StopIteration outside of a generator. Instead, wrap attribute parsing in a try block and provide a sane default in case it raises an exception ([]). * Fix mypy and flake8 issues
This commit is contained in:
parent
e78133a83e
commit
b553c23ab1
@ -527,7 +527,14 @@ class GoogleDocstring(UnicodeMixin):
|
||||
self._parsed_lines = self._consume_empty()
|
||||
|
||||
if self._name and (self._what == 'attribute' or self._what == 'data'):
|
||||
self._parsed_lines.extend(self._parse_attribute_docstring())
|
||||
# Implicit stop using StopIteration no longer allowed in
|
||||
# Python 3.7; see PEP 479
|
||||
res = [] # type: List[unicode]
|
||||
try:
|
||||
res = self._parse_attribute_docstring()
|
||||
except StopIteration:
|
||||
pass
|
||||
self._parsed_lines.extend(res)
|
||||
return
|
||||
|
||||
while self._line_iter.has_next():
|
||||
|
Loading…
Reference in New Issue
Block a user