LouisLou2 opened a new issue, #2163: URL: https://github.com/apache/fury/issues/2163
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues. ### Version latest commit ### Component(s) Python ### Minimal reproduce step ```python from dataclasses import dataclass from enum import Enum import pyfury @dataclass class ComplexObject3: class EnumFoo(Enum): A = 1 B = 2 f1: EnumFoo def test_serialize_enum_in_class(): fury = pyfury.Fury(language=pyfury.Language.XLANG, ref_tracking=True) fury.register_type(ComplexObject3.EnumFoo) fury.register_type(ComplexObject3, typename="test.ComplexObject3") obj = ComplexObject3( f1=ComplexObject3.EnumFoo.A, ) new_buf = fury.serialize(obj) test_serialize_enum_in_class() ``` ### What did you expect to see? The test cases for cross-language serialization between Java and Python should pass without errors. The `Enum` values in the `Map` fields (`f2` and `f3`) should be serialized and deserialized correctly. ### What did you see instead? The test case failed with the following error: ```plaintext Traceback (most recent call last): File "D:\projects\fury_dev\fury\python\pyfury\tests\test_cross_language.py", line 661, in <module> test_serialize_enum_in_class() File "D:\projects\fury_dev\fury\python\pyfury\tests\test_cross_language.py", line 657, in test_serialize_enum_in_class new_buf = fury.serialize(obj) File "python/pyfury/_serialization.pyx", line 641, in pyfury._serialization.Fury.serialize File "python/pyfury/_serialization.pyx", line 690, in pyfury._serialization.Fury._serialize File "python/pyfury/_serialization.pyx", line 748, in pyfury._serialization.Fury.xserialize_ref File "python/pyfury/_serialization.pyx", line 766, in pyfury._serialization.Fury.xserialize_nonref File "python/pyfury/_serialization.pyx", line 1061, in pyfury._serialization.Serializer.xwrite File "d:\projects\fury_dev\fury\python\pyfury\_struct.py", line 205, in xwrite self.fury.xserialize_ref(buffer, field_value, serializer=serializer) File "python/pyfury/_serialization.pyx", line 744, in pyfury._serialization.Fury.xserialize_ref File "python/pyfury/_serialization.pyx", line 748, in pyfury._serialization.Fury.xserialize_ref File "python/pyfury/_serialization.pyx", line 766, in pyfury._serialization.Fury.xserialize_nonref File "python/pyfury/_serialization.pyx", line 2114, in pyfury._serialization.EnumSerializer.xwrite NotImplementedError ``` The error occurs in the `EnumSerializer` implementation for the `Enum` field during serialization. ### Anything Else? This issue seems related to the lack of implementation in the `EnumSerializer` for handling `Enum` fields. Specifically, the `EnumSerializer.xwrite` method raises a `NotImplementedError` when attempting to serialize the `Enum` field (`f1`). ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- 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]
