Skip to content

Callable has no attribute __signature__ #12472

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

Open
kasium opened this issue Mar 28, 2022 · 0 comments
Open

Callable has no attribute __signature__ #12472

kasium opened this issue Mar 28, 2022 · 0 comments
Labels
bug mypy got something wrong topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@kasium
Copy link

kasium commented Mar 28, 2022

Bug Report

Mypy doesn't understand the __signature__ attribute of functions.
This was a part of #5958 and was now moved to it's own issue.

To Reproduce

import inspect

foo = lambda: None
foo.__signature__ = inspect.signature(foo)

Expected Behavior

Signature attribute exists

Actual Behavior

foo.py:4:1: error: "Callable[[], None]" has no attribute "__signature__" [attr-defined]

Your Environment

  • Mypy version used: 0.942
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.7.1
  • Operating system and version: Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-runtime-semantics mypy doesn't model runtime semantics correctly
Projects
None yet
Development

No branches or pull requests

2 participants