From 872f541f1283eab346dabeef8c5d7ba54d5b87cc Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 3 Sep 2023 02:25:29 +0300 Subject: [PATCH 1/2] Update MPFR to 4.2.1 in build scripts --- scripts/before_ci_build.sh | 2 +- scripts/before_ci_build_apple_silicon.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/before_ci_build.sh b/scripts/before_ci_build.sh index 0cad6fe2..2fdb1138 100644 --- a/scripts/before_ci_build.sh +++ b/scripts/before_ci_build.sh @@ -1,7 +1,7 @@ set -e -x GMP_VERSION=6.2.1 -MPFR_VERSION=4.1.1 +MPFR_VERSION=4.2.1 MPC_VERSION=1.2.1 if [ ! -f finish_before_ci_build ]; then if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-musl" || "$OSTYPE" == "darwin"* ]]; then diff --git a/scripts/before_ci_build_apple_silicon.sh b/scripts/before_ci_build_apple_silicon.sh index 9ac29ae9..230dd28c 100644 --- a/scripts/before_ci_build_apple_silicon.sh +++ b/scripts/before_ci_build_apple_silicon.sh @@ -1,7 +1,7 @@ set -e -x GMP_VERSION=6.2.1 -MPFR_VERSION=4.1.1 +MPFR_VERSION=4.2.1 MPC_VERSION=1.2.1 export CPPFLAGS=" --target=arm64-apple-macos11" export LDFLAGS=" -arch arm64" From 68a6b489c3d8d95b2658a1ed884fb99f4bd955c1 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 3 Sep 2023 02:35:19 +0300 Subject: [PATCH 2/2] Exclude MPFR workaround for MPFR >= 4.2.1 Co-authored-by: Vincent Lefevre Closes #418 --- src/gmpy2_format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gmpy2_format.c b/src/gmpy2_format.c index 3e450c96..303bb7bf 100644 --- a/src/gmpy2_format.c +++ b/src/gmpy2_format.c @@ -592,12 +592,14 @@ GMPy_MPC_Format(PyObject *self, PyObject *args) if (mpcstyle) strcat(tempbuf, " "); else { +#if MPFR_VERSION < MPFR_VERSION_NUM(4,2,1) /* Need to insert + if imag is nan or +inf. */ if (mpfr_nan_p(mpc_imagref(MPC(self))) || (mpfr_inf_p(mpc_imagref(MPC(self))) && mpfr_sgn(mpc_imagref(MPC(self))) > 0)) { strcat(tempbuf, "+"); } +#endif } strcat(tempbuf, imagbuf); if (strlen(imagbuf) < 50 &&