Skip to content

Conversation

@jjotero
Copy link
Contributor

@jjotero jjotero commented Mar 23, 2021

When declaring a variable with the variable built-in, the corresponding __set_name__ hook was only called if needed by the __getitem__ method of the metaclass. This is because the variables are temporarily hidden away in their own namespace, and the __set_name__ hooks from these variables don't get called by the base metaclass type.

Hence, it is a bit counterintuitive (if not just plainly wrong) that things get set when calling the __getitem__ method; so now the __set_name__ hook is called unconditionally for all variables in the __setitem__ method of the metaclass.

@jjotero jjotero requested review from teojgo and vkarak March 23, 2021 16:58
@jjotero jjotero self-assigned this Mar 23, 2021
@jjotero jjotero changed the title [bugfix] Fix the call order on the __set_name__ hook for the built-in variables [bugfix] Fix the call order on the __set_name__ hook for built-in variables Mar 23, 2021
@vkarak vkarak added this to the ReFrame sprint 21.03.2 milestone Mar 24, 2021
@vkarak vkarak removed the request for review from teojgo March 24, 2021 14:16
@vkarak vkarak merged commit dcab64b into reframe-hpc:master Mar 24, 2021
@jjotero jjotero deleted the bugfix/set-name branch March 24, 2021 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants