beartype / plum

Multiple dispatch in Python

Home Page:https://beartype.github.io/plum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The * in the function call which crashed the sphinx_autodoc_typehints

xiki-tempula opened this issue · comments

So the plum convenbtion is that one has * between the arguments that needs to be dispatched and the arguments that don't need dispatch

from plum import dispatch


@dispatch
def f(dispatch_this: str, *, dont_dispatch_this):
    return "This is a string!"


@dispatch
def f(dispatch_this: int, *, dont_dispatch_this):
    return "This is an integer!"

This works on itself but would crash sphinx_autodoc_typehints giving

:3: (WARNING/2) Inline emphasis start-string without end-string.

Extension error (sphinx_autodoc_typehints):
Handler <function process_docstring at 0x7fd2ff0a5430> for event 'autodoc-process-docstring' threw an exception (exception: )

I think this is because when sphinx_autodoc_typehints sees *, it is expecting it to be *emphasis* so it is not not parsed correctly.

commented

Hey @xiki-tempula,

Thanks for opening an issue. :)

Very good catch! I'm actually in the process of improve the documentation features of Plum, and will incorporate a fix for this in the next PR.

Thank you!

commented

I believe this should be fixed in the latest release v2.1.0. :)