Commit Graph

174 Commits

Author SHA1 Message Date
Victor Stinner 7fa767e517 Issue #20976: pyflakes: Remove unused imports 2014-03-20 09:16:38 +01:00
Stefan Krah daa96b7669 Merge from 3.3. 2013-11-24 19:56:23 +01:00
Stefan Krah 45059eb1d0 1) Prepare libmpdec for the 2.4.0 release. None of the following changes affects
_decimal:

      o Make all "mpd_t to C integer" conversion functions available in both the
        64-bit and the 32-bit versions.

      o Make all mixed mpd_t/C integer arithmetic functions available in the
        32-bit version.

      o Better handling of __STDC_LIMIT_MACROS for C++ users.

      o Add struct tags (at the request of C++ users).

2) Check for libmpdec.so.2 if --with-system-libmpdec is used.
2013-11-24 19:44:57 +01:00
Senthil Kumaran f367962d86 merge from 3.3
Fix the dead link of IEEE_854-1987 standard with the Wikipedia entry.
Addresses issue #18438
2013-09-07 23:20:06 -07:00
Senthil Kumaran 4fec47e5ed Fix the dead link of IEEE_854-1987 standard with the Wikipedia entry.
Addresses issue #18438
2013-09-07 23:19:29 -07:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Stefan Krah 6edda14b29 Issue #17768: Support newline fill character in decimal.py and NUL fill
character in _decimal.c.
2013-05-29 15:45:38 +02:00
Stefan Krah 8d90e383a3 Merge 3.3. 2013-05-29 15:47:24 +02:00
Stefan Krah 8031d0dfd4 Merge 3.3. 2012-12-15 22:36:49 +01:00
Stefan Krah 040e311826 Issue #15783: Except for the number methods, the C version of decimal now
supports all None default values present in decimal.py. These values were
largely undocumented.
2012-12-15 22:33:33 +01:00
Mark Dickinson 9c3f5031a9 Issue #13701: Fix decorator avoidance (due to desire for Python 2.3 compatibility) in decimal module. 2012-10-31 17:53:27 +00:00
Mark Dickinson fc33d4ce0a Issue #15544: Fix Decimal.__float__ to work with payload-carrying NaNs. 2012-08-24 18:53:10 +01:00
Stefan Krah b6405efd1b Use the same exception hierarchy as decimal.py. FloatOperation now also
inherits from TypeError. Cleanup in module initialization to make repeated
import failures robust.
2012-03-23 14:46:48 +01:00
Stefan Krah 1919b7e72b Issue #7652: Integrate the decimal floating point libmpdec library to speed
up the decimal module. Performance gains of the new C implementation are
between 12x and 80x, depending on the application.
2012-03-21 18:25:23 +01:00
Mark Dickinson 39411f60a2 Issue #13248, issue #8540: Remove deprecated Context._clamp attribute from Decimal module. 2011-10-24 10:31:52 +01:00
Mark Dickinson 7ce0fa8775 Issue #12080: Fix a performance issue in Decimal._power_exact that causes some corner-case Decimal.__pow__ calls to take an unreasonably long time. 2011-06-04 18:14:23 +01:00
Mark Dickinson b455e58b95 Issue #12079: Decimal(0).fma(Decimal('inf'), 'not a number') should give a TypeError, not a Decimal.InvalidOperation 2011-05-22 12:53:18 +01:00
Alexander Belopolsky 1a20c121ef Issue #11830: Remove unnecessary introspection code in the decimal module.
Forward ported changesets b4b1f557d563 and f4adc2926bf5 by Raymond
Hettinger in branch '2.7'.
2011-04-12 23:03:39 -04:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Mark Dickinson a7f0dffb8d Merge #11131 2011-03-12 11:17:26 +00:00
Mark Dickinson 37a79fb75b Issue 11131: Fix sign of zero result on decimal.Decimal plus and minus operations in ROUND_FLOOR rounding mode. 2011-03-12 11:12:52 +00:00
Raymond Hettinger 6d7e26e959 Get command-line doctest of Lib/decimal.py to work again.
If tested as '__main__' instead 'decimal', the tracebacks would
abbreviate 'decimal.Inexact' as 'Inexact', breaking the doctests.

