diff options
author | Kjell Braden <afflux@pentabarf.de> | 2020-05-18 06:21:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 06:21:30 (GMT) |
commit | 442634c42fcaf31c636f693951a97734042c3e7b (patch) | |
tree | df3dc97f33eea99bf18898e037c363f0e8a04b06 /Modules/overlapped.c | |
parent | da742ba826721da84140abc785856d4ccc2d787f (diff) | |
download | cpython-442634c42fcaf31c636f693951a97734042c3e7b.zip cpython-442634c42fcaf31c636f693951a97734042c3e7b.tar.gz cpython-442634c42fcaf31c636f693951a97734042c3e7b.tar.bz2 |
bpo-39148: enable ipv6 for datagrams in Proactor (GH-19121)
Ifdef is not necessary, as AF_INET6 is supported from Windows Vista, and other code in overlapped.c uses AF_INET6 and is not ifdef'd.
Change the raised exception so users are not fooled to think it comes from Windows API.
Automerge-Triggered-By: @njsmith
Diffstat (limited to 'Modules/overlapped.c')
-rw-r--r-- | Modules/overlapped.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/overlapped.c b/Modules/overlapped.c index a16797c..df6282c 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -670,7 +670,6 @@ make_ipv4_addr(const struct sockaddr_in *addr) return PyUnicode_FromString(buf); } -#ifdef ENABLE_IPV6 /* Convert IPv6 sockaddr to a Python str. */ static PyObject * @@ -683,7 +682,6 @@ make_ipv6_addr(const struct sockaddr_in6 *addr) } return PyUnicode_FromString(buf); } -#endif static PyObject* unparse_address(LPSOCKADDR Address, DWORD Length) @@ -701,7 +699,6 @@ unparse_address(LPSOCKADDR Address, DWORD Length) } return ret; } -#ifdef ENABLE_IPV6 case AF_INET6: { const struct sockaddr_in6 *a = (const struct sockaddr_in6 *)Address; PyObject *addrobj = make_ipv6_addr(a); @@ -716,9 +713,9 @@ unparse_address(LPSOCKADDR Address, DWORD Length) } return ret; } -#endif /* ENABLE_IPV6 */ default: { - return SetFromWindowsErr(ERROR_INVALID_PARAMETER); + PyErr_SetString(PyExc_ValueError, "recvfrom returned unsupported address family"); + return NULL; } } } |