From 86f163148119b6c5cdfc12d7b6cc1b3f37483ae6 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Nov 13 2020 16:04:17 +0000 Subject: Add -python310 patch (bz 1897588). --- diff --git a/python-gmpy2-python310.patch b/python-gmpy2-python310.patch new file mode 100644 index 0000000..b56c6d0 --- /dev/null +++ b/python-gmpy2-python310.patch @@ -0,0 +1,36 @@ +diff --git a/src/gmpy2_convert_gmp.c b/src/gmpy2_convert_gmp.c +index 2550560..f4a2679 100644 +--- a/src/gmpy2_convert_gmp.c ++++ b/src/gmpy2_convert_gmp.c +@@ -222,10 +222,18 @@ GMPy_PyLong_From_MPZ(MPZ_Object *obj, CTXT_Object *context) + while ((size>0) && (result->ob_digit[size-1] == 0)) { + size--; + } ++#if PY_VERSION_HEX >= 0x030900A0 ++ Py_SET_SIZE(result, size); ++#else + Py_SIZE(result) = size; ++#endif + + if (negative) { ++#if PY_VERSION_HEX >= 0x030900A0 ++ Py_SET_SIZE(result, - Py_SIZE(result)); ++#else + Py_SIZE(result) = - Py_SIZE(result); ++#endif + } + return (PyObject*)result; + } +diff --git a/test/runtests.py b/test/runtests.py +index fb9f2b3..5e5842d 100644 +--- a/test/runtests.py ++++ b/test/runtests.py +@@ -75,7 +75,7 @@ print(" Caching Values: (Cache size) {0}".format(gmpy2.get_cache()[0])) + print(" Caching Values: (Size in limbs) {0}".format(gmpy2.get_cache()[1])) + print() + +-if sys.version.startswith('3.1'): ++if sys.version.startswith('3.1.'): + print("Due to differences in formatting of exceptions and Python 3.x, there") + print("will be test failures for exception handling when the tests are run") + print("with Python 3.1. The doctest module in Python 3.2 and later does not") diff --git a/python-gmpy2.spec b/python-gmpy2.spec index 7740b8f..20cf284 100644 --- a/python-gmpy2.spec +++ b/python-gmpy2.spec @@ -3,12 +3,15 @@ Name: python-%{srcname} Version: 2.1.0 -Release: 0.19%{?prerelease:.%{prerelease}}%{?dist} +Release: 0.20%{?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 build with python 3.10 +# https://github.com/aleaxit/gmpy/pull/283 +Patch0: %{name}-python310.patch BuildRequires: gcc BuildRequires: gmp-devel @@ -41,7 +44,7 @@ Provides: bundled(jquery) %{common_desc} %prep -%autosetup -n gmpy-%{srcname}-%{version}%{?prerelease} +%autosetup -n gmpy-%{srcname}-%{version}%{?prerelease} -p1 # Update the sphinx theme name sed -i "s/'default'/'classic'/" docs/conf.py @@ -77,6 +80,9 @@ cd - %{python3_sitearch}/%{srcname}* %changelog +* Fri Nov 13 2020 Jerry James - 2.1.0-0.20.b5 +- Add -python310 patch (bz 1897588) + * Fri Jul 31 2020 Jerry James - 2.1.0-0.19.b5 - Version 2.1.0 beta5 - Drop all patches