move socket.error classes from _socket to socket (#12746)

They're implemented in C, but consider themselves to live in
socket.
This commit is contained in:
Stephen Morton
2024-10-05 18:19:34 -07:00
committed by GitHub
parent 8cb6df0201
commit f30d367c7a
2 changed files with 18 additions and 18 deletions

View File

@@ -109,8 +109,6 @@ from _socket import (
_RetAddress as _RetAddress,
close as close,
dup as dup,
error as error,
gaierror as gaierror,
getdefaulttimeout as getdefaulttimeout,
gethostbyaddr as gethostbyaddr,
gethostbyname as gethostbyname,
@@ -121,7 +119,6 @@ from _socket import (
getservbyname as getservbyname,
getservbyport as getservbyport,
has_ipv6 as has_ipv6,
herror as herror,
htonl as htonl,
htons as htons,
if_indextoname as if_indextoname,
@@ -134,7 +131,6 @@ from _socket import (
ntohl as ntohl,
ntohs as ntohs,
setdefaulttimeout as setdefaulttimeout,
timeout as timeout,
)
from _typeshed import ReadableBuffer, Unused, WriteableBuffer
from collections.abc import Iterable
@@ -486,6 +482,18 @@ EBADF: int
EAGAIN: int
EWOULDBLOCK: int
# These errors are implemented in _socket at runtime
# but they consider themselves to live in socket so we'll put them here.
error = OSError
class herror(error): ...
class gaierror(error): ...
if sys.version_info >= (3, 10):
timeout = TimeoutError
else:
class timeout(error): ...
class AddressFamily(IntEnum):
AF_INET = 2
AF_INET6 = 10