Update to beta 3. Drop upstreamed -qdiv, -no-copy, and -test patches.
This commit is contained in:
parent
661f5e6335
commit
c5544cca71
@ -1,136 +0,0 @@
|
||||
Upstream commit 17f9d1585d93eaa68ae5438e6de42e694870e862.
|
||||
|
||||
Refactor PR 245 to eliminate need to create copies.
|
||||
|
||||
--- src/gmpy2_cmp.c.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ src/gmpy2_cmp.c 2019-06-27 13:29:52.972169535 -0600
|
||||
@@ -292,7 +292,7 @@ GMPy_MPANY_cmp_abs(PyObject *self, PyObj
|
||||
MPQ_Object *tempx = NULL;
|
||||
MPZ_Object *tempy = NULL;
|
||||
|
||||
- if (!(tempx = GMPy_MPQ_From_NumberAndCopy(arg0, context)) ||
|
||||
+ if (!(tempx = GMPy_MPQ_From_RationalAndCopy(arg0, context)) ||
|
||||
!(tempy = GMPy_MPZ_From_IntegerAndCopy(arg1, context))) {
|
||||
/* LCOV_EXCL_START */
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
@@ -315,7 +315,7 @@ GMPy_MPANY_cmp_abs(PyObject *self, PyObj
|
||||
MPQ_Object *tempy = NULL;
|
||||
|
||||
if (!(tempx = GMPy_MPZ_From_IntegerAndCopy(arg0, context)) ||
|
||||
- !(tempy = GMPy_MPQ_From_NumberAndCopy(arg1, context))) {
|
||||
+ !(tempy = GMPy_MPQ_From_RationalAndCopy(arg1, context))) {
|
||||
/* LCOV_EXCL_START */
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
Py_XDECREF((PyObject*)tempy);
|
||||
@@ -335,8 +335,8 @@ GMPy_MPANY_cmp_abs(PyObject *self, PyObj
|
||||
if (IS_RATIONAL(arg0) && IS_RATIONAL(arg1)) {
|
||||
MPQ_Object *tempx = NULL, *tempy = NULL;
|
||||
|
||||
- if (!(tempx = GMPy_MPQ_From_NumberAndCopy(arg0, context)) ||
|
||||
- !(tempy = GMPy_MPQ_From_NumberAndCopy(arg1, context))) {
|
||||
+ if (!(tempx = GMPy_MPQ_From_RationalAndCopy(arg0, context)) ||
|
||||
+ !(tempy = GMPy_MPQ_From_RationalAndCopy(arg1, context))) {
|
||||
/* LCOV_EXCL_START */
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
Py_XDECREF((PyObject*)tempy);
|
||||
@@ -385,7 +385,7 @@ GMPy_MPANY_cmp_abs(PyObject *self, PyObj
|
||||
MPQ_Object *tempy = NULL;
|
||||
|
||||
if (!(tempx = GMPy_MPFR_From_RealAndCopy(arg0, 1, context)) ||
|
||||
- !(tempy = GMPy_MPQ_From_NumberAndCopy(arg1, context))) {
|
||||
+ !(tempy = GMPy_MPQ_From_RationalAndCopy(arg1, context))) {
|
||||
/* LCOV_EXCL_START */
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
Py_XDECREF((PyObject*)tempy);
|
||||
@@ -453,7 +453,7 @@ GMPy_MPANY_cmp_abs(PyObject *self, PyObj
|
||||
MPQ_Object *tempx = NULL;
|
||||
MPFR_Object *tempy = NULL;
|
||||
|
||||
- if (!(tempx = GMPy_MPQ_From_NumberAndCopy(arg0, context)) ||
|
||||
+ if (!(tempx = GMPy_MPQ_From_RationalAndCopy(arg0, context)) ||
|
||||
!(tempy = GMPy_MPFR_From_RealAndCopy(arg1, 1, context))) {
|
||||
/* LCOV_EXCL_START */
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
--- src/gmpy2_convert_gmp.c.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ src/gmpy2_convert_gmp.c 2019-06-27 13:31:09.146904087 -0600
|
||||
@@ -1066,11 +1066,11 @@ GMPy_MPQ_From_Number(PyObject *obj, CTXT
|
||||
}
|
||||
|
||||
static MPQ_Object*
|
||||
-GMPy_MPQ_From_NumberAndCopy(PyObject *obj, CTXT_Object *context)
|
||||
+GMPy_MPQ_From_RationalAndCopy(PyObject *obj, CTXT_Object *context)
|
||||
{
|
||||
MPQ_Object *result = NULL, *temp = NULL;
|
||||
|
||||
- result = GMPy_MPQ_From_Number(obj, context);
|
||||
+ result = GMPy_MPQ_From_Rational(obj, context);
|
||||
|
||||
if (result == NULL)
|
||||
return result;
|
||||
--- src/gmpy2_convert_gmp.h.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ src/gmpy2_convert_gmp.h 2019-06-27 13:31:42.620348010 -0600
|
||||
@@ -91,7 +91,7 @@ static MPQ_Object * GMPy_MPQ_From_XMP
|
||||
|
||||
static MPQ_Object * GMPy_MPQ_From_Rational(PyObject* obj, CTXT_Object *context);
|
||||
static MPQ_Object * GMPy_MPQ_From_Number(PyObject* obj, CTXT_Object *context);
|
||||
-static MPQ_Object * GMPy_MPQ_From_NumberAndCopy(PyObject* obj, CTXT_Object *context);
|
||||
+static MPQ_Object * GMPy_MPQ_From_RationalAndCopy(PyObject* obj, CTXT_Object *context);
|
||||
|
||||
static PyObject * GMPy_PyIntOrLong_From_MPQ(MPQ_Object *obj, CTXT_Object *context);
|
||||
static PyObject * GMPy_PyStr_From_MPQ(MPQ_Object *obj, int base, int option, CTXT_Object *context);
|
||||
--- src/gmpy2_mpq_misc.c.orig 2019-06-27 13:24:31.597508383 -0600
|
||||
+++ src/gmpy2_mpq_misc.c 2019-06-27 13:34:41.438377394 -0600
|
||||
@@ -124,7 +124,7 @@ GMPy_MPQ_Function_Qdiv(PyObject *self, P
|
||||
{
|
||||
Py_ssize_t argc;
|
||||
PyObject *result = NULL, *x, *y;
|
||||
- MPQ_Object *tempx = NULL, *tempy = NULL;
|
||||
+ MPQ_Object *tempx = NULL, *tempy = NULL, *tempr = NULL;
|
||||
CTXT_Object *context = NULL;
|
||||
|
||||
CHECK_CONTEXT(context);
|
||||
@@ -176,7 +176,7 @@ GMPy_MPQ_Function_Qdiv(PyObject *self, P
|
||||
goto arg_error;
|
||||
}
|
||||
|
||||
- if (!(tempx = GMPy_MPQ_From_NumberAndCopy(x, context)) ||
|
||||
+ if (!(tempx = GMPy_MPQ_From_Rational(x, context)) ||
|
||||
!(tempy = GMPy_MPQ_From_Rational(y, context))) {
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
Py_XDECREF((PyObject*)tempy);
|
||||
@@ -190,20 +190,27 @@ GMPy_MPQ_Function_Qdiv(PyObject *self, P
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- /* tempx contains the result of the division. */
|
||||
+ /* tempr contains the result of the division. */
|
||||
|
||||
- mpq_div(tempx->q, tempx->q, tempy->q);
|
||||
- if (mpz_cmp_ui(mpq_denref(tempx->q), 1) == 0) {
|
||||
- if ((result = (PyObject*)GMPy_MPZ_New(context))) {
|
||||
- mpz_set(MPZ(result), mpq_numref(tempx->q));
|
||||
- }
|
||||
+ if (!(tempr = GMPy_MPQ_New(context))) {
|
||||
Py_DECREF((PyObject*)tempx);
|
||||
Py_DECREF((PyObject*)tempy);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ mpq_div(tempr->q, tempx->q, tempy->q);
|
||||
+ Py_DECREF((PyObject*)tempx);
|
||||
+ Py_DECREF((PyObject*)tempy);
|
||||
+
|
||||
+ if (mpz_cmp_ui(mpq_denref(tempr->q), 1) == 0) {
|
||||
+ if ((result = (PyObject*)GMPy_MPZ_New(context))) {
|
||||
+ mpz_set(MPZ(result), mpq_numref(tempr->q));
|
||||
+ }
|
||||
+ Py_DECREF((PyObject*)tempr);
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
- Py_DECREF((PyObject*)tempy);
|
||||
- return (PyObject*)tempx;
|
||||
+ return (PyObject*)tempr;
|
||||
};
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
Upstream commit ecd9ecbdf49a32fd988fe6ee9522b001706690d1.
|
||||
|
||||
Fix mutation in the first argument of qdiv().
|
||||
|
||||
Two tests were altered. Apparently, they were wrong:
|
||||
before lines "gmpy2.qdiv(10, q)" and "q.__round__(4)" - q was
|
||||
changed by previous calls to 2/5.
|
||||
|
||||
--- src/gmpy2_mpq_misc.c.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ src/gmpy2_mpq_misc.c 2019-06-27 13:24:31.597508383 -0600
|
||||
@@ -176,7 +176,7 @@ GMPy_MPQ_Function_Qdiv(PyObject *self, P
|
||||
goto arg_error;
|
||||
}
|
||||
|
||||
- if (!(tempx = GMPy_MPQ_From_Rational(x, context)) ||
|
||||
+ if (!(tempx = GMPy_MPQ_From_NumberAndCopy(x, context)) ||
|
||||
!(tempy = GMPy_MPQ_From_Rational(y, context))) {
|
||||
Py_XDECREF((PyObject*)tempx);
|
||||
Py_XDECREF((PyObject*)tempy);
|
||||
--- test/test_gmpy2_mpq_misc.txt.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ test/test_gmpy2_mpq_misc.txt 2019-06-27 13:25:14.862789636 -0600
|
||||
@@ -58,7 +58,7 @@ TypeError: qdiv() requires 1 or 2 intege
|
||||
>>> gmpy2.qdiv(q, 2)
|
||||
mpq(2,5)
|
||||
>>> gmpy2.qdiv(10, q)
|
||||
-mpz(25)
|
||||
+mpq(25,2)
|
||||
>>> gmpy2.qdiv(1)
|
||||
mpz(1)
|
||||
|
||||
@@ -78,7 +78,7 @@ Tests round
|
||||
>>> mpq('7/2').__round__()
|
||||
mpz(4)
|
||||
>>> q.__round__(4)
|
||||
-mpq(2,5)
|
||||
+mpq(4,5)
|
||||
>>> q.__round__(4, 2)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
--- test/test_mpq.txt.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ test/test_mpq.txt 2019-06-27 13:25:53.008155943 -0600
|
||||
@@ -452,6 +452,11 @@ mpz(2)
|
||||
mpq(9,4)
|
||||
>>> gmpy2.qdiv(gmpy2.mpq(3,4), gmpy2.mpq(1,4))
|
||||
mpz(3)
|
||||
+>>> args = gmpy2.mpq(2), 1/gmpy2.mpq(2)
|
||||
+>>> gmpy2.qdiv(*args)
|
||||
+mpz(4)
|
||||
+>>> args == (gmpy2.mpq(2), 1/gmpy2.mpq(2))
|
||||
+True
|
||||
|
||||
Test Number Protocol
|
||||
--------------------
|
@ -1,66 +0,0 @@
|
||||
Upstream commits 168854c21bab2b045e06314297d9d634e55e8054 and
|
||||
44629b6ee9e4632c7082584f63ed8cc7cea94713.
|
||||
|
||||
Change tests to resolve issues on 32-bit systems.
|
||||
|
||||
--- test/test_gmpy2_mpfr_misc.txt.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ test/test_gmpy2_mpfr_misc.txt 2019-06-27 13:38:07.177132895 -0600
|
||||
@@ -33,10 +33,10 @@ mpq(15432,125)
|
||||
|
||||
|
||||
>>> gmpy2.free_cache()
|
||||
->>> gmpy2.get_emin_min()
|
||||
--4611686018427387903
|
||||
->>> gmpy2.get_emax_max()
|
||||
-4611686018427387903
|
||||
+>>> gmpy2.get_emin_min() in (-4611686018427387903, -1073741823)
|
||||
+True
|
||||
+>>> gmpy2.get_emax_max() in (4611686018427387903, 1073741823)
|
||||
+True
|
||||
>>> mprec = gmpy2.get_max_precision()
|
||||
>>> gmpy2.get_exp(mpfr(5.232))
|
||||
3
|
||||
@@ -151,8 +151,6 @@ mpfr('4.5499999999999998')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
TypeError: check_range() argument types not supported
|
||||
->>> r.__sizeof__() # doctest: +SKIP_IN_DEBUG_MODE
|
||||
-72
|
||||
>>> 1
|
||||
1
|
||||
|
||||
--- test/test_gmpy2_mpq_misc.txt.orig 2019-06-27 13:25:14.862789636 -0600
|
||||
+++ test/test_gmpy2_mpq_misc.txt 2019-06-27 13:38:36.815676462 -0600
|
||||
@@ -91,11 +91,3 @@ Tests non zero operator
|
||||
False
|
||||
>>> not mpq('0/5')
|
||||
True
|
||||
-
|
||||
-Tests sizeof
|
||||
-------------
|
||||
-
|
||||
->>> q.__sizeof__() # doctest: +SKIP_IN_DEBUG_MODE
|
||||
-88
|
||||
->>> mpq(0/5).__sizeof__() # doctest: +SKIP_IN_DEBUG_MODE
|
||||
-88
|
||||
--- test/test_gmpy2_mpz_misc.txt.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ test/test_gmpy2_mpz_misc.txt 2019-06-27 13:39:00.651309394 -0600
|
||||
@@ -773,10 +773,3 @@ Test denominator
|
||||
----------------
|
||||
>>> a.denominator
|
||||
mpz(1)
|
||||
-
|
||||
-Test __sizeof__
|
||||
----------------
|
||||
->>> import sys
|
||||
->>> temp = sys.getsizeof(a)
|
||||
-
|
||||
-
|
||||
--- test/test_gmpy2_xmpz_misc.txt.orig 2019-05-15 22:45:22.000000000 -0600
|
||||
+++ test/test_gmpy2_xmpz_misc.txt 2019-06-27 13:40:09.202253711 -0600
|
||||
@@ -120,5 +120,3 @@ xmpz(10)
|
||||
xmpz(1)
|
||||
>>> x.real
|
||||
xmpz(10)
|
||||
->>> x.__sizeof__() # doctest: +SKIP_IN_DEBUG_MODE
|
||||
-40
|
@ -1,22 +1,14 @@
|
||||
%global srcname gmpy2
|
||||
%global prerelease b1
|
||||
%global prerelease b3
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 2.1.0
|
||||
Release: 0.10%{?prerelease:.%{prerelease}}%{?dist}
|
||||
Release: 0.11%{?prerelease:.%{prerelease}}%{?dist}
|
||||
Summary: Python interface to GMP, MPFR, and MPC
|
||||
|
||||
License: LGPLv3+
|
||||
URL: https://pypi.python.org/pypi/gmpy2
|
||||
Source0: https://github.com/aleaxit/gmpy/archive/%{srcname}-%{version}%{?prerelease}.tar.gz
|
||||
# Fix qdiv: https://github.com/aleaxit/gmpy/issues/242
|
||||
Patch0: %{name}-qdiv.patch
|
||||
# Eliminate copies; see
|
||||
# https://github.com/aleaxit/gmpy/commit/17f9d1585d93eaa68ae5438e6de42e694870e862
|
||||
Patch1: %{name}-no-copy.patch
|
||||
# Fix running tests on 32-bit systems; see
|
||||
# https://github.com/aleaxit/gmpy/issues/244
|
||||
Patch2: %{name}-test.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gmp-devel
|
||||
@ -54,7 +46,7 @@ Provides: python2-%{srcname} = %{version}-%{release}
|
||||
%{common_desc}
|
||||
|
||||
%prep
|
||||
%autosetup -p0 -n gmpy-%{srcname}-%{version}%{?prerelease}
|
||||
%autosetup -p0 -n %{srcname}-%{version}%{?prerelease}
|
||||
|
||||
# Fix file encodings. First the easy one.
|
||||
iconv -f ISO8859-1 -t UTF-8 src/gmpy2.c > src/gmpy2.c.utf8
|
||||
@ -69,6 +61,9 @@ rm src/mpz_pylong.c.orig
|
||||
# Update the sphinx theme name
|
||||
sed -i "s/'default'/'classic'/" docs/conf.py
|
||||
|
||||
# Version 2.1.0b3 still calls itself 2.1.0b1
|
||||
sed -i "s/b1/b3/" docs/conf.py
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
make -C docs html
|
||||
@ -85,6 +80,10 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} test/runtests.py
|
||||
%{python3_sitearch}/%{srcname}*
|
||||
|
||||
%changelog
|
||||
* Mon Sep 2 2019 Jerry James <loganjerry@gmail.com> - 2.1.0-0.11.b3
|
||||
- Update to beta 3
|
||||
- Drop upstreamed -qdiv, -no-copy, and -test patches
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-0.10.b1
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (gmpy2-2.1.0b1.tar.gz) = 532de3dff20819a8afa2588749eb89e5216c27bc98c296dcb722d62f81c7502add146e80170de2eee60b226bc1e0f84c353300a35711184edd12311345e0b43f
|
||||
SHA512 (gmpy2-2.1.0b3.tar.gz) = d5da539c314d49474e984da2aa73cf0c3c61f7667afe166a033c5296bfef6c903697787ba72c1005f994caddc2d5beacc76b49468095f996d805f16477bdb33e
|
||||
|
Loading…
Reference in New Issue
Block a user