Add support for awaiting async functions from Python port#601
Draft
Add support for awaiting async functions from Python port#601
Conversation
Add support for awaiting async functions from Python port: - Implement py_loader_port_await in py_loader_port.c with resolve/reject callbacks that bridge MetaCall's async mechanism to Python Futures - Add accessor functions for asyncio_loop and thread_background_module in py_loader_impl.c/.h - Add metacall_await function and MetaCallFunction class to api.py supporting both sync and async function calls - Update find_handle to use MetaCallFunction with automatic async detection via metacall_inspect metadata - Export new symbols in __init__.py - Add comprehensive Python unit tests in test_await.py (~35 tests) - Add C++ integration tests in metacall_python_port_await_test - Update CMakeLists.txt to include new test targets - Fix missing 'import threading' in metacall_python_await_test.cpp
ee85b47 to
ff895d4
Compare
- Replace Py_XDecRef with Py_DecRef (Py_DecRef already handles NULL) - Implement PyExc_MemoryErrorPtr in py_loader_symbol_fallback.c following the existing pattern for other exception types
ff895d4 to
786bbf3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for awaiting async functions from Python port:
Description
Please include a summary of the change and which issue is fixed. List any dependencies that are required for this change.
Fixes #(issue_no)
Type of change
Checklist:
make testorctest -VV -R <test-name>)../docker-compose.sh test &> outputand attached the output.OPTION_BUILD_ADDRESS_SANITIZERor./docker-compose.sh test-address-sanitizer &> outputandOPTION_TEST_MEMORYCHECK.OPTION_BUILD_THREAD_SANITIZERor./docker-compose.sh test-thread-sanitizer &> output.Helgrindin case my code works with threading.make clang-formatin order to format my code and my code follows the style guidelines.If you are unclear about any of the above checks, have a look at our documentation here.