Skip to content

QuickStart python demo run failed #2332

@V4yne

Description

@V4yne

Search before asking

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

Version

main

Component(s)

Python

Minimal reproduce step

After following the steps in the BUILD file to compile pyfory, I ran the Python demo from the Quickstart guide and encountered the error shown in the attached image. I noticed that the TypeInfo defined in both /fory/python/pyfory/_serialization.pyx and /fory/python/pyfory/_registry.py does not contain the namespace or typename fields. I would like to know whether this is a bug that needs to be fixed or if this behavior is expected.

Image

Here are the steps I took:

cd python
pip uninstall -y numpy
pip install pyarrow==15.0.0 Cython wheel pytest
pip install -v -e .
python3 test.py

test.py:

from typing import Dict
import pyfory

class SomeClass:
    f1: "SomeClass"
    f2: Dict[str, str]
    f3: Dict[str, str]

fory = pyfory.Fory(ref_tracking=True)
fory.register_type(SomeClass, typename="example.SomeClass")
obj = SomeClass()
obj.f2 = {"k1": "v1", "k2": "v2"}
obj.f1, obj.f3 = obj, obj.f2
data = fory.serialize(obj)
# bytes can be data serialized by other languages.
print(fory.deserialize(data))

What did you expect to see?

check whether it is a bug or bugfix

What did you see instead?

run test.py successly

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

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