Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
JukkaL merged 6 commits into
masterfrom
bad-class-var
Jul 10, 2021
Merged

[mypyc] Reject instance attribute access through class object#10798
JukkaL merged 6 commits into
masterfrom
bad-class-var

Conversation

@JukkaL

@JukkaL JukkaL commented Jul 10, 2021

Copy link
Copy Markdown
Collaborator

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