Skip to content

make EasyConfigParser.get_config_dict return a copy rather than a reference#3692

Merged
migueldiascosta merged 6 commits intoeasybuilders:developfrom
boegel:pure_ec_fix
May 21, 2021
Merged

make EasyConfigParser.get_config_dict return a copy rather than a reference#3692
migueldiascosta merged 6 commits intoeasybuilders:developfrom
boegel:pure_ec_fix

Conversation

@boegel
Copy link
Member

@boegel boegel commented May 21, 2021

fixes #3691

@easybuilders easybuilders deleted a comment from boegelbot May 21, 2021
@boegel boegel changed the title make get_config_obj return a copy rather than a reference (WIP) make get_config_obj return a copy rather than a reference May 21, 2021
@boegel boegel marked this pull request as ready for review May 21, 2021 12:17
Copy link
Contributor

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have done it at a higher level (i.e. in the parser which has-a format object to avoid duplicating this, but this works too. Thanks!

For future reference as written in Slack:
The faster solution would be to copy the dict only on (potential) modification, e.g. when it is assigned into the EC (set_keys) because now we copy even if we only read from it (e.g. in the EC test suite). However it was decided to go for the safer solution and avoid the potential for accidental modification at the cost of a (comparatively cheap) copy of a dict

Copy link
Member

@migueldiascosta migueldiascosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@migueldiascosta
Copy link
Member

Going in, thanks @boegel!

@migueldiascosta migueldiascosta merged commit df616c1 into easybuilders:develop May 21, 2021
@boegel boegel deleted the pure_ec_fix branch May 21, 2021 12:50
@boegel boegel changed the title make get_config_obj return a copy rather than a reference make get_config_dict return a copy rather than a reference Jun 1, 2021
@boegel boegel changed the title make get_config_dict return a copy rather than a reference make EasyConfigParser.get_config_dict return a copy rather than a reference Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_config_dict returns parsed easyconfig file by reference

3 participants