The GitHub Actions job "CI" on tvm-ffi.git/2026-02-08/copy has succeeded. Run started by GitHub user junrushao (triggered by junrushao).
Head commit for run: c9736d7ace896978004500aee1a2110091d3cb0a / Junru Shao <[email protected]> [ffi] Add __copy__, __deepcopy__, and __replace__ support for FFI objects ## Summary This PR adds first-class copy support to TVM-FFI objects, including Python `copy.copy`, `copy.deepcopy`, and dataclass-style `__replace__`. ## Changes - Adds reflection-based deep-copy runtime support in C++: - new `ffi.DeepCopy` entrypoint (`src/ffi/extra/deep_copy.cc`), which does memoized graph copy that preserves shared references and cycles. - recursive copy of `ffi.Array` / `ffi.Map` - treats `Str`/`Bytes` as immutable terminal values - resolves fields by runtime value so `Any`/`ObjectRef` fields containing containers/objects are copied correctly - Auto-registers shallow-copy support for copy-constructible reflected object types: - introduces `__ffi_shallow_copy__` registration in `ObjectDef` - exposes shallow-copy method via type attributes for generic lookup - Wires Python class registration to install: - `__copy__`, `__deepcopy__`, and `__replace__` for supported types - clear `TypeError` for non-copyable types - deepcopy support for container roots (`ffi.Array`, `ffi.Map`) via `ffi.DeepCopy` - Updates dataclass/c_class method attachment to use reflected callables consistently and hook copy setup. - Adds extensive test coverage in `tests/python/test_copy.py`, including: - shallow/deep copy behavior - shared-reference and cycle preservation - long-string deep copy edge cases - `Any` and `ObjectRef` deep copy edge cases - non-copyable type failures (`TestNonCopyable`) Report URL: https://github.com/apache/tvm-ffi/actions/runs/21936757137 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
