diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-10-15 01:57:58 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-10-15 01:57:58 (GMT) |
commit | 41d31967c6bcc7e730a0db77cfe1dc334c6d853e (patch) | |
tree | 52c27efa0546ca61a7bac9fd037a1aebac696487 /Lib/socket.py | |
parent | c597d5c318dc9af27d99a70074688578caf82890 (diff) | |
parent | 7184bac5446aefcf576bc8a0a666cfd096b86293 (diff) | |
download | cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.zip cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.tar.gz cpython-41d31967c6bcc7e730a0db77cfe1dc334c6d853e.tar.bz2 |
Issue20386: SocketType is again socket.socket; the IntEnum SOCK constants are SocketKind
Diffstat (limited to 'Lib/socket.py')
-rw-r--r-- | Lib/socket.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index ca3d21c..25631ef 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -35,11 +35,13 @@ SocketType -- type object for socket objects error -- exception raised for I/O errors has_ipv6 -- boolean value indicating if IPv6 is supported -Integer constants: +IntEnum constants: AF_INET, AF_UNIX -- socket domains (first argument to socket() call) SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) +Integer constants: + Many other constants may be defined; these may be used in calls to the setsockopt() and getsockopt() methods. """ @@ -71,10 +73,10 @@ AddressFamily = IntEnum('AddressFamily', if name.isupper() and name.startswith('AF_')}) globals().update(AddressFamily.__members__) -SocketType = IntEnum('SocketType', +SocketKind = IntEnum('SocketKind', {name: value for name, value in globals().items() if name.isupper() and name.startswith('SOCK_')}) -globals().update(SocketType.__members__) +globals().update(SocketKind.__members__) _LOCALHOST = '127.0.0.1' @@ -420,7 +422,7 @@ class socket(_socket.socket): def type(self): """Read-only access to the socket type. """ - return _intenum_converter(super().type, SocketType) + return _intenum_converter(super().type, SocketKind) if os.name == 'nt': def get_inheritable(self): @@ -727,6 +729,6 @@ def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): for res in _socket.getaddrinfo(host, port, family, type, proto, flags): af, socktype, proto, canonname, sa = res addrlist.append((_intenum_converter(af, AddressFamily), - _intenum_converter(socktype, SocketType), + _intenum_converter(socktype, SocketKind), proto, canonname, sa)) return addrlist |