@@ -1384,13 +1384,20 @@ mod _socket {
13841384
13851385 impl DefaultConstructor for PySocket { }
13861386
1387+ #[ derive( FromArgs ) ]
1388+ pub struct SocketInitArgs {
1389+ #[ pyarg( any, optional) ]
1390+ family : OptionalArg < i32 > ,
1391+ #[ pyarg( any, optional) ]
1392+ r#type : OptionalArg < i32 > ,
1393+ #[ pyarg( any, optional) ]
1394+ proto : OptionalArg < i32 > ,
1395+ #[ pyarg( any, optional) ]
1396+ fileno : OptionalOption < PyObjectRef > ,
1397+ }
1398+
13871399 impl Initializer for PySocket {
1388- type Args = (
1389- OptionalArg < i32 > ,
1390- OptionalArg < i32 > ,
1391- OptionalArg < i32 > ,
1392- OptionalOption < PyObjectRef > ,
1393- ) ;
1400+ type Args = SocketInitArgs ;
13941401
13951402 fn init ( zelf : PyRef < Self > , args : Self :: Args , vm : & VirtualMachine ) -> PyResult < ( ) > {
13961403 Self :: _init ( zelf, args, vm) . map_err ( |e| e. into_pyexception ( vm) )
@@ -1414,13 +1421,14 @@ mod _socket {
14141421 impl PySocket {
14151422 fn _init (
14161423 zelf : PyRef < Self > ,
1417- ( family , socket_kind , proto , fileno ) : <Self as Initializer >:: Args ,
1424+ args : <Self as Initializer >:: Args ,
14181425 vm : & VirtualMachine ,
14191426 ) -> Result < ( ) , IoOrPyException > {
1420- let mut family = family. unwrap_or ( -1 ) ;
1421- let mut socket_kind = socket_kind . unwrap_or ( -1 ) ;
1422- let mut proto = proto. unwrap_or ( -1 ) ;
1427+ let mut family = args . family . unwrap_or ( -1 ) ;
1428+ let mut socket_kind = args . r#type . unwrap_or ( -1 ) ;
1429+ let mut proto = args . proto . unwrap_or ( -1 ) ;
14231430
1431+ let fileno = args. fileno ;
14241432 let sock;
14251433
14261434 // On Windows, fileno can be bytes from socket.share() for fromshare()
0 commit comments