Skip to content

Sphinx v7.4.0: Failed to get a method signature: unhashable type #12579

@sphuber

Description

@sphuber

Describe the bug

When installing sphinx=7.4.0 that was just released, using the typing.ParamSpec results in the following warning:

WARNING: Failed to get a method signature for thing.ProcessFunctionType.run: unhashable type: 'ParamSpecArgs'

How to Reproduce

conf.py

import os
import sys
sys.path.insert(0, os.path.abspath('../src'))

extensions = ['sphinx.ext.autodoc']

index.rst

.. automodule:: thing
   :members:

The following source file

import typing as t

P = t.ParamSpec('P')
R_co = t.TypeVar('R_co', covariant=True)
N = t.TypeVar('N', bound=str)


class ProcessFunctionType(t.Protocol, t.Generic[P, R_co, N]):
    """Protocol type."""

    def run(self, *args: P.args, **kwargs: P.kwargs) -> R_co:
        """Some method."""

compiled with Sphinx v7.4

Environment Information

Only happens for `sphinx==7.4.0`. Builds fine with older versions

Sphinx extensions

sphinx.ext.autodoc

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions