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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions std/haxe/ds/Vector.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private typedef VectorData<T> =
eval.Vector<T>
#else
Array<T>
#end
#end;

/**
A Vector is a storage of fixed size. It can be faster than Array on some
Expand Down Expand Up @@ -75,7 +75,7 @@ abstract Vector<T>(VectorData<T>) {
#elseif cpp
this = NativeArray.create(length);
#elseif python
this = python.Syntax.code("[{0}]*{1}", null, length);
this = python.Syntax.code("([{0}]*{1})", null, length);
#elseif lua
this = untyped __lua_table__({length: length});
#elseif eval
Expand All @@ -97,7 +97,7 @@ abstract Vector<T>(VectorData<T>) {
#if js
this = [for (_ in 0...length) defaultValue];
#elseif python
this = python.Syntax.code("[{0}]*{1}", defaultValue, length);
this = python.Syntax.code("([{0}]*{1})", defaultValue, length);
#else

#if flash10
Expand Down
3 changes: 3 additions & 0 deletions tests/misc/python/projects/Issue11060/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function main() {
trace(new haxe.ds.Vector(1)[0]);
}
3 changes: 3 additions & 0 deletions tests/misc/python/projects/Issue11060/build.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-python bin/main.py
--main Main
-cmd python3 bin/main.py
1 change: 1 addition & 0 deletions tests/misc/python/projects/Issue11060/build.hxml.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
None