@@ -43,19 +43,19 @@ impl Token {
4343 ) -> Token {
4444 Python :: with_gil ( |py| Token {
4545 token_type,
46- token_type_py : PyNone :: get ( py) . into ( ) ,
47- text : PyString :: new ( py, & text) . into ( ) ,
46+ token_type_py : PyNone :: get_bound ( py) . into_py ( py ) ,
47+ text : PyString :: new_bound ( py, & text) . into_py ( py ) ,
4848 line,
4949 col,
5050 start,
5151 end,
52- comments : PyList :: new ( py, & comments) . into ( ) ,
52+ comments : PyList :: new_bound ( py, & comments) . into ( ) ,
5353 } )
5454 }
5555
5656 pub fn append_comments ( & self , comments : & mut Vec < String > ) {
5757 Python :: with_gil ( |py| {
58- let pylist = self . comments . as_ref ( py) ;
58+ let pylist = self . comments . bind ( py) ;
5959 for comment in comments. iter ( ) {
6060 if let Err ( _) = pylist. append ( comment) {
6161 panic ! ( "Failed to append comments to the Python list" ) ;
@@ -74,20 +74,20 @@ impl Token {
7474 Python :: with_gil ( |py| {
7575 Ok ( format ! (
7676 "<Token token_type: {}, text: {}, line: {}, col: {}, start: {}, end: {}, comments: {}>" ,
77- self . token_type_py. as_ref ( py) . repr( ) ?,
78- self . text. as_ref ( py) . repr( ) ?,
77+ self . token_type_py. bind ( py) . repr( ) ?,
78+ self . text. bind ( py) . repr( ) ?,
7979 self . line,
8080 self . col,
8181 self . start,
8282 self . end,
83- self . comments. as_ref ( py) . repr( ) ?,
83+ self . comments. bind ( py) . repr( ) ?,
8484 ) )
8585 } )
8686 }
8787}
8888
8989#[ pymodule]
90- fn sqlglotrs ( _py : Python < ' _ > , m : & PyModule ) -> PyResult < ( ) > {
90+ fn sqlglotrs ( m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
9191 m. add_class :: < Token > ( ) ?;
9292 m. add_class :: < TokenTypeSettings > ( ) ?;
9393 m. add_class :: < TokenizerSettings > ( ) ?;
0 commit comments