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

Fix Subscript literal evaluation for List #1570

Conversation

FlorianDeconinck
Copy link
Contributor

Looking at: #1568

The code was blindly calling down to a _visit_potential_constant which is written for single element rather collection of them. Unroll the list, like the dict is done in the if above.

Copy link
Contributor

@alexnick83 alexnick83 left a comment

Choose a reason for hiding this comment

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

Thank you! The fix is very good. Could you also add a test for tuples (see comments on code)? Currently, ast.List and ast.Tuple are very similar (both have elts), therefore, it makes sense to treat them both similarly. Furthermore, a test will be very useful if this changes in a future Python version.

dace/frontend/python/preprocessing.py Show resolved Hide resolved
tests/python_frontend/unroll_test.py Show resolved Hide resolved
Copy link
Contributor

@alexnick83 alexnick83 left a comment

Choose a reason for hiding this comment

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

LGTM

@alexnick83 alexnick83 linked an issue May 8, 2024 that may be closed by this pull request
@alexnick83 alexnick83 enabled auto-merge May 8, 2024 13:36
@alexnick83 alexnick83 added this pull request to the merge queue May 8, 2024
Merged via the queue into spcl:master with commit 63adbd7 May 8, 2024
9 checks passed
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.

[Python frontend]: Python 3.11.7 + enumerate + subscript breakage
2 participants