@@ -90,13 +90,12 @@ impl PyGuide {
9090
9191 fn __reduce__ ( & self ) -> PyResult < ( PyObject , ( Vec < u8 > , ) ) > {
9292 Python :: with_gil ( |py| {
93- let cls =
94- PyModule :: import_bound ( py, "outlines_core.outlines_core_rs" ) ?. getattr ( "Guide" ) ?;
93+ let cls = PyModule :: import ( py, "outlines_core.outlines_core_rs" ) ?. getattr ( "Guide" ) ?;
9594 let binary_data: Vec < u8 > =
9695 bincode:: encode_to_vec ( self , config:: standard ( ) ) . map_err ( |e| {
9796 PyErr :: new :: < PyValueError , _ > ( format ! ( "Serialization of Guide failed: {}" , e) )
9897 } ) ?;
99- Ok ( ( cls. getattr ( "from_binary" ) ?. to_object ( py ) , ( binary_data, ) ) )
98+ Ok ( ( cls. getattr ( "from_binary" ) ?. unbind ( ) , ( binary_data, ) ) )
10099 } )
101100 }
102101
@@ -167,13 +166,12 @@ impl PyIndex {
167166
168167 fn __reduce__ ( & self ) -> PyResult < ( PyObject , ( Vec < u8 > , ) ) > {
169168 Python :: with_gil ( |py| {
170- let cls =
171- PyModule :: import_bound ( py, "outlines_core.outlines_core_rs" ) ?. getattr ( "Index" ) ?;
169+ let cls = PyModule :: import ( py, "outlines_core.outlines_core_rs" ) ?. getattr ( "Index" ) ?;
172170 let binary_data: Vec < u8 > = bincode:: encode_to_vec ( & self . 0 , config:: standard ( ) )
173171 . map_err ( |e| {
174172 PyErr :: new :: < PyValueError , _ > ( format ! ( "Serialization of Index failed: {}" , e) )
175173 } ) ?;
176- Ok ( ( cls. getattr ( "from_binary" ) ?. to_object ( py ) , ( binary_data, ) ) )
174+ Ok ( ( cls. getattr ( "from_binary" ) ?. unbind ( ) , ( binary_data, ) ) )
177175 } )
178176 }
179177
@@ -300,16 +298,16 @@ impl PyVocabulary {
300298
301299 fn __reduce__ ( & self ) -> PyResult < ( PyObject , ( Vec < u8 > , ) ) > {
302300 Python :: with_gil ( |py| {
303- let cls = PyModule :: import_bound ( py , "outlines_core.outlines_core_rs" ) ?
304- . getattr ( "Vocabulary" ) ?;
301+ let cls =
302+ PyModule :: import ( py , "outlines_core.outlines_core_rs" ) ? . getattr ( "Vocabulary" ) ?;
305303 let binary_data: Vec < u8 > =
306304 bincode:: encode_to_vec ( self , config:: standard ( ) ) . map_err ( |e| {
307305 PyErr :: new :: < PyValueError , _ > ( format ! (
308306 "Serialization of Vocabulary failed: {}" ,
309307 e
310308 ) )
311309 } ) ?;
312- Ok ( ( cls. getattr ( "from_binary" ) ?. to_object ( py ) , ( binary_data, ) ) )
310+ Ok ( ( cls. getattr ( "from_binary" ) ?. unbind ( ) , ( binary_data, ) ) )
313311 } )
314312 }
315313
0 commit comments