@@ -13,7 +13,7 @@ mod _socket {
1313 use crate :: common:: lock:: { PyMappedRwLockReadGuard , PyRwLock , PyRwLockReadGuard } ;
1414 use crate :: vm:: {
1515 builtins:: { PyBaseExceptionRef , PyListRef , PyStrRef , PyTupleRef , PyTypeRef } ,
16- convert:: { ToPyException , ToPyObject , TryFromBorrowedObject , TryFromObject } ,
16+ convert:: { IntoPyException , ToPyObject , TryFromBorrowedObject , TryFromObject } ,
1717 function:: { ArgBytesLike , ArgMemoryBuffer , Either , OptionalArg , OptionalOption } ,
1818 types:: { DefaultConstructor , Initializer } ,
1919 utils:: ToCString ,
@@ -540,7 +540,7 @@ mod _socket {
540540 ) ;
541541
542542 fn init ( zelf : PyRef < Self > , args : Self :: Args , vm : & VirtualMachine ) -> PyResult < ( ) > {
543- Self :: _init ( zelf, args, vm) . map_err ( |e| e. to_pyexception ( vm) )
543+ Self :: _init ( zelf, args, vm) . map_err ( |e| e. into_pyexception ( vm) )
544544 }
545545 }
546546
@@ -577,7 +577,7 @@ mod _socket {
577577 }
578578 if socket_kind == -1 {
579579 // TODO: when socket2 cuts a new release, type will be available on all os
580- // socket_kind = sock.r#type().map_err(|e| e.to_pyexception (vm))?.into();
580+ // socket_kind = sock.r#type().map_err(|e| e.into_pyexception (vm))?.into();
581581 let res = unsafe {
582582 c:: getsockopt (
583583 sock_fileno ( & sock) as _ ,
@@ -1213,13 +1213,13 @@ mod _socket {
12131213 }
12141214 }
12151215 }
1216- impl ToPyException for IoOrPyException {
1216+ impl IntoPyException for IoOrPyException {
12171217 #[ inline]
1218- fn to_pyexception ( self , vm : & VirtualMachine ) -> PyBaseExceptionRef {
1218+ fn into_pyexception ( self , vm : & VirtualMachine ) -> PyBaseExceptionRef {
12191219 match self {
12201220 Self :: Timeout => timeout_error ( vm) ,
12211221 Self :: Py ( exc) => exc,
1222- Self :: Io ( err) => err. to_pyexception ( vm) ,
1222+ Self :: Io ( err) => err. into_pyexception ( vm) ,
12231223 }
12241224 }
12251225 }
@@ -1521,7 +1521,7 @@ mod _socket {
15211521 #[ pyfunction]
15221522 fn if_nametoindex ( name : PyObjectRef , vm : & VirtualMachine ) -> PyResult < IfIndex > {
15231523 let name = crate :: vm:: stdlib:: os:: FsPath :: try_from ( name, true , vm) ?;
1524- let name = ffi:: CString :: new ( name. as_bytes ( ) ) . map_err ( |err| err. to_pyexception ( vm) ) ?;
1524+ let name = ffi:: CString :: new ( name. as_bytes ( ) ) . map_err ( |err| err. into_pyexception ( vm) ) ?;
15251525
15261526 let ret = unsafe { c:: if_nametoindex ( name. as_ptr ( ) ) } ;
15271527
@@ -1561,7 +1561,7 @@ mod _socket {
15611561 #[ cfg( not( windows) ) ]
15621562 {
15631563 let list = if_nameindex ( )
1564- . map_err ( |err| err. to_pyexception ( vm) ) ?
1564+ . map_err ( |err| err. into_pyexception ( vm) ) ?
15651565 . to_slice ( )
15661566 . iter ( )
15671567 . map ( |iface| {
@@ -1625,9 +1625,10 @@ mod _socket {
16251625 {
16261626 use std:: ptr;
16271627
1628- let table = MibTable :: get_raw ( ) . map_err ( |err| err. to_pyexception ( vm) ) ?;
1628+ let table = MibTable :: get_raw ( ) . map_err ( |err| err. into_pyexception ( vm) ) ?;
16291629 let list = table. as_slice ( ) . iter ( ) . map ( |entry| {
1630- let name = get_name ( & entry. InterfaceLuid ) . map_err ( |err| err. to_pyexception ( vm) ) ?;
1630+ let name =
1631+ get_name ( & entry. InterfaceLuid ) . map_err ( |err| err. into_pyexception ( vm) ) ?;
16311632 let tup = ( entry. InterfaceIndex , name. to_string_lossy ( ) ) ;
16321633 Ok ( tup. to_pyobject ( vm) )
16331634 } ) ;
0 commit comments