@@ -554,13 +554,13 @@ impl StructBindGenerator {
554554 self ,
555555 " fn __match_args__(py: Python) -> Bound<pyo3::types::PyTuple> {"
556556 ) ;
557- write_str ! ( self , " pyo3::types::PyTuple::new_bound (py, [" ) ;
557+ write_str ! ( self , " pyo3::types::PyTuple::new (py, [" ) ;
558558
559559 for variable_info in & self . types {
560560 write_fmt ! ( self , " \" {}\" ," , variable_info. name) ;
561561 }
562562
563- write_str ! ( self , " ])" ) ;
563+ write_str ! ( self , " ]).unwrap() " ) ;
564564 write_str ! ( self , " }" ) ;
565565 }
566566
@@ -613,14 +613,11 @@ impl StructBindGenerator {
613613 write_str ! ( self , " let offset = flat_t.pack(&mut builder);" ) ;
614614 write_str ! ( self , " builder.finish(offset, None);" ) ;
615615 write_str ! ( self , "" ) ;
616- write_str ! (
617- self ,
618- " PyBytes::new_bound(py, builder.finished_data())"
619- ) ;
616+ write_str ! ( self , " PyBytes::new(py, builder.finished_data())" ) ;
620617 } else {
621618 write_str ! ( self , " let item = flat_t.pack();" ) ;
622619 write_str ! ( self , "" ) ;
623- write_str ! ( self , " PyBytes::new_bound (py, &item.0)" ) ;
620+ write_str ! ( self , " PyBytes::new (py, &item.0)" ) ;
624621 }
625622
626623 write_str ! ( self , " }" ) ;
@@ -797,9 +794,7 @@ impl Generator for StructBindGenerator {
797794 let variable_name = variable_info. name . as_str ( ) ;
798795
799796 let end = match & variable_info. rust_type {
800- RustType :: Vec ( InnerVecType :: U8 ) => {
801- Cow :: Borrowed ( "PyBytes::new_bound(py, &[]).unbind()" )
802- }
797+ RustType :: Vec ( InnerVecType :: U8 ) => Cow :: Borrowed ( "PyBytes::new(py, &[]).unbind()" ) ,
803798 RustType :: Vec ( _) => Cow :: Borrowed ( "Vec::new()" ) ,
804799 RustType :: Option ( _, _) => Cow :: Borrowed ( "None" ) ,
805800 RustType :: Union ( inner_type)
@@ -869,7 +864,7 @@ impl Generator for StructBindGenerator {
869864 RustType :: Vec ( InnerVecType :: U8 ) => {
870865 write_fmt ! (
871866 self ,
872- " {variable_name}: PyBytes::new_bound (py, &flat_t.{variable_name}).unbind(),"
867+ " {variable_name}: PyBytes::new (py, &flat_t.{variable_name}).unbind(),"
873868 )
874869 }
875870 RustType :: Vec ( InnerVecType :: String | InnerVecType :: Base ( _) ) => {
0 commit comments