summaryrefslogtreecommitdiff
path: root/dev-python/mpmath
diff options
context:
space:
mode:
authorLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2025-06-09 07:00:06 +0000
committerLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2025-06-09 07:00:06 +0000
commitd040dfeee4aeee655599ab9091f1fb756b21c23d (patch)
tree9d41a24bcf6a18d726ce739193e861d42a92e1a5 /dev-python/mpmath
parent653793351c5886fac93c93c99705943c0c46b857 (diff)
downloadbaldeagleos-repo-d040dfeee4aeee655599ab9091f1fb756b21c23d.tar.gz
baldeagleos-repo-d040dfeee4aeee655599ab9091f1fb756b21c23d.tar.xz
baldeagleos-repo-d040dfeee4aeee655599ab9091f1fb756b21c23d.zip
Adding metadata
Diffstat (limited to 'dev-python/mpmath')
-rw-r--r--dev-python/mpmath/files/mpmath-1.4.0_alpha5-valueerror.patch50
-rw-r--r--dev-python/mpmath/mpmath-1.4.0_alpha5-r1.ebuild64
2 files changed, 114 insertions, 0 deletions
diff --git a/dev-python/mpmath/files/mpmath-1.4.0_alpha5-valueerror.patch b/dev-python/mpmath/files/mpmath-1.4.0_alpha5-valueerror.patch
new file mode 100644
index 000000000000..fc3ebefb7680
--- /dev/null
+++ b/dev-python/mpmath/files/mpmath-1.4.0_alpha5-valueerror.patch
@@ -0,0 +1,50 @@
+From 9ad6a13925922711ca004686194daf8f110feaea Mon Sep 17 00:00:00 2001
+From: Sergey B Kirpichev <skirpichev@gmail.com>
+Date: Mon, 9 Jun 2025 05:07:00 +0300
+Subject: [PATCH] Fix from_man_exp to correctly reject non-integral mantissa
+
+This partially reverts 25506567
+---
+ mpmath/ctx_mp_python.py | 2 +-
+ mpmath/libmp/libmpf.py | 7 +++++--
+ mpmath/tests/test_basic_ops.py | 5 +++++
+ 3 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/mpmath/ctx_mp_python.py b/mpmath/ctx_mp_python.py
+index d9e9f64f..72b81278 100644
+--- a/mpmath/ctx_mp_python.py
++++ b/mpmath/ctx_mp_python.py
+@@ -64,7 +64,7 @@ def __new__(cls, val=fzero, **kwargs):
+ if len(val) == 4:
+ val = val[0], MPZ(val[1]), *val[2:]
+ elif len(val) == 2:
+- v._mpf_ = from_man_exp(MPZ(val[0]), val[1], prec, rounding)
++ v._mpf_ = from_man_exp(val[0], val[1], prec, rounding)
+ return v
+ else:
+ raise ValueError
+diff --git a/mpmath/libmp/libmpf.py b/mpmath/libmp/libmpf.py
+index af61879e..266ee394 100644
+--- a/mpmath/libmp/libmpf.py
++++ b/mpmath/libmp/libmpf.py
+@@ -8,7 +8,7 @@
+ import sys
+ import warnings
+
+-from .backend import BACKEND, MPZ, MPZ_FIVE, MPZ_ONE, MPZ_ZERO, gmpy
++from .backend import BACKEND, MPZ, MPZ_FIVE, MPZ_ONE, MPZ_ZERO, gmpy, int_types
+ from .libintmath import (bctable, bin_to_radix, isqrt, numeral, sqrtrem,
+ stddigits, trailtable)
+
+@@ -204,7 +204,10 @@ def normalize(sign, man, exp, bc, prec, rnd):
+ def from_man_exp(man, exp, prec=0, rnd=round_fast):
+ """Create raw mpf from (man, exp) pair. The mantissa may be signed.
+ If no precision is specified, the mantissa is stored exactly."""
+- man = MPZ(man)
++ if isinstance(man, int_types):
++ man = MPZ(man)
++ else:
++ raise TypeError("man expected to be an integer")
+ sign = 0
+ if man < 0:
+ sign = 1
diff --git a/dev-python/mpmath/mpmath-1.4.0_alpha5-r1.ebuild b/dev-python/mpmath/mpmath-1.4.0_alpha5-r1.ebuild
new file mode 100644
index 000000000000..55c1384489af
--- /dev/null
+++ b/dev-python/mpmath/mpmath-1.4.0_alpha5-r1.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9,10,11,12,13} pypy3 )
+
+inherit distutils-r1 optfeature pypi
+
+DESCRIPTION="Python library for arbitrary-precision floating-point arithmetic"
+HOMEPAGE="
+ https://mpmath.org/
+ https://github.com/mpmath/mpmath/
+ https://pypi.org/project/mpmath/
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="test-full"
+
+BDEPEND="
+ dev-python/setuptools-scm[${PYTHON_USEDEP}]
+ test? (
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/packaging[${PYTHON_USEDEP}]
+ dev-python/pexpect[${PYTHON_USEDEP}]
+ dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]
+ dev-python/pytest-timeout[${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/gmpy2[${PYTHON_USEDEP}]
+ ' 'python3*')
+ test-full? (
+ dev-python/matplotlib[${PYTHON_USEDEP}]
+ )
+ )
+"
+
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+PATCHES=(
+ # https://github.com/aleaxit/gmpy/pull/566
+ # https://github.com/mpmath/mpmath/pull/969/commits/9ad6a13925922711ca004686194daf8f110feaea
+ "${FILESDIR}/${P}-valueerror.patch"
+)
+
+python_test() {
+ local EPYTEST_DESELECT=()
+
+ # CLI crashes otherwise, sigh (not a regression)
+ # https://github.com/mpmath/mpmath/issues/907
+ > "${HOME}/.python_history" || die
+
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ epytest -p rerunfailures --reruns=5 -p timeout
+}
+
+pkg_postinst() {
+ optfeature "gmp support" dev-python/gmpy2
+ optfeature "matplotlib support" dev-python/matplotlib
+}