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

Philippe/fix/176 #186

Merged
merged 21 commits into from
Dec 20, 2023
Merged

Philippe/fix/176 #186

merged 21 commits into from
Dec 20, 2023

Conversation

philippedistributive
Copy link
Collaborator

@philippedistributive philippedistributive commented Nov 22, 2023

JS Arrays now behave like Python Lists when in a Python context.

closes #150
closes #110

We convert py List to js Array and back. Type List supports a strict subset of type Array, not an intersection. So when we go py to js we convert List to true Array, and when we go the other way we drop all of Array that is not supported by List
include/JSArrayProxy.hh Show resolved Hide resolved
include/JSArrayProxy.hh Show resolved Hide resolved
src/JSArrayProxy.cc Show resolved Hide resolved
src/JSArrayProxy.cc Outdated Show resolved Hide resolved
src/JSArrayProxy.cc Outdated Show resolved Hide resolved
tests/python/test_lists.py Show resolved Hide resolved
tests/python/test_lists.py Outdated Show resolved Hide resolved
tests/python/test_lists.py Outdated Show resolved Hide resolved
tests/python/test_lists.py Show resolved Hide resolved
tests/python/test_lists.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

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

One comment to address regarding handling private slots.
In addition, we should replace all instances of _PyNumber_Index with PyNumber_Index. It looks like they changed the behaviour of PyNumber_Index in 3.10 to only return exactly type int rather than potentially returning a subtype, and made _PyNumber_Index to have the old behaviour. The difference shouldn't matter for us in this case as far as I can tell. This should fix the compilation failed CI in 3.8 & 3.9.

test_slice_assign_wrong_type() looks to be failing in python 3.12 on line 913: a[2:4] = 6, specifically on JSArrayProxy.cc:187 Py_SIZE(b), where b is a PyLong_Type being cast to a PyListObject

src/JSArrayProxy.cc Show resolved Hide resolved
zollqir
zollqir previously approved these changes Dec 20, 2023
Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

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

LGTM

@philippedistributive philippedistributive merged commit 8eded5c into main Dec 20, 2023
24 checks passed
@philippedistributive philippedistributive deleted the philippe/fix/176 branch December 20, 2023 19:34
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.

JSArrayProxy JavaScript arrays are coerced to JsObjectProxys instead of Python Lists
2 participants