This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 7e7b112679 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
7e7b112679 is described below

commit 7e7b1126797b45bed054dc606c1a125cebac54ac
Author: chaokunyang <[email protected]>
AuthorDate: Wed Apr 8 12:31:53 2026 +0000

    🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
 docs/guide/python/custom-serializers.md | 22 +++++++++++-----------
 docs/guide/python/type-registration.md  |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/docs/guide/python/custom-serializers.md 
b/docs/guide/python/custom-serializers.md
index e61cabba1b..e5ea516b12 100644
--- a/docs/guide/python/custom-serializers.md
+++ b/docs/guide/python/custom-serializers.md
@@ -36,22 +36,22 @@ class Foo:
     f2: str
 
 class FooSerializer(Serializer):
-    def __init__(self, fory, cls):
-        super().__init__(fory, cls)
+    def __init__(self, type_resolver, cls):
+        super().__init__(type_resolver, cls)
 
-    def write(self, buffer, obj: Foo):
+    def write(self, write_context, obj: Foo):
         # Custom serialization logic
-        buffer.write_varint32(obj.f1)
-        buffer.write_string(obj.f2)
+        write_context.write_varint32(obj.f1)
+        write_context.write_string(obj.f2)
 
-    def read(self, buffer):
+    def read(self, read_context):
         # Custom deserialization logic
-        f1 = buffer.read_varint32()
-        f2 = buffer.read_string()
+        f1 = read_context.read_varint32()
+        f2 = read_context.read_string()
         return Foo(f1, f2)
 
 f = pyfory.Fory()
-f.register(Foo, type_id=100, serializer=FooSerializer(f, Foo))
+f.register(Foo, type_id=100, serializer=FooSerializer(f.type_resolver, Foo))
 
 # Now Foo uses your custom serializer
 data = f.dumps(Foo(42, "hello"))
@@ -125,10 +125,10 @@ value = buffer.read_bool()
 fory = pyfory.Fory()
 
 # Register with type_id
-fory.register(MyClass, type_id=100, serializer=MySerializer(fory, MyClass))
+fory.register(MyClass, type_id=100, 
serializer=MySerializer(fory.type_resolver, MyClass))
 
 # Register with typename (for xlang)
-fory.register(MyClass, typename="com.example.MyClass", 
serializer=MySerializer(fory, MyClass))
+fory.register(MyClass, typename="com.example.MyClass", 
serializer=MySerializer(fory.type_resolver, MyClass))
 ```
 
 ## Related Topics
diff --git a/docs/guide/python/type-registration.md 
b/docs/guide/python/type-registration.md
index ee4325d91c..ff0d04dbb8 100644
--- a/docs/guide/python/type-registration.md
+++ b/docs/guide/python/type-registration.md
@@ -71,7 +71,7 @@ fory.register(MyClass, typename="com.example.MyClass")
 ### Pattern 3: With Custom Serializer
 
 ```python
-fory.register(MyClass, type_id=100, serializer=MySerializer(fory, MyClass))
+fory.register(MyClass, type_id=100, 
serializer=MySerializer(fory.type_resolver, MyClass))
 ```
 
 ### Pattern 4: Batch Registration


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to