[Python-modules-commits] [python-gmpy2] 01/02: Imported Upstream version 2.0.8

Martin Kelly aomighty-guest at moszumanska.debian.org
Tue Mar 7 05:38:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

aomighty-guest pushed a commit to branch master
in repository python-gmpy2.

commit 3869ba41b5e5db73c950a92f72bde53202146dfc
Author: Martin Kelly <martin at martingkelly.com>
Date:   Mon Mar 6 21:26:44 2017 -0800

    Imported Upstream version 2.0.8
---
 PKG-INFO                  | 46 +++++++++++++++++++++++-----------------------
 docs/mpfr.rst             |  2 +-
 docs/mpz.rst              |  5 ++---
 setup.py                  |  4 ++--
 src/gmpy2.c               | 13 +++++++++++--
 src/gmpy_convert.c        |  4 ++--
 src/gmpy_mpfr.c           |  8 ++++++--
 src/gmpy_mpz.c            | 12 ++++++------
 src/gmpy_mpz_divmod2exp.c |  8 +++++---
 test/test_misc.txt        |  2 +-
 test2/gmpy_test_cvr.py    |  2 +-
 test3/gmpy_test_cvr.py    |  2 +-
 12 files changed, 61 insertions(+), 47 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 61cf11d..c89e393 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,23 +1,23 @@
-Metadata-Version: 1.1
-Name: gmpy2
-Version: 2.0.7
-Summary: GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x
-Home-page: http://code.google.com/p/gmpy/
-Author: Case Van Horsen
-Author-email: casevh at gmail.com
-License: UNKNOWN
-Description: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: Science/ResearchLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
-Classifier: Natural Language :: English
-Classifier: Operating System :: MacOS :: MacOS X
-Classifier: Operating System :: Microsoft :: Windows
-Classifier: Operating System :: POSIX
-Classifier: Programming Language :: C
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Topic :: Scientific/Engineering :: Mathematics
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Metadata-Version: 1.1
+Name: gmpy2
+Version: 2.0.8
+Summary: GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x
+Home-page: http://code.google.com/p/gmpy/
+Author: Case Van Horsen
+Author-email: casevh at gmail.com
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Science/ResearchLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
+Classifier: Natural Language :: English
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: C
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Topic :: Scientific/Engineering :: Mathematics
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/docs/mpfr.rst b/docs/mpfr.rst
index d2dac48..c3b9b0e 100644
--- a/docs/mpfr.rst
+++ b/docs/mpfr.rst
@@ -113,7 +113,7 @@ Context Attributes
     result. If the value is ``Default``, then the value of real_prec is used.
 
 **round**
-    There are five rounding modes availble to *mpfr* types:
+    There are five rounding modes available to *mpfr* types:
 
     ``RoundAwayZero``
         The result is rounded away from 0.0.
diff --git a/docs/mpz.rst b/docs/mpz.rst
index 71310e5..5004098 100644
--- a/docs/mpz.rst
+++ b/docs/mpz.rst
@@ -204,8 +204,7 @@ mpz Functions
     numbers.
 
 **gcd(...)**
-    gcd(a, b) returns the greatest common denominator of integers *a* and
-    *b*.
+    gcd(a, b) returns the greatest common divisor of integers *a* and *b*.
 
 **gcdext(...)**
     gcdext(a, b) returns a 3-element tuple (*g*, *s*, *t*) such that
@@ -241,7 +240,7 @@ mpz Functions
 
 **is_prime(...)**
     is_prime(x[, n=25]) returns True if *x* is **probably** prime. False
-    is returned if *x* is definately composite. *x* is checked for small
+    is returned if *x* is definitely composite. *x* is checked for small
     divisors and up to *n* Miller-Rabin tests are performed. The actual tests
     performed may vary based on version of GMP or MPIR used.
 
