Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-gmpy2 for openSUSE:Factory 
checked in at 2023-09-20 13:30:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-gmpy2 (Old)
 and      /work/SRC/openSUSE:Factory/.python-gmpy2.new.16627 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-gmpy2"

Wed Sep 20 13:30:19 2023 rev:6 rq:1112318 version:2.1.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-gmpy2/python-gmpy2.changes        
2023-06-11 19:58:40.616388700 +0200
+++ /work/SRC/openSUSE:Factory/.python-gmpy2.new.16627/python-gmpy2.changes     
2023-09-20 13:33:50.912659962 +0200
@@ -1,0 +2,6 @@
+Tue Sep 19 09:03:02 UTC 2023 - Markéta Machová <mmach...@suse.com>
+
+- Add upstream mpfr421.patch and gmpy2_cache.c.diff to fix build
+  with mpfr 4.2.1
+
+-------------------------------------------------------------------

New:
----
  gmpy2_cache.c.diff
  mpfr421.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-gmpy2.spec ++++++
--- /var/tmp/diff_new_pack.YUeF8o/_old  2023-09-20 13:33:51.832692923 +0200
+++ /var/tmp/diff_new_pack.YUeF8o/_new  2023-09-20 13:33:51.836693066 +0200
@@ -24,6 +24,10 @@
 License:        LGPL-3.0-only
 URL:            https://github.com/aleaxit/gmpy
 Source:         
https://files.pythonhosted.org/packages/source/g/gmpy2/gmpy2-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM https://github.com/aleaxit/gmpy/pull/422 Update MPFR to 
4.2.1 in build scripts & fix test failures on new version
+Patch:          mpfr421.patch
+# PATCH-FIX-UPSTREAM file included in 
https://github.com/aleaxit/gmpy/issues/418#issuecomment-1706721394
+Patch:          gmpy2_cache.c.diff
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -43,7 +47,7 @@
 rounded complex floating-point arithmetic) libraries.
 
 %prep
-%setup -q -n gmpy2-%{version}
+%autosetup -p1 -n gmpy2-%{version}
 
 %build
 export CFLAGS="%{optflags}"
@@ -64,5 +68,6 @@
 %files %{python_files}
 %doc README
 %license COPYING COPYING.LESSER
-%{python_sitearch}/*
+%{python_sitearch}/gmpy2
+%{python_sitearch}/gmpy2-%{version}*-info
 

++++++ gmpy2_cache.c.diff ++++++
--- gmpy2-2.1.5.orig/src/gmpy2_cache.c  2022-09-24 07:12:17.000000000 +0300
+++ gmpy2-2.1.5/src/gmpy2_cache.c       2023-09-05 17:15:05.035841008 +0300
@@ -537,19 +537,17 @@
 
     if (global.in_gmpympfrcache) {
         result = global.gmpympfrcache[--(global.in_gmpympfrcache)];
-        /* Py_INCREF does not set the debugging pointers, so need to use
-           _Py_NewReference instead. */
-        _Py_NewReference((PyObject*)result);
-        mpfr_set_prec(result->f, bits);
+        Py_INCREF((PyObject*)result);
     }
     else {
-        if (!(result = PyObject_New(MPFR_Object, &MPFR_Type))) {
+        result = PyObject_New(MPFR_Object, &MPFR_Type);
+        if (result == NULL) {
             /* LCOV_EXCL_START */
             return NULL;
             /* LCOV_EXCL_STOP */
         }
-        mpfr_init2(result->f, bits);
     }
+    mpfr_init2(result->f, bits);
     result->hash_cache = -1;
     result->rc = 0;
     return result;
@@ -704,7 +702,7 @@
 static MPC_Object *
 GMPy_MPC_New(mpfr_prec_t rprec, mpfr_prec_t iprec, CTXT_Object *context)
 {
-    MPC_Object *self;
+    MPC_Object *result;
 
     if (rprec < 2) {
         CHECK_CONTEXT(context);
@@ -722,29 +720,21 @@
         return NULL;
     }
     if (global.in_gmpympccache) {
-        self = global.gmpympccache[--(global.in_gmpympccache)];
-        /* Py_INCREF does not set the debugging pointers, so need to use
-           _Py_NewReference instead. */
-        _Py_NewReference((PyObject*)self);
-        if (rprec == iprec) {
-            mpc_set_prec(self->c, rprec);
-        }
-        else {
-            mpc_clear(self->c);
-            mpc_init3(self->c, rprec, iprec);
-        }
+        result = global.gmpympccache[--(global.in_gmpympccache)];
+        Py_INCREF((PyObject*)result);
     }
     else {
-        if (!(self = PyObject_New(MPC_Object, &MPC_Type))) {
+        result = PyObject_New(MPC_Object, &MPC_Type);
+        if (result == NULL) {
             /* LCOV_EXCL_START */
             return NULL;
             /* LCOV_EXCL_STOP */
         }
-        mpc_init3(self->c, rprec, iprec);
     }
-    self->hash_cache = -1;
-    self->rc = 0;
-    return self;
+    mpc_init3(result->c, rprec, iprec);
+    result->hash_cache = -1;
+    result->rc = 0;
+    return result;
 }
 
 static PyObject *

++++++ mpfr421.patch ++++++
>From 68a6b489c3d8d95b2658a1ed884fb99f4bd955c1 Mon Sep 17 00:00:00 2001
From: Sergey B Kirpichev <skirpic...@gmail.com>
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 <vinc...@vinc17.net>

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 &&

Reply via email to