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

[python] Fix python vector syntax issue #11060

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

tobil4sk
Copy link
Member

The test for this issue was generating a python syntax warning in our CI:
https://github.com/HaxeFoundation/haxe/blob/development/tests/unit/src/unit/issues/Issue4986.hx

bin/unit.py:72732: SyntaxWarning: 'int' object is not subscriptable; perhaps you missed a comma?

Can be simplified down to this example:

(new haxe.ds.Vector(1))[0];

This was generating the following python code:

[None]*1[0] # it thinks we are trying to index the 1

Now Haxe correctly generates this python code:

([None]*1)[0] # indexing the array

(Side note: there is also a syntax warning for None(1) elsewhere, but I think this probably isn't that important, since calling null is what the test does anyway)

@Simn Simn merged commit 6818afe into HaxeFoundation:development Mar 30, 2023
@tobil4sk tobil4sk deleted the fix/python-vector branch March 30, 2023 16:50
@skial skial mentioned this pull request Apr 2, 2023
1 task
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