SURYAS1306 commented on code in PR #3432:
URL: https://github.com/apache/fory/pull/3432#discussion_r2867376148
##########
python/pyfory/type_util.py:
##########
@@ -249,11 +249,17 @@ def infer_field(field_name, type_, visitor: TypeVisitor,
types_path=None):
else:
raise TypeError(f"Collection types should be {list, dict} instead
of {type_}")
else:
- if is_function(origin) or not hasattr(origin, "__annotations__"):
+ if is_function(origin):
Review Comment:
Previously, types without __annotations__ (including non-dataclass classes)
were being routed through the same branch as functions due to the or not
hasattr(origin, "__annotations__") condition.
This caused incorrect type dispatch for custom classes.
By removing the not hasattr(origin, "__annotations__") check, only actual
functions are handled in that branch, and class types now follow the intended
dispatch path.
Please let me know if I should clarify this further in the PR description.
--
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]