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

No error when attempting to use property object as that property's type #6192

Open
andy-hanson opened this issue Jan 15, 2019 · 0 comments
Open
Labels
priority-2-low topic-descriptors Properties, class vs. instance attributes topic-named-tuple topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@andy-hanson
Copy link

  • Are you reporting a bug, or opening a feature request? Bug
  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
from typing import NamedTuple


class C(NamedTuple):
    a: int = 1


print(C.a * 2)
  • What is the actual behavior/output?

mypy a.py produces no output.

  • What is the behavior/output you expect?

An error at C.a * 2, as it will cause an error at runtime: TypeError: unsupported operand type(s) for *: 'property' and 'int'

  • What are the versions of mypy and Python you are using?

python --version: 3.7.2
mypy --version: 0.660+dev.97d7760dca6d95806a97b02992ae88a082898a0e

Do you see the same issue after installing mypy from Git master? Yes

  • What are the mypy flags you are using? (For example --strict-optional) None
@AlexWaygood AlexWaygood added topic-descriptors Properties, class vs. instance attributes topic-runtime-semantics mypy doesn't model runtime semantics correctly labels Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-2-low topic-descriptors Properties, class vs. instance attributes topic-named-tuple topic-runtime-semantics mypy doesn't model runtime semantics correctly
Projects
None yet
Development

No branches or pull requests

3 participants