public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-astropy] rawhide: Handle 'divide by zero' difference on RISC-V
@ 2026-09-23 21:56 Marcin Juszkiewicz
0 siblings, 0 replies; only message in thread
From: Marcin Juszkiewicz @ 2026-09-23 21:56 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-astropy
Branch : rawhide
Commit : 9653c8c50998f49aaba79687386ec913bef2e32e
Author : Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Date : 2026-09-01T19:39:24+02:00
Stats : +41/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-astropy/c/9653c8c50998f49aaba79687386ec913bef2e32e?branch=rawhide
Log:
Handle 'divide by zero' difference on RISC-V
---
diff --git a/python-astropy.spec b/python-astropy.spec
index 1595331..b7f3bc9 100644
--- a/python-astropy.spec
+++ b/python-astropy.spec
@@ -18,6 +18,8 @@ Source: astropy-README.dist
Patch: restore-compilation-flags.patch
Patch: python-astropy-system-configobj.patch
Patch: fix-doctest.patch
+# Handle dividing by zero differences
+Patch: riscv-fix-test_freedman_bin_width.patch
BuildRequires: gcc
BuildRequires: expat-devel
diff --git a/riscv-fix-test_freedman_bin_width.patch b/riscv-fix-test_freedman_bin_width.patch
new file mode 100644
index 0000000..b7a0971
--- /dev/null
+++ b/riscv-fix-test_freedman_bin_width.patch
@@ -0,0 +1,39 @@
+From: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
+Date: Tue, 1 Sep 2026 12:00:00 +0200
+Subject: [PATCH] Fix test_freedman_bin_width on riscv64
+
+When IQR is zero, freedman_bin_width computes np.ceil((dmax-dmin)/0.0)
+which is np.ceil(inf). On x86_64 and aarch64 the native ceil
+instructions (roundsd / frintp) return inf without raising FPU
+exception flags, so numpy emits only "divide by zero encountered"
+from the preceding division.
+
+The base RISC-V floating-point ISA (without the Zfa extension) has no
+native ceil instruction. numpy falls back to fcvt float-to-integer
+conversion which sets the NV (invalid operation) flag when the input
+is infinity. This causes numpy to emit "invalid value encountered in
+ceil" instead of "divide by zero encountered".
+
+Accept both warning messages in the test.
+
+Assisted-by: Claude (Anthropic)
+
+Sent upstream: https://github.com/astropy/astropy/pull/20298
+
+---
+ astropy/stats/tests/test_histogram.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/astropy/stats/tests/test_histogram.py b/astropy/stats/tests/test_histogram.py
+index 1111111..2222222 100644
+--- a/astropy/stats/tests/test_histogram.py
++++ b/astropy/stats/tests/test_histogram.py
+@@ -48,7 +48,7 @@ def test_freedman_bin_width():
+ # data with too small IQR
+ test_x = [1, 2, 3] + [4] * 100 + [5, 6, 7]
+ with pytest.raises(ValueError, match=r"Please use another bin method"):
+- with pytest.warns(RuntimeWarning, match=r"divide by zero encountered"):
++ with pytest.warns(RuntimeWarning, match=r"divide by zero encountered|invalid value encountered in ceil"):
+ freedman_bin_width(test_x, return_bins=True)
+
+ # data with small IQR but not too small
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-23 21:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 21:56 [rpms/python-astropy] rawhide: Handle 'divide by zero' difference on RISC-V Marcin Juszkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox