Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
serhiy-storchaka opened this issue Apr 29, 2024 · 0 comments
Closed
Labels
3.12 only security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Apr 29, 2024

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

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.12 only security fixes 3.13 bugs and security fixes labels Apr 29, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Apr 29, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 30, 2024
serhiy-storchaka added a commit that referenced this issue Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant