Skip to content

inspect.signature() raises TypeError for non-comparable callable #118404

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

Example:

class NoncomparableCallable:
    def __call__(self, a):
        pass
    def __eq__(self, other):
        1/0

import inspect
inspect.signature(NoncomparableCallable())

Real world example -- the result of functools.cmp_to_key() (see also #118402).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions