diff --git a/mypy/stubgenc.py b/mypy/stubgenc.py index d07cfa35414d..1f3ce9eb278c 100755 --- a/mypy/stubgenc.py +++ b/mypy/stubgenc.py @@ -811,8 +811,6 @@ def generate_class_stub(self, class_name: str, cls: type, output: list[str]) -> class_info = ClassInfo(class_name, "", getattr(cls, "__doc__", None), cls) docstring = class_info.docstring if self._include_docstrings else None - if docstring: - docstring = self._indent_docstring(docstring) for attr, value in items: # use unevaluated descriptors when dealing with property inspection @@ -861,6 +859,9 @@ def generate_class_stub(self, class_name: str, cls: type, output: list[str]) -> self.dedent() + if docstring: + docstring = self._indent_docstring(docstring) + bases = self.get_base_types(cls) if bases: bases_str = "(%s)" % ", ".join(bases)