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

False negative with accessing super types private member from sub type #9446

Closed
KotlinIsland opened this issue Sep 16, 2020 · 2 comments
Closed
Labels
bug mypy got something wrong priority-2-low topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@KotlinIsland
Copy link
Contributor

Following code shows no errors from mypy but will fail at runtime.

class A:
    def __a(self) -> None:
        ...


class B(A):
    def foo(self) -> None:
        self.__a()


B().foo()
@KotlinIsland KotlinIsland added the bug mypy got something wrong label Sep 16, 2020
@KotlinIsland KotlinIsland changed the title False negative: accessing private member from super type False negative with accessing private member from sub type Sep 16, 2020
@KotlinIsland KotlinIsland changed the title False negative with accessing private member from sub type False negative with accessing super types private member from sub type Sep 16, 2020
@gvanrossum
Copy link
Member

Thanks for the report -- this looks like a real bug. Fixing it would probably be fairly involved (we'd have to implement name mangling at the right level in the parser) and private members aren't that popular. So I'm classifying this as low priority.

@AlexWaygood AlexWaygood added the topic-runtime-semantics mypy doesn't model runtime semantics correctly label Apr 3, 2022
@AlexWaygood
Copy link
Member

Closing as a duplicate of #8267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-2-low topic-runtime-semantics mypy doesn't model runtime semantics correctly
Projects
None yet
Development

No branches or pull requests

3 participants