diff --git a/setup.py b/setup.py
index da598a8..11ea90f 100644
--- a/setup.py
+++ b/setup.py
@@ -307,13 +307,13 @@ gmpy2_ext = Extension('gmpy2',
                       extra_link_args = my_extra_link_args)
 
 setup(name = "gmpy2",
-      version = "2.0.7",
+      version = "2.0.8",
       maintainer = "Case Van Horsen",
       maintainer_email = "casevh at gmail.com",
       url = "http://code.google.com/p/gmpy/",
       description = "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x",
       classifiers = [
-        'Development Status :: 4 - Beta',
+        'Development Status :: 5 - Production/Stable',
         'Intended Audience :: Developers',
         'Intended Audience :: Science/Research'
         'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
diff --git a/src/gmpy2.c b/src/gmpy2.c
index 06d300d..2334184 100644
--- a/src/gmpy2.c
+++ b/src/gmpy2.c
@@ -354,6 +354,15 @@
  *   2.0.7
  *   Fix math.floor(gmpy2.mpfr('inf')) to not segfault (casevh)
  *
+ *   2.0.8
+ *   Fix ref. counting bug in right-shift and left-shift (casevh)
+ *   Fix crash after error in converting string to mpfr and
+ *     subnormalization is active (casevh)
+ *   Corrected typos in documentation (casevh)
+ *   Fix int(mpfr) to match int(float) for negative values (casevh)
+ *   Fix data corruption bug in pack() when input list includes
+ *     mpz/data type (casevh)
+ *
  ************************************************************************
  *
  * Discussion on sizes of C integer types.
@@ -423,7 +432,7 @@
 
 /* The following global strings are used by gmpy_misc.c. */
 
-char gmpy_version[] = "2.0.7";
+char gmpy_version[] = "2.0.8";
 
 char _gmpy_cvs[] = "$Id: gmpy2.c 1043 2015-08-18 04:22:42Z casevh $";
 
@@ -872,7 +881,7 @@ _PyInitGMP(void)
 }
 
 static char _gmpy_docs[] =
-"gmpy2 2.0.7 - General Multiple-precision arithmetic for Python\n"
+"gmpy2 2.0.8 - General Multiple-precision arithmetic for Python\n"
 "\n"
 "gmpy2 supports several multiple-precision libraries. Integer and\n"
 "rational arithmetic is provided by either the GMP or MPIR libraries.\n"
diff --git a/src/gmpy_convert.c b/src/gmpy_convert.c
index 289394a..dc622e9 100644
--- a/src/gmpy_convert.c
+++ b/src/gmpy_convert.c
@@ -1843,7 +1843,7 @@ Pympfr_To_Pympz(PyObject *self)
             return NULL;
         }
         /* return code is ignored */
-        mpfr_get_z(result->z, Pympfr_AS_MPFR(self), context->ctx.mpfr_round);
+        mpfr_get_z(result->z, Pympfr_AS_MPFR(self), MPFR_RNDZ);
     }
 
     return result;
@@ -1866,7 +1866,7 @@ Pympfr_To_Pyxmpz(PyObject *self)
             return NULL;
         }
         /* return code is ignored */
-        mpfr_get_z(result->z, Pympfr_AS_MPFR(self), context->ctx.mpfr_round);
+        mpfr_get_z(result->z, Pympfr_AS_MPFR(self), MPFR_RNDZ);
     }
 
     return result;
diff --git a/src/gmpy_mpfr.c b/src/gmpy_mpfr.c
index dde223e..dddcb1e 100644
--- a/src/gmpy_mpfr.c
+++ b/src/gmpy_mpfr.c
@@ -109,14 +109,18 @@ Pygmpy_mpfr(PyObject *self, PyObject *args, PyObject *keywds)
                 result = Pympfr_From_PyStr(arg0, base, bits);
             }
         }
-        SUBNORMALIZE(result);
+        if (result) {
+            SUBNORMALIZE(result);
+        }
         return (PyObject*)result;
     }
 
     /* Optimize the common case */
     if (isReal(arg0) && argc == 1 && !keywds) {
         result = Pympfr_From_Real(arg0, bits);
-        SUBNORMALIZE(result);
+        if (result) {
+            SUBNORMALIZE(result);
+        }
         return (PyObject*)result;
     }
 
diff --git a/src/gmpy_mpz.c b/src/gmpy_mpz.c
index 2ebc097..78e64f9 100644
--- a/src/gmpy_mpz.c
+++ b/src/gmpy_mpz.c
@@ -1127,8 +1127,8 @@ Pympz_rshift(PyObject *self, PyObject *other)
 
   err:
     Py_DECREF((PyObject*)result);
-    Py_DECREF((PyObject*)tempa);
-    Py_DECREF((PyObject*)tempb);
+    Py_XDECREF((PyObject*)tempa);
+    Py_XDECREF((PyObject*)tempb);
     return NULL;
 }
 
@@ -1185,8 +1185,8 @@ Pympz_lshift(PyObject *self, PyObject *other)
 
   err:
     Py_DECREF((PyObject*)result);
-    Py_DECREF((PyObject*)tempa);
-    Py_DECREF((PyObject*)tempb);
+    Py_XDECREF((PyObject*)tempa);
+    Py_XDECREF((PyObject*)tempb);
     return NULL;
 }
 
