junrushao commented on code in PR #49:
URL: https://github.com/apache/tvm-ffi/pull/49#discussion_r2377271899
##########
python/tvm_ffi/cython/type_info.pxi:
##########
@@ -101,6 +102,21 @@ class TypeMethod:
func: object
is_static: bool
+ def as_callable(self, object cls):
+ """Create a Python method attribute for this method on ``cls``."""
+ cdef str name = self.name
+ cdef str doc = self.doc or f"Method `{name}` of class
`{cls.__qualname__}`"
+ cdef object func = self.func
+ if self.is_static:
+ func = staticmethod(func)
+ else:
+ func = _member_method_wrapper(func)
+ func.__module__ = cls.__module__
+ func.__name__ = name
+ func.__qualname__ = f"{cls.__qualname__}.{name}"
+ func.__doc__ = doc
+ return func
Review Comment:
I tested locally but can't reproduce the claimed issue. @gemini Could you
double check?
##########
python/tvm_ffi/cython/type_info.pxi:
##########
@@ -101,6 +102,21 @@ class TypeMethod:
func: object
is_static: bool
+ def as_callable(self, object cls):
+ """Create a Python method attribute for this method on ``cls``."""
+ cdef str name = self.name
+ cdef str doc = self.doc or f"Method `{name}` of class
`{cls.__qualname__}`"
+ cdef object func = self.func
+ if self.is_static:
+ func = staticmethod(func)
+ else:
+ func = _member_method_wrapper(func)
+ func.__module__ = cls.__module__
+ func.__name__ = name
+ func.__qualname__ = f"{cls.__qualname__}.{name}"
+ func.__doc__ = doc
+ return func
Review Comment:
/gemini I tested locally but can't reproduce the claimed issue. Could you
double check?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]