@@ -154,7 +154,7 @@ public void __init__(CodeContext/*!*/ context, int family = DefaultAddressFamily
154154 socket = HandleToSocket ( handle ) ;
155155 if ( socket is null ) {
156156 throw PythonOps . OSError ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows )
157- ? PythonErrorNumber . WSAENOTSOCK : PythonErrorNumber . EBADF ,
157+ ? PythonErrno . WSAENOTSOCK : PythonErrno . EBADF ,
158158 "Bad file descriptor" ) ;
159159 }
160160 } else {
@@ -310,7 +310,7 @@ public int connect_ex([NotNone] PythonTuple address) {
310310 } catch ( SocketException ex ) {
311311 return ! ClrModule . IsMono ? ex . NativeErrorCode : MapMonoSocketErrorToErrno ( ex . SocketErrorCode ) ;
312312 }
313- return PythonErrorNumber . ENOERROR ;
313+ return PythonErrno . ENOERROR ;
314314 }
315315
316316 public long detach ( ) {
@@ -1768,15 +1768,15 @@ internal static Exception MakeException(CodeContext/*!*/ context, Exception exce
17681768 // The following SocketErrors have no defined mapping to errno, so a generic errno is used instead
17691769 case SocketError . ProcessLimit :
17701770 return PythonExceptions . CreateThrowable ( error ,
1771- ! RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ? PythonErrorNumber . EPROCLIM : PythonErrorNumber . ENOTSUP ,
1771+ ! RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ? PythonErrno . EPROCLIM : PythonErrno . ENOTSUP ,
17721772 "Too many processes" ) ;
17731773 case SocketError . NotInitialized :
17741774 case SocketError . SystemNotReady :
17751775 case SocketError . VersionNotSupported :
17761776 case SocketError . TypeNotFound :
1777- return PythonExceptions . CreateThrowable ( error , PythonErrorNumber . ENOTSUP , $ "Socket error: { se . SocketErrorCode } ") ;
1777+ return PythonExceptions . CreateThrowable ( error , PythonErrno . ENOTSUP , $ "Socket error: { se . SocketErrorCode } ") ;
17781778 case SocketError . SocketError :
1779- return PythonExceptions . CreateThrowable ( error , PythonErrorNumber . EIO , $ "Unknown socket error") ;
1779+ return PythonExceptions . CreateThrowable ( error , PythonErrno . EIO , $ "Unknown socket error") ;
17801780
17811781 // For the rest, NativeErrorCode provides the errno (except on Mono)
17821782 default :
@@ -1787,7 +1787,7 @@ internal static Exception MakeException(CodeContext/*!*/ context, Exception exce
17871787 return PythonExceptions . CreateThrowable ( error , se . NativeErrorCode , se . Message ) ;
17881788 }
17891789 } else if ( exception is ObjectDisposedException ) {
1790- return PythonExceptions . CreateThrowable ( error , PythonErrorNumber . EBADF , "Socket is closed" ) ;
1790+ return PythonExceptions . CreateThrowable ( error , PythonErrno . EBADF , "Socket is closed" ) ;
17911791 } else if ( exception is InvalidOperationException or ArgumentException ) {
17921792 return MakeException ( context , new SocketException ( ( int ) SocketError . InvalidArgument ) ) ;
17931793 } else {
@@ -1856,56 +1856,56 @@ private static Exception MakeGaiException(CodeContext context, int eaiCode) {
18561856 private static int MapMonoSocketErrorToErrno ( SocketError serror ) {
18571857 monoSocketErrorToNativeError ??= new Dictionary < SocketError , int > ( 45 )
18581858 {
1859- { SocketError . AccessDenied , PythonErrorNumber . EACCES } , // could also have been EPERM
1860- { SocketError . AddressAlreadyInUse , PythonErrorNumber . EADDRINUSE } ,
1861- { SocketError . AddressNotAvailable , PythonErrorNumber . EADDRNOTAVAIL } ,
1862- { SocketError . AddressFamilyNotSupported , PythonErrorNumber . EAFNOSUPPORT } ,
1863- { SocketError . AlreadyInProgress , PythonErrorNumber . EALREADY } ,
1864- { SocketError . ConnectionAborted , PythonErrorNumber . ECONNABORTED } ,
1865- { SocketError . ConnectionRefused , PythonErrorNumber . ECONNREFUSED } ,
1866- { SocketError . ConnectionReset , PythonErrorNumber . ECONNRESET } ,
1867- { SocketError . DestinationAddressRequired , PythonErrorNumber . EDESTADDRREQ } ,
1868- { SocketError . Disconnecting , PythonErrorNumber . ESHUTDOWN } ,
1869- { SocketError . Fault , PythonErrorNumber . EFAULT } ,
1870- { SocketError . HostDown , PythonErrorNumber . EHOSTDOWN } ,
1871- { SocketError . HostNotFound , PythonErrorNumber . ENOENT } ,
1872- { SocketError . HostUnreachable , PythonErrorNumber . EHOSTUNREACH } ,
1873- { SocketError . InProgress , PythonErrorNumber . EINPROGRESS } ,
1874- { SocketError . Interrupted , PythonErrorNumber . EINTR } ,
1875- { SocketError . InvalidArgument , PythonErrorNumber . EINVAL } ,
1876- { SocketError . IOPending , PythonErrorNumber . EINPROGRESS } ,
1877- { SocketError . IsConnected , PythonErrorNumber . EISCONN } ,
1878- { SocketError . MessageSize , PythonErrorNumber . EMSGSIZE } ,
1879- { SocketError . NetworkDown , PythonErrorNumber . ENETDOWN } ,
1880- { SocketError . NetworkReset , PythonErrorNumber . ENETRESET } ,
1881- { SocketError . NetworkUnreachable , PythonErrorNumber . ENETUNREACH } ,
1882- { SocketError . NoBufferSpaceAvailable , PythonErrorNumber . ENOBUFS } ,
1883- { SocketError . NoData , PythonErrorNumber . ENODATA } ,
1884- { SocketError . NotConnected , PythonErrorNumber . ENOTCONN } ,
1885- { SocketError . NotInitialized , PythonErrorNumber . ENOTSUP } ,
1886- { SocketError . NotSocket , PythonErrorNumber . ENOTSOCK } ,
1887- { SocketError . OperationAborted , PythonErrorNumber . ECANCELED } ,
1888- { SocketError . OperationNotSupported , PythonErrorNumber . ENOTSUP } ,
1889- { SocketError . ProcessLimit , ! RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ? PythonErrorNumber . EPROCLIM : PythonErrorNumber . ENOTSUP } ,
1890- { SocketError . ProtocolFamilyNotSupported , PythonErrorNumber . EPFNOSUPPORT } ,
1891- { SocketError . ProtocolNotSupported , PythonErrorNumber . EPROTONOSUPPORT } ,
1892- { SocketError . ProtocolOption , PythonErrorNumber . ENOPROTOOPT } ,
1893- { SocketError . ProtocolType , PythonErrorNumber . EPROTOTYPE } ,
1894- { SocketError . Shutdown , PythonErrorNumber . EPIPE } ,
1895- { SocketError . SocketNotSupported , PythonErrorNumber . ESOCKTNOSUPPORT } ,
1896- { SocketError . Success , PythonErrorNumber . ENOERROR } ,
1897- { SocketError . SystemNotReady , PythonErrorNumber . ENOTSUP } , // or EAGAIN
1898- { SocketError . TimedOut , PythonErrorNumber . ETIMEDOUT } ,
1899- { SocketError . TooManyOpenSockets , PythonErrorNumber . ENFILE } , // could also have been EMFILE
1900- { SocketError . TryAgain , PythonErrorNumber . EAGAIN } , // not a perfect mapping, but better than nothing
1901- { SocketError . TypeNotFound , PythonErrorNumber . ENOTSOCK } ,
1902- { SocketError . VersionNotSupported , PythonErrorNumber . EPROTONOSUPPORT } ,
1903- { SocketError . WouldBlock , PythonErrorNumber . EWOULDBLOCK } , // on Linux/OSX, same as EAGAIN
1859+ { SocketError . AccessDenied , PythonErrno . EACCES } , // could also have been EPERM
1860+ { SocketError . AddressAlreadyInUse , PythonErrno . EADDRINUSE } ,
1861+ { SocketError . AddressNotAvailable , PythonErrno . EADDRNOTAVAIL } ,
1862+ { SocketError . AddressFamilyNotSupported , PythonErrno . EAFNOSUPPORT } ,
1863+ { SocketError . AlreadyInProgress , PythonErrno . EALREADY } ,
1864+ { SocketError . ConnectionAborted , PythonErrno . ECONNABORTED } ,
1865+ { SocketError . ConnectionRefused , PythonErrno . ECONNREFUSED } ,
1866+ { SocketError . ConnectionReset , PythonErrno . ECONNRESET } ,
1867+ { SocketError . DestinationAddressRequired , PythonErrno . EDESTADDRREQ } ,
1868+ { SocketError . Disconnecting , PythonErrno . ESHUTDOWN } ,
1869+ { SocketError . Fault , PythonErrno . EFAULT } ,
1870+ { SocketError . HostDown , PythonErrno . EHOSTDOWN } ,
1871+ { SocketError . HostNotFound , PythonErrno . ENOENT } ,
1872+ { SocketError . HostUnreachable , PythonErrno . EHOSTUNREACH } ,
1873+ { SocketError . InProgress , PythonErrno . EINPROGRESS } ,
1874+ { SocketError . Interrupted , PythonErrno . EINTR } ,
1875+ { SocketError . InvalidArgument , PythonErrno . EINVAL } ,
1876+ { SocketError . IOPending , PythonErrno . EINPROGRESS } ,
1877+ { SocketError . IsConnected , PythonErrno . EISCONN } ,
1878+ { SocketError . MessageSize , PythonErrno . EMSGSIZE } ,
1879+ { SocketError . NetworkDown , PythonErrno . ENETDOWN } ,
1880+ { SocketError . NetworkReset , PythonErrno . ENETRESET } ,
1881+ { SocketError . NetworkUnreachable , PythonErrno . ENETUNREACH } ,
1882+ { SocketError . NoBufferSpaceAvailable , PythonErrno . ENOBUFS } ,
1883+ { SocketError . NoData , PythonErrno . ENODATA } ,
1884+ { SocketError . NotConnected , PythonErrno . ENOTCONN } ,
1885+ { SocketError . NotInitialized , PythonErrno . ENOTSUP } ,
1886+ { SocketError . NotSocket , PythonErrno . ENOTSOCK } ,
1887+ { SocketError . OperationAborted , PythonErrno . ECANCELED } ,
1888+ { SocketError . OperationNotSupported , PythonErrno . ENOTSUP } ,
1889+ { SocketError . ProcessLimit , ! RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ? PythonErrno . EPROCLIM : PythonErrno . ENOTSUP } ,
1890+ { SocketError . ProtocolFamilyNotSupported , PythonErrno . EPFNOSUPPORT } ,
1891+ { SocketError . ProtocolNotSupported , PythonErrno . EPROTONOSUPPORT } ,
1892+ { SocketError . ProtocolOption , PythonErrno . ENOPROTOOPT } ,
1893+ { SocketError . ProtocolType , PythonErrno . EPROTOTYPE } ,
1894+ { SocketError . Shutdown , PythonErrno . EPIPE } ,
1895+ { SocketError . SocketNotSupported , PythonErrno . ESOCKTNOSUPPORT } ,
1896+ { SocketError . Success , PythonErrno . ENOERROR } ,
1897+ { SocketError . SystemNotReady , PythonErrno . ENOTSUP } , // or EAGAIN
1898+ { SocketError . TimedOut , PythonErrno . ETIMEDOUT } ,
1899+ { SocketError . TooManyOpenSockets , PythonErrno . ENFILE } , // could also have been EMFILE
1900+ { SocketError . TryAgain , PythonErrno . EAGAIN } , // not a perfect mapping, but better than nothing
1901+ { SocketError . TypeNotFound , PythonErrno . ENOTSOCK } ,
1902+ { SocketError . VersionNotSupported , PythonErrno . EPROTONOSUPPORT } ,
1903+ { SocketError . WouldBlock , PythonErrno . EWOULDBLOCK } , // on Linux/OSX, same as EAGAIN
19041904 } ;
19051905 if ( monoSocketErrorToNativeError . TryGetValue ( serror , out int errno ) ) {
19061906 return errno ;
19071907 } else {
1908- return PythonErrorNumber . EIO ;
1908+ return PythonErrno . EIO ;
19091909 }
19101910 }
19111911
0 commit comments