@@ -1231,7 +1231,7 @@ Pympz_hash(PympzObject *self)
 /* Miscellaneous gmpy functions */
 PyDoc_STRVAR(doc_gcd,
 "gcd(a, b) -> mpz\n\n"
-"Return the greatest common denominator of integers a and b.");
+"Return the greatest common divisor of integers a and b.");
 
 static PyObject *
 Pygmpy_gcd(PyObject *self, PyObject *args)
@@ -1928,7 +1928,7 @@ Pympz_is_power(PyObject *self, PyObject *other)
 PyDoc_STRVAR(doc_is_primeg,
 "is_prime(x[, n=25]) -> bool\n\n"
 "Return True if x is _probably_ prime, else False if x is\n"
-"definately composite. x is checked for small divisors and up\n"
+"definitely composite. x is checked for small divisors and up\n"
 "to n Miller-Rabin tests are performed.");
 
 static PyObject *
diff --git a/src/gmpy_mpz_divmod2exp.c b/src/gmpy_mpz_divmod2exp.c
index 5913530..2155260 100644
--- a/src/gmpy_mpz_divmod2exp.c
+++ b/src/gmpy_mpz_divmod2exp.c
@@ -459,7 +459,7 @@ Pygmpy_pack(PyObject *self, PyObject *args)
 {
     Py_ssize_t nbits, total_bits, index, lst_count, i, temp_bits, limb_count, tempx_bits;
     PyObject *lst;
-    mpz_t temp;
+    mpz_t temp, temp1;
     PympzObject *result, *tempx = 0;
 
     if (PyTuple_GET_SIZE(args) != 2) {
@@ -494,6 +494,7 @@ Pygmpy_pack(PyObject *self, PyObject *args)
     mpz_setbit(result->z, total_bits + (mp_bits_per_limb * 2));
 
     mpz_inoc(temp);
+    mpz_inoc(temp1);
     mpz_set_ui(temp, 0);
     limb_count = 0;
     tempx_bits = 0;
@@ -508,8 +509,8 @@ Pygmpy_pack(PyObject *self, PyObject *args)
             Py_DECREF((PyObject*)result);
             return NULL;
         }
-        mpz_mul_2exp(tempx->z, tempx->z, tempx_bits);
-        mpz_add(temp, temp, tempx->z);
+        mpz_mul_2exp(temp1, tempx->z, tempx_bits);
+        mpz_add(temp, temp, temp1);
         tempx_bits += nbits;
         i = 0;
         temp_bits = mpz_sizeinbase(temp, 2) * mpz_sgn(temp);
@@ -533,6 +534,7 @@ Pygmpy_pack(PyObject *self, PyObject *args)
     result->z->_mp_d[limb_count] = mpz_getlimbn(temp, 0);
     mpz_clrbit(result->z, total_bits + (mp_bits_per_limb * 2));
     mpz_cloc(temp);
+    mpz_cloc(temp1);
     return (PyObject*)result;
 }
 
diff --git a/test/test_misc.txt b/test/test_misc.txt
index f8ea18e..4ce072f 100644
--- a/test/test_misc.txt
+++ b/test/test_misc.txt
@@ -3,7 +3,7 @@ Miscellaneous Functions
 
     >>> import gmpy2
     >>> gmpy2.version()
-    '2.0.7'
+    '2.0.8'
     >>> gmpy2.mp_limbsize() in (32,64)
     True
     >>> gmpy2.mp_version().split()[0] in ['GMP', 'MPIR']
diff --git a/test2/gmpy_test_cvr.py b/test2/gmpy_test_cvr.py
index db901f2..06942cb 100644
--- a/test2/gmpy_test_cvr.py
+++ b/test2/gmpy_test_cvr.py
@@ -2,7 +2,7 @@
 # relies on Tim Peters' "doctest.py" test-driver
 r'''
 >>> _g.version()
-'2.0.7'
+'2.0.8'
 >>> int('gmpy2.c' in _g._cvsid())
 1
 '''
diff --git a/test3/gmpy_test_cvr.py b/test3/gmpy_test_cvr.py
index 4c7a2bd..f9d31b6 100644
--- a/test3/gmpy_test_cvr.py
+++ b/test3/gmpy_test_cvr.py
@@ -2,7 +2,7 @@
 # relies on Tim Peters' "doctest.py" test-driver
 r'''
 >>> _g.version()
-'2.0.7'
+'2.0.8'
 >>> int('gmpy2.c' in _g._cvsid())
 1
 '''

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gmpy2.git



More information about the Python-modules-commits mailing list