Skip to content

Type annotations which contain commas in autosummary table are not removed completely #9600

@greyli

Description

@greyli

Describe the bug

Here is an example in marshmallow docs: https://marshmallow.readthedocs.io/en/stable/marshmallow.validate.html

Take the first And class as an example. Here is the raw definition:

And(*validators: Callable[[Any], Any], error: Optional[str] = None)

Expected output:

And(*validators, error)

Actual output:

And(*validators, Any], error)

It seems that Sphinx uses the comma to separate the arguments, but it can't tell if the comma is in the arguments list or in the type annotations.

How to Reproduce

$ git clone https://github.com/marshmallow-code/marshmallow
$ cd marshmallow
$ pip install tox
$ tox -e docs
$ # open _build/html/marshmallow.validate.html

Expected behavior

No response

Your project

https://github.com/marshmallow-code/marshmallow

Screenshots

Source: https://github.com/marshmallow-code/marshmallow/blob/dev/docs/marshmallow.validate.rst
Doc: https://marshmallow.readthedocs.io/en/stable/marshmallow.validate.html

OS

macOS Big Sur 11.4

Python version

3.8

Sphinx version

4.1.2

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions