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

New way to populate locals() for filter #247

Closed
wants to merge 1 commit into from
Closed

New way to populate locals() for filter #247

wants to merge 1 commit into from

Conversation

lukaszachy
Copy link
Collaborator

@@ -202,9 +202,11 @@ def evaluate(expression, data, _node=None):
Expects data dictionary which will be used to populate local
namespace. Used to provide flexible conditions for filtering.
"""
locals().update(data)
# Since python3.13 and https://peps.python.org/pep-0667/
_locals = copy.deepcopy(locals())
Copy link
Collaborator

@happz happz Jun 17, 2024

Choose a reason for hiding this comment

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

I don’t believe deepcopy() is needed. locals() should regurn an independent snapshot of local namespace, i.e. we would be making (and updating) a copy of dictionary no other part of code can ever see. Seems superfluous.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In other words, I agree we need to store locals() somewhere if we need to both update it and pass it to a function call, ut IIUIC, we don’t need to work with a copy of said dictionary.

@lukaszachy
Copy link
Collaborator Author

Drop in favor of #248

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.

py3.13 - fmf ls --condition 'float(release) >= 7' broken
2 participants