You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by GitBox <gi...@apache.org> on 2026/04/26 16:55:49 UTC
[GH] (tvm-ffi/handle-rawstr-bytearrayptr-callback): Workflow run "CI" is working again!
The GitHub Actions job "CI" on tvm-ffi.git/handle-rawstr-bytearrayptr-callback has succeeded.
Run started by GitHub user tqchen (triggered by tqchen).
Head commit for run:
945238998c5379f9d930e8f778dba23e0d71a0ef / tqchen <ti...@gmail.com>
[FIX] Handle kTVMFFIRawStr / kTVMFFIByteArrayPtr in callback args path
Bug: when C++ invokes a Python callback with non-owning RawStr or
ByteArrayPtr arg shapes, TVMFFICyCallbackArgSetterFactory raised
ValueError for both type indices, crashing the callback immediately.
Fix: add two new Cython setter functions —
TVMFFIPyCallbackArgSetterRawStr_ and TVMFFIPyCallbackArgSetterByteArrayPtr_
— and register them in TVMFFICyCallbackArgSetterFactory. Each setter
converts the non-owning C-side view to a Python str (UTF-8 decode) or
bytes (memcopy) before returning control to the callback.
Why not change make_ret: the return-value path (C-side ffi::Function
invocation) never carries kTVMFFIRawStr / kTVMFFIByteArrayPtr because
C++ normalises to owned variants (ffi::String / ffi::Bytes) before
returning. The existing raise ValueError arms in make_ret remain
correct guards against an impossible return-side type.
Test: single regression in tests/python/test_function.py
(test_callback_rawstr_and_bytearrayptr_args) that uses cpp.load_inline
to build a C++ shim with two trampolines. invoke_with_raw_str passes
a string literal as const char* (TypeTraits packs it as kTVMFFIRawStr);
invoke_with_byte_array_ptr passes a stack TVMFFIByteArray* (TypeTraits
packs it as kTVMFFIByteArrayPtr). The Python test asserts that the
callback receives a str / bytes with the expected content.
Report URL: https://github.com/apache/tvm-ffi/actions/runs/24961772557
With regards,
GitHub Actions via GitBox
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org