Skip to content

feat: add Python type conversion test#810

Open
Harsh-dev023 wants to merge 4 commits into
metacall:developfrom
Harsh-dev023:feat/py-conversion-test
Open

feat: add Python type conversion test#810
Harsh-dev023 wants to merge 4 commits into
metacall:developfrom
Harsh-dev023:feat/py-conversion-test

Conversation

@Harsh-dev023

Copy link
Copy Markdown
Contributor

What

Added a type conversion test for the Python loader, similar to the existing Node.js conversion test.

Why

To check what type conversions happen when calling an identity function through the Python loader.

Changes

  • Added source/tests/metacall_py_conversion_test/ with test source and CMakeLists.txt
  • Added the new test to source/tests/CMakeLists.txt

Notes

  • Python int maps to long (METACALL_LONG) unlike Node.js which maps to double
  • Added TODO comment to loop through all types once viferga pushes his full changes

@ROKUMATE

ROKUMATE commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

hey harsh, been working on the same issue
i have explored that the CLASS, OBJECT, THROWABLE and EXCEPTION types were giving unsupported results specifically and other types were passing the test - EXAMPLE you can check here for the testing code if you want and update your code

also acc. to me i think name test file as metacall_python_conversion_test is more good then metacall_py_conversion_test as naming convention we following for tests in metacall is specific with python and not py

@viferga

viferga commented Jun 11, 2026

Copy link
Copy Markdown
Member

I started to implement support for type class but it's hard, I wanted to do this for each language for finishing the types left and create a table with all type conversions.

In that way we can document it and also @ROKUMATE we can reason about the ABI breaking change respect to integer types.

@viferga

viferga commented Jun 11, 2026

Copy link
Copy Markdown
Member

also acc. to me i think name test file as metacall_python_conversion_test is more good then metacall_py_conversion_test as naming convention we following for tests in metacall is specific with python and not py

Also this is right.

@Harsh-dev023

Copy link
Copy Markdown
Contributor Author

renamed the test to metacall_python_conversion_test

@viferga

viferga commented Jun 11, 2026

Copy link
Copy Markdown
Member

I ran the CI, the ideal would be to progressively implement all types. But if we cannot, it would be good to make it return error or exception when a type is passed.

I did this in node, it makes it silently fail but it's required for tests to pass.

@viferga

viferga commented Jun 11, 2026

Copy link
Copy Markdown
Member

@Harsh-dev023 can you merge develop into this branch? The base

@viferga viferga closed this Jun 11, 2026
@viferga viferga reopened this Jun 11, 2026
@viferga

viferga commented Jun 11, 2026

Copy link
Copy Markdown
Member

Sorry I miss-clicked close PR.

The base commit is a broken one. We were merging a big PR. Merge develop into this branch so the CI can run properly.

@viferga

viferga commented Jun 12, 2026

Copy link
Copy Markdown
Member

I ran the CI.

@Harsh-dev023

Copy link
Copy Markdown
Contributor Author

the Python Port tests pass on Ubuntu and Windows, but the macOS Python tests are crashing with a segmentation fault while running python test.py. I'm checking whether it's something introduced by the new type iteration test or an existing issue and will update you once I know more.

@viferga

viferga commented Jun 12, 2026

Copy link
Copy Markdown
Member

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.

3 participants