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

Added support for LOAD_CLASSDEREF #458

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

TiZCrocodile
Copy link
Contributor

The opcode itself is exactly the same as LOAD_DEREF.

  1. The problem is when the class is a closure (e.g. defined inside a function body) then there is a BUILD_TUPLE after the LOAD_BUILD_CLASS which makes problems. In this case I just added a check in the BUILD_TUPLE opcode to break if the TOS is NODE_LOADBUILDCLASS.

  2. There is another problem which makes the code->name() of the class to be part of the function locals. (e.g. func.<locals>.my_class instead of my_class) which makes the check srcString->isEqual(code->name().cast<PycObject>()) be invalid. Here I removed this check and another one that checks if the srcString != nullptr

TiZCrocodile and others added 2 commits February 26, 2024 16:52
The opcode itself is exactly the same as `LOAD_DEREF`
1) The problem is when the class is a closure (e.g. defined inside a function body) then there is a `BUILD_TUPLE` after the `LOAD_BUILD_CLASS` which makes problems.
2) There is another problem which makes the `code->name()` of the class to be part of the function locals. (e.g. `func.<locals>.my_class` instead of `my_class`) which makes the check `srcString->isEqual(code->name().cast<PycObject>())` be invalid.
@zrax zrax merged commit d361ec3 into zrax:master Feb 26, 2024
3 of 4 checks passed
@zrax zrax mentioned this pull request Feb 26, 2024
3 tasks
@TiZCrocodile TiZCrocodile deleted the support-for-`LOAD_CLASSDEREF` branch April 9, 2024 18:07
@TiZCrocodile TiZCrocodile restored the support-for-`LOAD_CLASSDEREF` branch April 9, 2024 18:07
@TiZCrocodile TiZCrocodile deleted the support-for-`LOAD_CLASSDEREF` branch April 9, 2024 18:09
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.

2 participants