(Reviewed by Antoine.)
2011-02-01 23:54:43 +00:00
Raymond Hettinger 697ce95931 Add link to specification. 2010-11-30 20:32:59 +00:00
Raymond Hettinger db213a297d Replace _nbits() with int.bit_length(). 2010-11-27 08:09:40 +00:00
Eric Smith 984bb58000 Issue #7094: Add alternate ('#') flag to __format__ methods for float, complex and Decimal. Allows greater control over when decimal points appear. Added to make transitioning from %-formatting easier. '#g' still has a problem with Decimal which I'll fix soon. 2010-11-25 16:08:06 +00:00
Raymond Hettinger d325c4b233 Revert r86517 2010-11-21 04:08:28 +00:00
Stefan Krah d8b661dd90 Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of TypeError. 2010-11-18 15:20:34 +00:00
Stefan Krah dc817b229c Issue #10356: Decimal(-1).__hash__() should equal hash(Decimal(-1)). 2010-11-17 11:16:34 +00:00
Mark Dickinson 921d30d261 Merged revisions 82654 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82654 | mark.dickinson | 2010-07-08 22:15:36 +0100 (Thu, 08 Jul 2010) | 3 lines

  Issue #9136: Profiling Decimal gave 'dictionary changed size during iteration'.
  Remove the use of locals() that caused this error.
........
2010-07-08 21:18:21 +00:00
Mark Dickinson 0dd8f7890a Issue #9136: Profiling Decimal gave 'dictionary changed size during iteration'.
Remove the use of locals() that caused this error.
2010-07-08 21:15:36 +00:00
Mark Dickinson 0390f504ac Merged revisions 82646,82649-82650 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82646 | mark.dickinson | 2010-07-08 18:23:40 +0100 (Thu, 08 Jul 2010) | 1 line

  In test_decimal, convert heuristic for skipping tests into an explicit skiplist.
........
  r82649 | mark.dickinson | 2010-07-08 20:03:34 +0100 (Thu, 08 Jul 2010) | 1 line

  Fix a performance issue in Decimal.pow.  Thanks Stefan Krah for finding this.
........
  r82650 | mark.dickinson | 2010-07-08 20:09:16 +0100 (Thu, 08 Jul 2010) | 1 line

  Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__.
........
2010-07-08 19:21:59 +00:00
Mark Dickinson e42f1bb354 Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__. 2010-07-08 19:09:16 +00:00
Mark Dickinson a123631a5c Fix a performance issue in Decimal.pow. Thanks Stefan Krah for finding this. 2010-07-08 19:03:34 +00:00
Mark Dickinson aa63c4d6f2 Fix mild type confusion in decimal module docstring. 2010-06-12 16:37:53 +00:00
Mark Dickinson 1c164a6f85 Fix typo in docstring. 2010-06-11 16:49:20 +00:00
Mark Dickinson 08ade6faa0 Issue #8188: Comparisons between Decimal objects and other numeric
objects (Fraction, float, complex, int) now all function as expected.
2010-06-11 10:44:52 +00:00
Mark Dickinson dc787d2055 Issue #8188: Introduce a new scheme for computing hashes of numbers
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
2010-05-23 13:33:13 +00:00
Mark Dickinson b1d8e3229c #Issue 8540: Make Context._clamp attribute public in decimal module. 2010-05-22 18:35:36 +00:00
Stefan Krah 395653e059 Merged revisions 81352 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81352 | stefan.krah | 2010-05-19 17:52:31 +0200 (Wed, 19 May 2010) | 9 lines

  Merged revisions 81350 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81350 | stefan.krah | 2010-05-19 17:46:39 +0200 (Wed, 19 May 2010) | 1 line

    Fix typos in docstrings.
  ........
................
2010-05-19 15:54:54 +00:00
Stefan Krah 2eb4a07f9b Merged revisions 81350 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81350 | stefan.krah | 2010-05-19 17:46:39 +0200 (Wed, 19 May 2010) | 1 line

  Fix typos in docstrings.
