Skip to content

Bad construction of return type in AutoapiSummary leads to bad signature mangling with autodoc #531

@Reylak

Description

@Reylak

Hello,

I noticed that module-level functions that were summarized with AutoapiSummary would display their return type instead of their parameters list.
I.e.:

my_function(→ Collection[MyType])

Instead of:

my_function(arg1, arg2, arg3)

This issue only affects summarized functions or methods that have a return type.

I identified this change as the problem: 7270718#diff-dfb37c7639343e616e90196421ee72877ede504a96f6485b14b537ba7e7c0b65R28.
This code appends the return type to the signature being built, prefixed with an "arrow".
The linked change replaces the -> plain ASCII arrow with the Unicode arrow .
Afterwards, the signature is mangled by Sphinx's autodoc mangle_signature.

The problem is that this Sphinx's method expect the return type to be appended with an ASCII arrow.
Then, its regexes fail and we and up with what I showed above.

Replacing the Unicode arrow with the ASCII arrow fixed the problem.

Since I'm not sure why this Unicode was introduced in the first place, I don't know if this fix is enough.
It came with adding support for overloaded methods, where the list of parameters is replaced with the Unicode ellipsis character; and the arrow was replaced with the Unicode arrow at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions