@@ -372,7 +372,7 @@ mod _socket {
372372 addr : PyObjectRef ,
373373 caller : & str ,
374374 vm : & VirtualMachine ,
375- ) -> PyResult < socket2:: SockAddr , IoOrPyException > {
375+ ) -> Result < socket2:: SockAddr , IoOrPyException > {
376376 let family = self . family . load ( ) ;
377377 match family {
378378 #[ cfg( unix) ]
@@ -550,7 +550,7 @@ mod _socket {
550550 zelf : PyRef < Self > ,
551551 ( family, socket_kind, proto, fileno) : <Self as Initializer >:: Args ,
552552 vm : & VirtualMachine ,
553- ) -> PyResult < ( ) , IoOrPyException > {
553+ ) -> Result < ( ) , IoOrPyException > {
554554 let mut family = family. unwrap_or ( -1 ) ;
555555 let mut socket_kind = socket_kind. unwrap_or ( -1 ) ;
556556 let mut proto = proto. unwrap_or ( -1 ) ;
@@ -629,7 +629,7 @@ mod _socket {
629629 & self ,
630630 address : PyObjectRef ,
631631 vm : & VirtualMachine ,
632- ) -> PyResult < ( ) , IoOrPyException > {
632+ ) -> Result < ( ) , IoOrPyException > {
633633 self . connect_inner ( address, "connect" , vm)
634634 }
635635
@@ -642,13 +642,13 @@ mod _socket {
642642 }
643643
644644 #[ pymethod]
645- fn bind ( & self , address : PyObjectRef , vm : & VirtualMachine ) -> PyResult < ( ) , IoOrPyException > {
645+ fn bind ( & self , address : PyObjectRef , vm : & VirtualMachine ) -> Result < ( ) , IoOrPyException > {
646646 let sock_addr = self . extract_address ( address, "bind" , vm) ?;
647647 Ok ( self . sock ( ) ?. bind ( & sock_addr) ?)
648648 }
649649
650650 #[ pymethod]
651- fn listen ( & self , backlog : OptionalArg < i32 > ) -> PyResult < ( ) , io:: Error > {
651+ fn listen ( & self , backlog : OptionalArg < i32 > ) -> io:: Result < ( ) > {
652652 let backlog = backlog. unwrap_or ( 128 ) ;
653653 let backlog = if backlog < 0 { 0 } else { backlog } ;
654654 self . sock ( ) ?. listen ( backlog)
@@ -658,7 +658,7 @@ mod _socket {
658658 fn _accept (
659659 & self ,
660660 vm : & VirtualMachine ,
661- ) -> PyResult < ( RawSocket , PyObjectRef ) , IoOrPyException > {
661+ ) -> Result < ( RawSocket , PyObjectRef ) , IoOrPyException > {
662662 let ( sock, addr) = self . sock_op ( vm, SelectKind :: Read , || self . sock ( ) ?. accept ( ) ) ?;
663663 let fd = into_sock_fileno ( sock) ;
664664 Ok ( ( fd, get_addr_tuple ( & addr, vm) ) )
@@ -670,7 +670,7 @@ mod _socket {
670670 bufsize : usize ,
671671 flags : OptionalArg < i32 > ,
672672 vm : & VirtualMachine ,
673- ) -> PyResult < Vec < u8 > , IoOrPyException > {
673+ ) -> Result < Vec < u8 > , IoOrPyException > {
674674 let flags = flags. unwrap_or ( 0 ) ;
675675 let mut buffer = Vec :: with_capacity ( bufsize) ;
676676 let sock = self . sock ( ) ?;
@@ -687,7 +687,7 @@ mod _socket {
687687 buf : ArgMemoryBuffer ,
688688 flags : OptionalArg < i32 > ,
689689 vm : & VirtualMachine ,
690- ) -> PyResult < usize , IoOrPyException > {
690+ ) -> Result < usize , IoOrPyException > {
691691 let flags = flags. unwrap_or ( 0 ) ;
692692 let sock = self . sock ( ) ?;
693693 let mut buf = buf. borrow_buf_mut ( ) ;
@@ -703,7 +703,7 @@ mod _socket {
703703 bufsize : isize ,
704704 flags : OptionalArg < i32 > ,
705705 vm : & VirtualMachine ,
706- ) -> PyResult < ( Vec < u8 > , PyObjectRef ) , IoOrPyException > {
706+ ) -> Result < ( Vec < u8 > , PyObjectRef ) , IoOrPyException > {
707707 let flags = flags. unwrap_or ( 0 ) ;
708708 let bufsize = bufsize
709709 . to_usize ( )
@@ -724,7 +724,7 @@ mod _socket {
724724 nbytes : OptionalArg < isize > ,
725725 flags : OptionalArg < i32 > ,
726726 vm : & VirtualMachine ,
727- ) -> PyResult < ( usize , PyObjectRef ) , IoOrPyException > {
727+ ) -> Result < ( usize , PyObjectRef ) , IoOrPyException > {
728728 let mut buf = buf. borrow_buf_mut ( ) ;
729729 let buf = & mut * buf;
730730 let buf = match nbytes {
@@ -754,7 +754,7 @@ mod _socket {
754754 bytes : ArgBytesLike ,
755755 flags : OptionalArg < i32 > ,
756756 vm : & VirtualMachine ,
757- ) -> PyResult < usize , IoOrPyException > {
757+ ) -> Result < usize , IoOrPyException > {
758758 let flags = flags. unwrap_or ( 0 ) ;
759759 let buf = bytes. borrow_buf ( ) ;
760760 let buf = & * buf;
@@ -769,7 +769,7 @@ mod _socket {
769769 bytes : ArgBytesLike ,
770770 flags : OptionalArg < i32 > ,
771771 vm : & VirtualMachine ,
772- ) -> PyResult < ( ) , IoOrPyException > {
772+ ) -> Result < ( ) , IoOrPyException > {
773773 let flags = flags. unwrap_or ( 0 ) ;
774774
775775 let timeout = self . get_timeout ( ) . ok ( ) ;
@@ -799,7 +799,7 @@ mod _socket {
799799 arg2 : PyObjectRef ,
800800 arg3 : OptionalArg < PyObjectRef > ,
801801 vm : & VirtualMachine ,
802- ) -> PyResult < usize , IoOrPyException > {
802+ ) -> Result < usize , IoOrPyException > {
803803 // signature is bytes[, flags], address
804804 let ( flags, address) = match arg3 {
805805 OptionalArg :: Present ( arg3) => {
@@ -966,7 +966,7 @@ mod _socket {
966966 }
967967
968968 #[ pymethod]
969- fn shutdown ( & self , how : i32 , vm : & VirtualMachine ) -> PyResult < ( ) , IoOrPyException > {
969+ fn shutdown ( & self , how : i32 , vm : & VirtualMachine ) -> Result < ( ) , IoOrPyException > {
970970 let how = match how {
971971 c:: SHUT_RD => Shutdown :: Read ,
972972 c:: SHUT_WR => Shutdown :: Write ,
@@ -1113,7 +1113,7 @@ mod _socket {
11131113
11141114 #[ cfg( all( unix, not( target_os = "redox" ) ) ) ]
11151115 #[ pyfunction]
1116- fn sethostname ( hostname : PyStrRef ) -> PyResult < ( ) , nix:: errno :: Errno > {
1116+ fn sethostname ( hostname : PyStrRef ) -> nix:: Result < ( ) > {
11171117 nix:: unistd:: sethostname ( hostname. as_str ( ) )
11181118 }
11191119
@@ -1315,7 +1315,7 @@ mod _socket {
13151315 fn getaddrinfo (
13161316 opts : GAIOptions ,
13171317 vm : & VirtualMachine ,
1318- ) -> PyResult < Vec < PyObjectRef > , IoOrPyException > {
1318+ ) -> Result < Vec < PyObjectRef > , IoOrPyException > {
13191319 let hints = dns_lookup:: AddrInfoHints {
13201320 socktype : opts. ty ,
13211321 protocol : opts. proto ,
@@ -1356,7 +1356,7 @@ mod _socket {
13561356 fn gethostbyaddr (
13571357 addr : PyStrRef ,
13581358 vm : & VirtualMachine ,
1359- ) -> PyResult < ( String , PyListRef , PyListRef ) , IoOrPyException > {
1359+ ) -> Result < ( String , PyListRef , PyListRef ) , IoOrPyException > {
13601360 let addr = get_addr ( vm, addr, c:: AF_UNSPEC ) ?;
13611361 let ( hostname, _) = dns_lookup:: getnameinfo ( & addr, 0 )
13621362 . map_err ( |e| convert_socket_error ( vm, e, SocketError :: HError ) ) ?;
@@ -1369,7 +1369,7 @@ mod _socket {
13691369 }
13701370
13711371 #[ pyfunction]
1372- fn gethostbyname ( name : PyStrRef , vm : & VirtualMachine ) -> PyResult < String , IoOrPyException > {
1372+ fn gethostbyname ( name : PyStrRef , vm : & VirtualMachine ) -> Result < String , IoOrPyException > {
13731373 let addr = get_addr ( vm, name, c:: AF_INET ) ?;
13741374 match addr {
13751375 SocketAddr :: V4 ( ip) => Ok ( ip. ip ( ) . to_string ( ) ) ,
@@ -1381,7 +1381,7 @@ mod _socket {
13811381 fn gethostbyname_ex (
13821382 name : PyStrRef ,
13831383 vm : & VirtualMachine ,
1384- ) -> PyResult < ( String , PyListRef , PyListRef ) , IoOrPyException > {
1384+ ) -> Result < ( String , PyListRef , PyListRef ) , IoOrPyException > {
13851385 let addr = get_addr ( vm, name, c:: AF_UNSPEC ) ?;
13861386 let ( hostname, _) = dns_lookup:: getnameinfo ( & addr, 0 )
13871387 . map_err ( |e| convert_socket_error ( vm, e, SocketError :: HError ) ) ?;
@@ -1450,7 +1450,7 @@ mod _socket {
14501450 address : PyTupleRef ,
14511451 flags : i32 ,
14521452 vm : & VirtualMachine ,
1453- ) -> PyResult < ( String , String ) , IoOrPyException > {
1453+ ) -> Result < ( String , String ) , IoOrPyException > {
14541454 match address. len ( ) {
14551455 2 | 3 | 4 => { }
14561456 _ => {
@@ -1500,7 +1500,7 @@ mod _socket {
15001500 family : OptionalArg < i32 > ,
15011501 socket_kind : OptionalArg < i32 > ,
15021502 proto : OptionalArg < i32 > ,
1503- ) -> PyResult < ( PySocket , PySocket ) , IoOrPyException > {
1503+ ) -> Result < ( PySocket , PySocket ) , IoOrPyException > {
15041504 let family = family. unwrap_or ( libc:: AF_UNIX ) ;
15051505 let socket_kind = socket_kind. unwrap_or ( libc:: SOCK_STREAM ) ;
15061506 let proto = proto. unwrap_or ( 0 ) ;
@@ -1685,7 +1685,7 @@ mod _socket {
16851685 vm : & VirtualMachine ,
16861686 pyname : PyStrRef ,
16871687 af : i32 ,
1688- ) -> PyResult < SocketAddr , IoOrPyException > {
1688+ ) -> Result < SocketAddr , IoOrPyException > {
16891689 let name = pyname. as_str ( ) ;
16901690 if name. is_empty ( ) {
16911691 let hints = dns_lookup:: AddrInfoHints {
@@ -1897,7 +1897,7 @@ mod _socket {
18971897 }
18981898
18991899 #[ pyfunction]
1900- fn dup ( x : PyObjectRef , vm : & VirtualMachine ) -> PyResult < RawSocket , IoOrPyException > {
1900+ fn dup ( x : PyObjectRef , vm : & VirtualMachine ) -> Result < RawSocket , IoOrPyException > {
19011901 let sock = get_raw_sock ( x, vm) ?;
19021902 let sock = std:: mem:: ManuallyDrop :: new ( sock_from_raw ( sock, vm) ?) ;
19031903 let newsock = sock. try_clone ( ) ?;
@@ -1908,7 +1908,7 @@ mod _socket {
19081908 }
19091909
19101910 #[ pyfunction]
1911- fn close ( x : PyObjectRef , vm : & VirtualMachine ) -> PyResult < ( ) , IoOrPyException > {
1911+ fn close ( x : PyObjectRef , vm : & VirtualMachine ) -> Result < ( ) , IoOrPyException > {
19121912 Ok ( close_inner ( get_raw_sock ( x, vm) ?) ?)
19131913 }
19141914
0 commit comments