From 450da6901f1ab9ae02dc7b171d95172d97e97775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kul=C3=ADk?= Date: Tue, 11 Aug 2026 08:12:07 +0200 Subject: [PATCH 1/2] add IPv6 support to socket.gethostbyaddr on Solaris --- Modules/socketmodule.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 61505c2603f22c..0b7ee151d9c1b4 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -6404,6 +6404,20 @@ _socket_gethostbyaddr(PyObject *module, PyObject *hobj) PyErr_SetString(PyExc_OSError, "unsupported address family"); goto finally; } +#if defined(__sun) && defined(ENABLE_IPV6) + /* Solaris gethostbyaddr supports AF_INET only; use platform + specific and AF_INET6 capable getipnodebyaddr instead. */ + if (af == AF_INET6) { + Py_BEGIN_ALLOW_THREADS + h = getipnodebyaddr(ap, al, af, &h_error); + Py_END_ALLOW_THREADS + ret = gethost_common(state, h, SAS2SA(&addr), sizeof(addr), af, h_error); + if (h != NULL) { + freehostent(h); + } + goto finally; + } +#endif Py_BEGIN_ALLOW_THREADS #ifdef HAVE_GETHOSTBYNAME_R #if defined(HAVE_GETHOSTBYNAME_R_6_ARG) From 051dc4793f8c097b9679dec543ffd054c4826bc0 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:20:37 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2026-09-14-15-20-29.gh-issue-157497.xnwAxk.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-09-14-15-20-29.gh-issue-157497.xnwAxk.rst diff --git a/Misc/NEWS.d/next/Library/2026-09-14-15-20-29.gh-issue-157497.xnwAxk.rst b/Misc/NEWS.d/next/Library/2026-09-14-15-20-29.gh-issue-157497.xnwAxk.rst new file mode 100644 index 00000000000000..6d2fd28d747653 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-09-14-15-20-29.gh-issue-157497.xnwAxk.rst @@ -0,0 +1 @@ +:func:`socket.gethostbyaddr` now works with IPv6 addresses on Solaris.