The GitHub Actions job "mainline-only" on tvm-ffi.git/main has failed.
Run started by GitHub user tqchen (triggered by tqchen).

Head commit for run:
b97ff1ae2abd21f5b8a368d5e04f34b53e3985bf / Junru Shao <[email protected]>
refactor(dataclasses)!: remove Python-side field descriptor infrastructure 
(#478)

## Summary

- Remove the Python-side dataclass field descriptor system (`_utils.py`,
`field.py`, complex `c_class.py`) that duplicated C++ reflection
metadata
- Simplify `c_class` decorator to a thin pass-through to
`register_object`
- Fix `_add_class_attrs` to always override `__c_ffi_init__` per type,
preventing inherited base-class constructors from masking derived-class
constructors

## Architecture

The previous `c_class` decorator maintained a parallel Python-side field
descriptor system (`Field`, `KW_ONLY`, `default_factory`, codegen'd
`__init__`) that mirrored what C++ reflection already provides. This PR
removes that duplication:

- **Deleted**: `_utils.py` (210 lines — `type_info_to_cls`,
`fill_dataclass_field`, `method_init` codegen), `field.py` (169 lines —
`Field` class, `KW_ONLY` sentinel, default factory wiring)
- **Simplified**: `c_class.py` reduced from 190 to 36 lines — now
delegates directly to `register_object`
- **Fixed**: `_add_class_attrs` in `registry.py` now always overrides
`__c_ffi_init__` on each type (matching the existing
`__ffi_shallow_copy__` override pattern), preventing a derived class
from inheriting a base class constructor with the wrong field count

## Breaking Changes

- `field()`, `Field`, `KW_ONLY`, and `MISSING` are no longer exported
from `tvm_ffi.dataclasses`
- `c_class`-decorated classes must now explicitly inherit from `Object`
(previously `_utils.type_info_to_cls` injected it)
- `__init__` on decorated types uses the C++ FFI constructor directly
(positional args in field order) instead of the Python codegen'd init
with keyword-only and default factory support
- The `init` and `kw_only` parameters of `c_class()` are removed

## Test plan

- [x] `tests/python/test_repr.py` updated — derived constructors use
positional args
- [x] `tests/python/test_dataclasses_c_class.py` deleted — tested
removed infrastructure
- [x] Full CI pass on all platforms

Report URL: https://github.com/apache/tvm-ffi/actions/runs/22484868776

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to