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

Fixes replacement of dict keys #1845

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Fixes replacement of dict keys #1845

merged 3 commits into from
Jan 7, 2025

Conversation

alexnick83
Copy link
Contributor

If the internal method SDFG._replace_dict_keys is called with the same old and new keys, then the method erroneously removes the entry for the specific key completely. Such a case occurs when calling SDFG.replace_dict with a dictionary that contains identity replacement matches.

This PR addresses the issue by:

  • Adding a check inside SDFG._replace_dict_keys and skipping if old == new. A warning is also thrown for debugging purposes.
  • Removing identity replacement matches from repldict and symrepl in SDFG.replace_dict.

…larly, the internal method _replace_dict_keys skips replacing keys with the same name to avoid erroneously removing the entry completely.
@alexnick83 alexnick83 enabled auto-merge January 7, 2025 11:09
Copy link
Contributor

@acalotoiu acalotoiu left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for fixing this surprising issue !

@alexnick83 alexnick83 added this pull request to the merge queue Jan 7, 2025
Merged via the queue into main with commit 6254c0f Jan 7, 2025
9 checks passed
@alexnick83 alexnick83 deleted the fix-replace-dict branch January 7, 2025 15:53
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