Skip to content
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

Does not recognize __func__ of methods #14123

Open
asottile-sentry opened this issue Nov 17, 2022 · 0 comments
Open

Does not recognize __func__ of methods #14123

asottile-sentry opened this issue Nov 17, 2022 · 0 comments
Labels
bug mypy got something wrong topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@asottile-sentry
Copy link

seems similar to #2563, #3482, #8869, #11211, #12673 -- though those are mostly about decorated descriptors

Bug Report

simple, silly example:

class C:
    def f(self) -> None: pass

    def g(self) -> None:
        print(self.f.__func__)

C().g()

Expected Behavior

no error

Actual Behavior

$ ./.venv/bin/mypy t.py
t.py:5: error: "Callable[[], None]" has no attribute "__func__"  [attr-defined]
Found 1 error in 1 file (checked 1 source file)
$ ./.venv/bin/mypy --version
mypy 0.991 (compiled: yes)

Your Environment

  • Mypy version used: 0.991
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.8.10
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