Skip to content

Conversation

@josead
Copy link
Member

@josead josead commented Dec 9, 2025

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

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

Checklist:

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests/screenshots (if any) that prove my fix is effective or that my feature works.
  • I have tested the tests implicated (if any) by my own code and they pass (make test or ctest -VV -R <test-name>).
  • If my change is significant or breaking, I have passed all tests with ./docker-compose.sh test &> output and attached the output.
  • I have tested my code with OPTION_BUILD_ADDRESS_SANITIZER or ./docker-compose.sh test-address-sanitizer &> output and OPTION_TEST_MEMORYCHECK.
  • I have tested my code with OPTION_BUILD_THREAD_SANITIZER or ./docker-compose.sh test-thread-sanitizer &> output.
  • I have tested with Helgrind in case my code works with threading.
  • I have run make clang-format in 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.

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
@josead josead changed the title Create interactive implementation planning system Add support for awaiting async functions from Python port Dec 9, 2025
@josead josead force-pushed the claude/implementation-planner-019a4LRM4BBs9q73HgQW1S3Q branch from ee85b47 to ff895d4 Compare December 9, 2025 23:58
- 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
@josead josead force-pushed the claude/implementation-planner-019a4LRM4BBs9q73HgQW1S3Q branch from ff895d4 to 786bbf3 Compare December 10, 2025 00:04
@josead josead marked this pull request as draft December 10, 2025 02:00
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