junrushao commented on code in PR #676:
URL: https://github.com/apache/tvm-ffi/pull/676#discussion_r3614906399
##########
include/tvm/ffi/any.h:
##########
@@ -871,6 +871,44 @@ struct AnyEqual {
}
};
+// Defer these definitions until any.h so null Arc values can be rejected with
+// TypeError while object.h stays below the error layer.
+//! \cond Doxygen_Suppress
+template <typename TObject>
+TVM_FFI_INLINE void
+TypeTraits<Arc<TObject>, std::enable_if_t<is_object_subclass_v<TObject> &&
+ std::is_same_v<TObject,
std::remove_cv_t<TObject>>>>::
+ CopyToAnyView(const Arc<TObject>& src, TVMFFIAny* result) {
+ const ObjectPtr<TObject>& ptr = src;
+ if (TVM_FFI_PREDICT_FALSE(ptr == nullptr)) {
Review Comment:
yeah this checking is too defensive
--
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]