Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: fixes for numpy regress tests
To:
Daniel Dickman <didickman@gmail.com>
Cc:
ports@openbsd.org
Date:
Sun, 9 Aug 2026 22:40:43 +0200

Download raw body.

Thread
On Sun, Aug 09, 2026 at 11:35:56AM -0400, Daniel Dickman wrote:
> While investigating some of the remaining numpy test failures I applied 
> these 2 changes locally which help slightly.
> 
> The first patch fixes failures where our lack of an strtold_l function 
> causes numpy to fallback to strtod which then causes a few regress tests 
> to fail. As a local fix I changed the fallback to strtold instead.
> 
> The second test seems to have to do with a test for an old glibc. However 
> the test doesn't seem to consider the fact that there are non-glibc 
> platforms as well.

The way I understand it, they only want to skip or xfail some tests for
older glibc, not for !glibc, so I think the logic is what they wanted.

> With this and the local catan/catanf fixes I have for libm I get down to 9 
> remaining failures on amd64.

I don't follow the reasoning (why do you say that AVX dispatch requires
glibc?) and I'm not convinced the _glibc_older_than part is correct,
but the diff does improve things on arm64 as well:

current:

= 99 failed, 46311 passed, 347 skipped, 3634 deselected, 32 xfailed, 2 xpassed, 76 warnings in 355.65s (0:05:55) =

with your diff below and the catan diff applied to libm:

= 87 failed, 46330 passed, 336 skipped, 3634 deselected, 36 xfailed, 2 xpassed, 75 warnings in 283.99s (0:04:43) =

> 
> ok?
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/math/py-numpy/Makefile,v
> diff -u -p -u -r1.105 Makefile
> --- Makefile	6 Jul 2026 10:40:11 -0000	1.105
> +++ Makefile	9 Aug 2026 15:30:18 -0000
> @@ -3,6 +3,7 @@ COMMENT=	fast array and numeric programm
>  MODPY_DISTV=	2.5.1
>  DISTNAME=	numpy-${MODPY_DISTV}
>  PKGNAME=	py-${DISTNAME}
> +REVISION=	0
>  
>  CATEGORIES=	math devel
>  
> Index: patches/patch-numpy__core_src_common_numpyos_c
> ===================================================================
> RCS file: patches/patch-numpy__core_src_common_numpyos_c
> diff -N patches/patch-numpy__core_src_common_numpyos_c
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-numpy__core_src_common_numpyos_c	9 Aug 2026 15:30:18 -0000
> @@ -0,0 +1,16 @@
> +use strtold as a fallback on platforms that don't have strtold_l.
> +
> +fixes a few numpy regress tests
> +
> +Index: numpy/_core/src/common/numpyos.c
> +--- numpy/_core/src/common/numpyos.c.orig
> ++++ numpy/_core/src/common/numpyos.c
> +@@ -601,7 +601,7 @@ NumPyOS_ascii_strtold(const char *s, char** endptr)
> +     }
> +     return result;
> + #else
> +-    return NumPyOS_ascii_strtod(s, endptr);
> ++    return strtold(s, endptr);
> + #endif
> + }
> + 
> Index: patches/patch-numpy_testing__private_utils_py
> ===================================================================
> RCS file: patches/patch-numpy_testing__private_utils_py
> diff -N patches/patch-numpy_testing__private_utils_py
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-numpy_testing__private_utils_py	9 Aug 2026 15:30:18 -0000
> @@ -0,0 +1,17 @@
> +Treat non-glibc platforms the same as old glibc. AVX dispatch
> +requires glibc.
> +
> +fixes failing numpy regress tests
> +
> +Index: numpy/testing/_private/utils.py
> +--- numpy/testing/_private/utils.py.orig
> ++++ numpy/testing/_private/utils.py
> +@@ -2804,7 +2804,7 @@ def _get_glibc_version():
> + 
> + 
> + _glibcver = _get_glibc_version()
> +-_glibc_older_than = lambda x: (_glibcver != '0.0' and _glibcver < x)
> ++_glibc_older_than = lambda x: (_glibcver == '0.0' or _glibcver < x)
> + 
> + 
> + def run_threaded(func, max_workers=8, pass_count=False,
>