This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new c046b17  fix: Use `tvm_ffi.dtype` instead of `DataType` in schema (#93)
c046b17 is described below

commit c046b17108484780b8b13142e1c1a46e263ec979
Author: Junru Shao <[email protected]>
AuthorDate: Tue Oct 7 16:02:21 2025 -0700

    fix: Use `tvm_ffi.dtype` instead of `DataType` in schema (#93)
    
    `tvm_ffi.core.DataType` is an internal data structure attached to
    `tvm_ffi.dtype`, and `tvm_ffi.dtype` should always be the preferable way
    interfacing in Python.
---
 python/tvm_ffi/cython/type_info.pxi | 1 +
 tests/python/test_metadata.py       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/tvm_ffi/cython/type_info.pxi 
b/python/tvm_ffi/cython/type_info.pxi
index 4abfa4a..f48299c 100644
--- a/python/tvm_ffi/cython/type_info.pxi
+++ b/python/tvm_ffi/cython/type_info.pxi
@@ -82,6 +82,7 @@ _TYPE_SCHEMA_ORIGIN_CONVERTER = {
     "const char*": "str",
     "ffi.SmallStr": "str",
     "ffi.String": "str",
+    "DataType": "dtype",
 }
 
 
diff --git a/tests/python/test_metadata.py b/tests/python/test_metadata.py
index 9f69bcc..fe19822 100644
--- a/tests/python/test_metadata.py
+++ b/tests/python/test_metadata.py
@@ -29,7 +29,7 @@ from tvm_ffi.testing import _SchemaAllTypes
         ("testing.schema_id_float", "Callable[[float], float]"),
         ("testing.schema_id_bool", "Callable[[bool], bool]"),
         ("testing.schema_id_device", "Callable[[Device], Device]"),
-        ("testing.schema_id_dtype", "Callable[[DataType], DataType]"),
+        ("testing.schema_id_dtype", "Callable[[dtype], dtype]"),
         ("testing.schema_id_string", "Callable[[str], str]"),
         ("testing.schema_id_bytes", "Callable[[bytes], bytes]"),
         ("testing.schema_id_func", "Callable[[Callable[..., Any]], 
Callable[..., Any]]"),
@@ -76,7 +76,7 @@ def test_schema_global_func(func_name: str, expected: str) -> 
None:
         ("v_int", "int"),
         ("v_float", "float"),
         ("v_device", "Device"),
-        ("v_dtype", "DataType"),
+        ("v_dtype", "dtype"),
         ("v_string", "str"),
         ("v_bytes", "bytes"),
         ("v_opt_int", "int | None"),

Reply via email to