public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
To: git-commits@fedoraproject.org
Subject: [rpms/python-astropy] rawhide: Handle 'divide by zero' difference on RISC-V
Date: Wed, 23 Sep 2026 21:56:19 GMT [thread overview]
Message-ID: <179020057996.1.6420042156102832822.rpms-python-astropy-9653c8c50998@fedoraproject.org> (raw)
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
reply other threads:[~2026-09-23 21:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179020057996.1.6420042156102832822.rpms-python-astropy-9653c8c50998@fedoraproject.org \
--to=marcin@juszkiewicz.com.pl \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox