From 19d802e2bb7efa27a28867b0c753e29535e9e515 Mon Sep 17 00:00:00 2001 From: Enrique Saurez Date: Wed, 15 Jul 2026 18:09:25 -0700 Subject: [PATCH] [nanvix] Enable SDK inet_pton and inet_ntop Use the current Nanvix SDK libc implementations, enable CPython socket address conversion APIs, and remove the obsolete local inet_ntop fallback for the former stub. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 23312a7e-62f5-477a-a83f-65fd99522fe3 --- Makefile.nanvix | 2 +- Modules/socketmodule.c | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/Makefile.nanvix b/Makefile.nanvix index 84bac275f706cf..c7ff516dccb9fa 100644 --- a/Makefile.nanvix +++ b/Makefile.nanvix @@ -109,7 +109,7 @@ CONFIGURE_OPTS = \ ac_cv_func_getsockname=yes \ ac_cv_func_inet_aton=no \ ac_cv_func_inet_ntoa=yes \ - ac_cv_func_inet_pton=no \ + ac_cv_func_inet_pton=yes \ ac_cv_func_statvfs=no \ ac_cv_func_fstatvfs=no \ ac_cv_func_fdopendir=no diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 712e071528032c..e81e7eb604d202 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -485,24 +485,6 @@ _Py_nanvix_inet_addr(const char *cp) } #define inet_addr(cp) _Py_nanvix_inet_addr(cp) -/* Nanvix libc's inet_ntop() is a stub that always returns ENOSYS. - Provide a simple replacement for AF_INET. */ -static const char * -_Py_nanvix_inet_ntop(int af, const void *src, char *dst, socklen_t size) -{ - if (af == AF_INET) { - const unsigned char *b = (const unsigned char *)src; - int n = snprintf(dst, size, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); - if (n < 0 || (socklen_t)n >= size) { - errno = ENOSPC; - return NULL; - } - return dst; - } - errno = EAFNOSUPPORT; - return NULL; -} -#define inet_ntop(af, src, dst, size) _Py_nanvix_inet_ntop(af, src, dst, size) #endif /* __nanvix__ */ #ifdef MS_WINDOWS