From b9204186f0f2594cc2cbd8dc6aeb7885d81fe818 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Oct 2021 13:03:23 +0900 Subject: [PATCH] Fix #9697: An index entry with parens was registered for py:method --- CHANGES | 2 ++ sphinx/domains/python.py | 2 +- tests/test_domain_py.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b58c5e34178..e6b55886e0e 100644 --- a/CHANGES +++ b/CHANGES @@ -39,6 +39,8 @@ Bugs fixed * #9649: HTML search: when objects have the same name but in different domains, return all of them as result instead of just one. * #9678: linkcheck: file extension was shown twice in warnings +* #9697: py domain: An index entry with parens was registered for ``py:method`` + directive with ``:property:`` option Testing -------- diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 2dc26a382e1..4b418122a7d 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -769,7 +769,7 @@ def get_index_text(self, modname: str, name_cls: Tuple[str, str]) -> str: if 'classmethod' in self.options: return _('%s() (%s class method)') % (methname, clsname) elif 'property' in self.options: - return _('%s() (%s property)') % (methname, clsname) + return _('%s (%s property)') % (methname, clsname) elif 'staticmethod' in self.options: return _('%s() (%s static method)') % (methname, clsname) else: diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index b111e5276c0..64afb1c5700 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -732,7 +732,7 @@ def test_pymethod_options(app): # :property: assert_node(doctree[1][1][8], addnodes.index, - entries=[('single', 'meth5() (Class property)', 'Class.meth5', '', None)]) + entries=[('single', 'meth5 (Class property)', 'Class.meth5', '', None)]) assert_node(doctree[1][1][9], ([desc_signature, ([desc_annotation, "property "], [desc_name, "meth5"])], [desc_content, ()]))