Skip to content

[Python] Cross-language testEnumField fails with AttributeError in Python #2211

Open
@LouisLou2

Description

@LouisLou2

Search before asking

  • I had searched in the issues and found no similar issues.

Version

latest commit 3d3dde

Component(s)

Python

Minimal reproduce step

  1. Run the Java test case testEnumField in org.apache.fury.CrossLanguageTest

  2. The test attempts to execute the Python counterpart using:

python -m pyfury.tests.test_cross_language test_enum_field [path]
  1. The Java side fails with an assertion error, and the Python side fails with an AttributeError.

What did you expect to see?

The cross-language enum field serialization test should pass successfully, with the Java side correctly validating that the serialized data matches the expected result.

What did you see instead?

  1. Java test failure:
[ERROR] testEnumField(org.apache.fury.CrossLanguageTest)  Time elapsed: 0.655 s  <<< FAILURE!
java.lang.AssertionError: expected [true] but found [false]
	at org.apache.fury.CrossLanguageTest.structRoundBack(CrossLanguageTest.java:534)
	at org.apache.fury.CrossLanguageTest.testEnumField(CrossLanguageTest.java:793)
  1. Python error:
AttributeError: 'pyfury._serialization.ClassInfo' object has no attribute 'namespace'

The error occurs in the Python deserializer when processing enum fields. The specific error path is:

File "D:\projects\fury_dev\fury\python\pyfury\_struct.py", line 263, in visit_customized
    classinfo.namespace + classinfo.typename
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'pyfury._serialization.ClassInfo' object has no attribute 'namespace'

This suggests that the ClassInfo object in the Python implementation is missing the namespace attribute that is being referenced in the code, causing cross-language enum field serialization to fail.

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions