mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user