@@ -6,7 +6,7 @@ use pyo3::types::{
66 PyDict , PyDictMethods , PyList , PyListMethods , PyMapping , PySequence , PyString , PyTuple ,
77 PyTupleMethods ,
88} ;
9- use pyo3:: { Bound , BoundObject , IntoPyObject , PyAny , PyResult , Python } ;
9+ use pyo3:: { Bound , IntoPyObject , IntoPyObjectExt , PyAny , PyResult , Python } ;
1010use serde:: { ser, Serialize } ;
1111
1212use crate :: error:: { PythonizeError , Result } ;
@@ -267,11 +267,8 @@ impl<'py, P: PythonizeTypes> Pythonizer<'py, P> {
267267 fn serialise_default < T > ( self , v : T ) -> Result < Bound < ' py , PyAny > >
268268 where
269269 T : IntoPyObject < ' py > ,
270- <T as IntoPyObject < ' py > >:: Error : Into < PythonizeError > ,
271270 {
272- v. into_pyobject ( self . py )
273- . map ( |x| x. into_any ( ) . into_bound ( ) )
274- . map_err ( Into :: into)
271+ v. into_bound_py_any ( self . py ) . map_err ( Into :: into)
275272 }
276273}
277274
@@ -306,6 +303,10 @@ impl<'py, P: PythonizeTypes> ser::Serializer for Pythonizer<'py, P> {
306303 self . serialise_default ( v)
307304 }
308305
306+ fn serialize_i128 ( self , v : i128 ) -> Result < Bound < ' py , PyAny > > {
307+ self . serialise_default ( v)
308+ }
309+
309310 fn serialize_u8 ( self , v : u8 ) -> Result < Bound < ' py , PyAny > > {
310311 self . serialise_default ( v)
311312 }
@@ -322,6 +323,10 @@ impl<'py, P: PythonizeTypes> ser::Serializer for Pythonizer<'py, P> {
322323 self . serialise_default ( v)
323324 }
324325
326+ fn serialize_u128 ( self , v : u128 ) -> Result < Bound < ' py , PyAny > > {
327+ self . serialise_default ( v)
328+ }
329+
325330 fn serialize_f32 ( self , v : f32 ) -> Result < Bound < ' py , PyAny > > {
326331 self . serialise_default ( v)
327332 }
@@ -874,6 +879,8 @@ mod test {
874879 f : u16 ,
875880 g : u32 ,
876881 h : u64 ,
882+ i : i128 ,
883+ j : u128 ,
877884 }
878885
879886 test_ser (
@@ -886,8 +893,10 @@ mod test {
886893 f : 6 ,
887894 g : 7 ,
888895 h : 8 ,
896+ i : 9 ,
897+ j : 10 ,
889898 } ,
890- r#"{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8}"# ,
899+ r#"{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10 }"# ,
891900 )
892901 }
893902
0 commit comments