........
2010-05-19 15:52:31 +00:00
Mark Dickinson ece0697f32 Merged revisions 80755 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r80755 | mark.dickinson | 2010-05-04 15:35:33 +0100 (Tue, 04 May 2010) | 17 lines

  Merged revisions 80753 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r80753 | mark.dickinson | 2010-05-04 15:25:50 +0100 (Tue, 04 May 2010) | 10 lines

    Issue #8567: Fix incorrect precedence of signals in Decimal module.

    When a Decimal operation raises multiple signals and more than one of
    those signals is trapped, the specification determines the order in
    which the signals should be handled.  In many cases this order wasn't
    being followed, leading to the wrong Python exception being raised.
    This commit fixes those cases, and adds extra tests.  The tests are
    only enabled when EXTENDEDERRORTESTS is True, since they involve
    rerunning each Decimal testcase several times.
  ........
................
2010-05-04 14:37:14 +00:00
Mark Dickinson c69160e808 Merged revisions 80753 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80753 | mark.dickinson | 2010-05-04 15:25:50 +0100 (Tue, 04 May 2010) | 10 lines

  Issue #8567: Fix incorrect precedence of signals in Decimal module.

  When a Decimal operation raises multiple signals and more than one of
  those signals is trapped, the specification determines the order in
  which the signals should be handled.  In many cases this order wasn't
  being followed, leading to the wrong Python exception being raised.
  This commit fixes those cases, and adds extra tests.  The tests are
  only enabled when EXTENDEDERRORTESTS is True, since they involve
  rerunning each Decimal testcase several times.
........
2010-05-04 14:35:33 +00:00
Mark Dickinson ac256ab284 Merged revisions 79583,79588-79589 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79583 | mark.dickinson | 2010-04-02 09:53:22 +0100 (Fri, 02 Apr 2010) | 7 lines

  Issue #2531: Make float-to-decimal comparisons return correct results.

  Float to decimal comparison operations now return a result based on
  the numeric values of the operands.  Decimal.__hash__ has also been
  fixed so that Decimal and float values that compare equal have equal
  hash value.
........
  r79588 | mark.dickinson | 2010-04-02 11:17:07 +0100 (Fri, 02 Apr 2010) | 2 lines

  Issue #7279:  Make comparisons involving a Decimal sNaN signal InvalidOperation.
........
  r79589 | mark.dickinson | 2010-04-02 11:35:12 +0100 (Fri, 02 Apr 2010) | 6 lines

  Issue #7279:  Make Decimal('nan') hashable.  Decimal('snan') remains unhashable.

  Also rewrite the Decimal __hash__ method so that it doesn't rely on
  float('inf') being valid: float('inf') could raise an exception on
  platforms not using IEEE 754 arithmetic.
........
2010-04-03 11:08:14 +00:00
Raymond Hettinger 9679859890 Issue 8257: Decimal constructor to accept float argument. 2010-04-02 16:58:27 +00:00
Mark Dickinson 84230a1eb2 Merged revisions 78217-78218 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78217 | mark.dickinson | 2010-02-18 14:27:02 +0000 (Thu, 18 Feb 2010) | 5 lines

  Issue #7633: Context method in the decimal module (with the exception
  of the 'canonical' and 'is_canonical' methods) now consistently accept
  integer arguments wherever a Decimal instance is accepted.  Thanks
  Juan José Conti for the patch.
........
  r78218 | mark.dickinson | 2010-02-18 14:45:33 +0000 (Thu, 18 Feb 2010) | 1 line

  Doctest fixes for decimal.py:  add an integer-argument doctest for logical_invert;  don't use integer literals with a leading zero.
........
2010-02-18 14:49:50 +00:00
Benjamin Peterson d69fe2a8d3 Merged revisions 77712,77740-77741,77756,77886,77902,77936 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77712 | tarek.ziade | 2010-01-23 11:52:57 -0600 (Sat, 23 Jan 2010) | 1 line

  fixed the 64bits tests for get_platform() - mac osx
........
  r77740 | benjamin.peterson | 2010-01-24 21:58:21 -0600 (Sun, 24 Jan 2010) | 1 line

  compare types with is not ==
