Skip to content

sphinx inline type rejected when it contains an ellipsis or quotes #1015

Description

@jshwi

A :param <type> <name>: field whose type contains a bare ellipsis or a
quoted member is parsed as if the type ended early. The parameter name
becomes a fragment of the type and the next character is read as a bad
closing token.

def function(cb, items, mode) -> int:
    """Summary.

    :param Callable[..., str] cb: A callback.
    :param tuple[int, ...] items: The numbers.
    :param Literal['a', 'b'] mode: The mode.
    :return: A number.
    """
    return 1

Expected exit 0. Actual:

    SIG302: syntax error in description (syntax-error-in-description)
    SIG304: bad token used to close parameter declaration ',' (bad-closing-token)
    SIG305: description does not begin with a capital letter (description-not-capitalized)
    SIG404: documented parameter not equal to its respective argument (param-not-equal-to-arg)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions