Skip to content

[mypyc] Reject instance attribute access through class object #10798

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

Merged
merged 6 commits into from
Jul 10, 2021

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jul 10, 2021

Accessing an instance attribute through a native class object results in
unexpected behavior at runtime (e.g. <attribute 'x' of 'C' objects>)
so reject these during compilation.

Also produce a note that suggests how to work around the issue.

Fixes mypyc/mypyc#814.

JukkaL added 6 commits July 10, 2021 13:23
Accessing an instance attribute through a native class object results in
unexpected behavior at runtime (e.g. `<attribute 'x' of 'C' objects>`)
so reject these during compilation.

Also a note that suggests how to work around the issue.

Fixes mypyc/mypyc#814.
@JukkaL JukkaL requested a review from msullivan July 10, 2021 12:49
@JukkaL JukkaL merged commit a37c388 into master Jul 10, 2021
@JukkaL JukkaL deleted the bad-class-var branch July 10, 2021 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

behaviour of default values for class attributes differs from CPython
2 participants