........
  r77741 | facundo.batista | 2010-01-25 00:15:01 -0600 (Mon, 25 Jan 2010) | 3 lines

  Added a note about Event.is_set() syntax being new to 2.6
........
  r77756 | tarek.ziade | 2010-01-26 11:20:37 -0600 (Tue, 26 Jan 2010) | 1 line

  fixed bdist_msi imports and added a test module for distutils.command.bdist_msi
........
  r77886 | benjamin.peterson | 2010-01-31 12:09:34 -0600 (Sun, 31 Jan 2010) | 1 line

  move distutils.rst to different toc
........
  r77902 | andrew.kuchling | 2010-01-31 20:04:26 -0600 (Sun, 31 Jan 2010) | 1 line

  Add various items
........
  r77936 | andrew.kuchling | 2010-02-02 20:19:14 -0600 (Tue, 02 Feb 2010) | 1 line

  Add various items
........
2010-02-03 02:59:43 +00:00
Benjamin Peterson 23b9ef7205 Merged revisions 77937 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r77937 | benjamin.peterson | 2010-02-02 20:35:45 -0600 (Tue, 02 Feb 2010) | 75 lines

  Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines

    Update PyEval_EvalFrame to PyEval_EvalFrameEx.  This looks to have been done
    partially before.  Also add a comment describing how this might have to work
    with different versions of the interpreter.
  ........
    r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line

    Fixed typo
  ........
    r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line

    #7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
  ........
    r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line

    Add note about usage of STRINGLIB_EMPTY.
  ........
    r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line

    Fix internal reference.
  ........
    r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines

    data descriptors do not override the class dictionary if __get__ is not defined

    Adjust documentation and add a test to verify this behavior.

    See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
    discussion.
  ........
    r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines

    Do not compile stubs for the sha2 series hashes in the openssl hashlib
    module when the openssl version is too old to support them.  That
    leads both compiled code bloat and to unittests attempting to test
    implementations that don't exist for comparison purposes on such
    platforms.
  ........
    r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line

    Add two more test_strtod test values.
  ........
    r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line

    #7762: fix refcount annotation of PyUnicode_Tailmatch().
  ........
    r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line

    #7725: fix referencing issue.
  ........
    r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line

    mention from_float() in error message
  ........
    r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line

    #7802: fix invalid example (heh).
  ........
    r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines

    Fix-up ftplib documentation:
    move exception descriptions to toplevel, not inside a class
    remove attribution in "versionadded"
    spell and grammar check docstring of FTP_TLS
  ........
    r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line

    Minor modification to unittest documentation.
  ........
................
2010-02-03 02:43:37 +00:00
Benjamin Peterson 5e55b3e204 Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines

  Update PyEval_EvalFrame to PyEval_EvalFrameEx.  This looks to have been done
  partially before.  Also add a comment describing how this might have to work
  with different versions of the interpreter.
........
  r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line

  Fixed typo
........
  r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line

  #7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
  r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line

  Add note about usage of STRINGLIB_EMPTY.
........
  r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line

  Fix internal reference.
........
  r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines

  data descriptors do not override the class dictionary if __get__ is not defined

  Adjust documentation and add a test to verify this behavior.

  See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
  discussion.
........
  r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines

  Do not compile stubs for the sha2 series hashes in the openssl hashlib
  module when the openssl version is too old to support them.  That
  leads both compiled code bloat and to unittests attempting to test
  implementations that don't exist for comparison purposes on such
  platforms.
........
  r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line

  Add two more test_strtod test values.
........
  r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line

  #7762: fix refcount annotation of PyUnicode_Tailmatch().
........
  r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line

  #7725: fix referencing issue.
........
  r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line

  mention from_float() in error message
........
  r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line

  #7802: fix invalid example (heh).
........
  r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines

  Fix-up ftplib documentation:
  move exception descriptions to toplevel, not inside a class
  remove attribution in "versionadded"
  spell and grammar check docstring of FTP_TLS
........
  r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line

  Minor modification to unittest documentation.
........
2010-02-03 02:35:45 +00:00