Skip to content

Commit 4b92a3e

Browse files
committed
Skip malformed special methods
1 parent c09f127 commit 4b92a3e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sphinxcontrib/prettyspecialmethods.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ def apply(self):
204204
if method_name in SPECIAL_METHODS:
205205
parameters_node = ref.next_node(SphinxNodes.desc_parameterlist)
206206

207+
# Some special methods might not be functions (e.g. `__hash__ = None`).
208+
# In this case, skip.
209+
if parameters_node is None:
210+
continue
211+
207212
name_node.replace_self(
208213
SPECIAL_METHODS[method_name](name_node, parameters_node)
209214
)

0 commit comments

Comments
 (0)