From 8c7100070323d7f1189d16819bb46874b3232de3 Mon Sep 17 00:00:00 2001 From: Sergei Izmailov Date: Thu, 31 Aug 2023 04:47:47 +0900 Subject: [PATCH] fix: Repetition of `prop.getter.doc` in `prop.doc` --- pybind11_stubgen/parser/mixins/parse.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pybind11_stubgen/parser/mixins/parse.py b/pybind11_stubgen/parser/mixins/parse.py index dcfe346..fbe9bbe 100644 --- a/pybind11_stubgen/parser/mixins/parse.py +++ b/pybind11_stubgen/parser/mixins/parse.py @@ -470,7 +470,17 @@ def handle_property(self, path: QualifiedName, prop: Any) -> Property | None: if prop_doc is not None: result.doc = self._strip_empty_lines(prop_doc.splitlines()) - if result.getter is not None and result.getter.doc == result.doc: + if ( + result.doc is not None + and result.getter is not None + and ( + result.doc == result.getter.doc + or result.doc + == self._strip_empty_lines( + getattr(prop.fget, "__doc__", "").splitlines() + ) + ) + ): result.doc = None return result