Fix #4931: autodoc: crashed when subclass of mocked class are processed by napoleon module

This commit is contained in:
Takeshi KOMIYA 2018-05-22 22:31:07 +09:00
parent d7a25433ce
commit cff194d5dd
2 changed files with 6 additions and 4 deletions

View File

@ -41,6 +41,8 @@ Bugs fixed
* #4919: node.asdom() crashes if toctree has :numbered: option
* #4914: autodoc: Parsing error when using dataclasses without default values
* #4931: autodoc: crashed when handler for autodoc-skip-member raises an error
* #4931: autodoc: crashed when subclass of mocked class are processed by
napoleon module
Testing
--------

View File

@ -23,7 +23,7 @@ from sphinx.util.inspect import isenumclass, safe_getattr
if False:
# For type annotation
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple # NOQA
from typing import Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple # NOQA
logger = logging.getLogger(__name__)
@ -41,7 +41,7 @@ class _MockObject(object):
def __init__(self, *args, **kwargs):
# type: (Any, Any) -> None
pass
self.__qualname__ = ''
def __len__(self):
# type: () -> int
@ -52,8 +52,8 @@ class _MockObject(object):
return False
def __iter__(self):
# type: () -> None
pass
# type: () -> Iterator
return iter([])
def __mro_entries__(self, bases):
# type: (Tuple) -> Tuple