Commit Graph

298 Commits

Author SHA1 Message Date
Mark Dickinson c9fb3c6417 Fix indentation in Objects/longobject.c 2010-12-04 11:06:25 +00:00
Alexander Belopolsky 942af5a9a4 Issue #10557: Fixed error messages from float() and other numeric
types.  Added a new API function, PyUnicode_TransformDecimalToASCII(),
which transforms non-ASCII decimal digits in a Unicode string to their
ASCII equivalents.
2010-12-04 03:38:46 +00:00
Georg Brandl 71c23d4473 Include structseq.h in Python.h, and remove now-redundant includes in individual sources. 2010-11-30 09:30:54 +00:00
Benjamin Peterson 8035bc5c04 follow up to #9778: define and use an unsigned hash type 2010-10-23 16:20:50 +00:00
Benjamin Peterson 8f67d0893f make hashes always the size of pointers; introduce Py_hash_t #9778 2010-10-17 20:54:53 +00:00
Mark Dickinson fa68a6188a Fix naming inconsistency. 2010-06-07 18:47:09 +00:00
Mark Dickinson f9a5a8e0af Issue #2844: Make int('42', n) consistently raise ValueError for
invalid integers n (including n = -909).
2010-05-26 20:07:58 +00:00
Mark Dickinson 7f1bf8004d Issue #8817: Expose round-to-nearest variant of divmod in _PyLong_Divmod_Near
for use by the datetime module; also refactor long_round to use this function.
2010-05-26 16:02:59 +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 cdd01d2ddb Merged revisions 81037 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81037 | mark.dickinson | 2010-05-09 21:42:09 +0100 (Sun, 09 May 2010) | 1 line

  Wrap multiline macros in a 'do {} while(0)', for safety.
........
2010-05-10 21:37:34 +00:00
Mark Dickinson 22b20183d5 Merged revisions 81036 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81036 | mark.dickinson | 2010-05-09 21:30:29 +0100 (Sun, 09 May 2010) | 1 line

  Post-detabification cleanup:  whitespace fixes and long line rewraps only.
........
2010-05-10 21:27:53 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson e97ecba241 Merged revisions 80961 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80961 | mark.dickinson | 2010-05-08 09:01:19 +0100 (Sat, 08 May 2010) | 2 lines

  Issue #8659: Remove redundant ABS calls.  Thanks Daniel Stutzbach.
........
2010-05-08 08:03:09 +00:00
Stefan Krah 0091e5ecd0 Merged revisions 79885 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79885 | stefan.krah | 2010-04-07 10:24:44 +0200 (Wed, 07 Apr 2010) | 1 line

  Issue #8328: Silence Visual Studio warnings.
........
2010-04-07 08:49:55 +00:00
Mark Dickinson 49a519c859 Merged revisions 79856 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79856 | mark.dickinson | 2010-04-06 19:58:54 +0100 (Tue, 06 Apr 2010) | 1 line

  Silence a 'comparison between signed and unsigned integer expressions' gcc warning.
........
2010-04-06 19:02:54 +00:00
Mark Dickinson 3318d29d22 Merged revisions 79843-79844 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79843 | mark.dickinson | 2010-04-06 17:46:09 +0100 (Tue, 06 Apr 2010) | 4 lines

  Issue #8259: Get rid of 'outrageous left shift count' error when
  left-shifting an integer by more than 2**31 on a 64-bit machine.  Also
  convert shift counts to a Py_ssize_t instead of a C long.
........
  r79844 | mark.dickinson | 2010-04-06 17:47:55 +0100 (Tue, 06 Apr 2010) | 1 line

  Misc/NEWS entry for r79843.
........
2010-04-06 16:53:17 +00:00
Mark Dickinson 431065247a Remove out-of-date comment about making ints and longs hash equal. 2010-03-19 12:38:03 +00:00
Mark Dickinson d59b41641e Issue #8014: Fix PyLong_As<c-integer-type> methods not to produce an
internal error on non-integer input: they now raise TypeError instead.
This is needed for attributes declared via PyMemberDefs.
2010-03-13 11:34:40 +00:00
Mark Dickinson 078c2532e0 Move docstrings for long.to_bytes and long.from_bytes after the corresponding functions. 2010-01-30 18:06:17 +00:00
Mark Dickinson 93f562c4f9 Merged revisions 77842 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77842 | mark.dickinson | 2010-01-30 10:08:33 +0000 (Sat, 30 Jan 2010) | 4 lines

  Issue #7767: Add new C-API function PyLong_AsLongLongAndOverflow, a
  long long variant of PyLong_AsLongAndOverflow.  Patch by Case Van
  Horsen.
........
2010-01-30 10:30:15 +00:00
Benjamin Peterson 0c0e229dd0 simplify string comparison of from_bytes/to_bytes 2010-01-09 21:50:11 +00:00
Alexandre Vassalotti c36c3789de Issue #1023290: Added API for the conversion of longs to bytes and vice-versa. 2010-01-09 20:35:09 +00:00
Mark Dickinson 6ecd9e53ce Merged revisions 77234 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77234 | mark.dickinson | 2010-01-02 14:45:40 +0000 (Sat, 02 Jan 2010) | 7 lines

  Refactor some longobject internals:  PyLong_AsDouble and _PyLong_AsScaledDouble
  (the latter renamed to _PyLong_Frexp) now use the same core code.  The
  exponent produced by _PyLong_Frexp now has type Py_ssize_t instead of the
  previously used int, and no longer needs scaling by PyLong_SHIFT.  This
  frees the math module from having to know anything about the PyLong
  implementation.  This closes issue #5576.
........
2010-01-02 15:33:56 +00:00
Mark Dickinson cbb62745ac Merged revisions 77062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77062 | mark.dickinson | 2009-12-27 14:55:57 +0000 (Sun, 27 Dec 2009) | 2 lines

  Issue #1811:  Improve accuracy and consistency of true division for integers.
........
2009-12-27 15:09:50 +00:00
Mark Dickinson 309aa2dcb4 Keep PyLong_AsLongAndOverflow documentation and implementation in sync
between py3k and trunk;  merge new tests from trunk to py3k.
(See issue #7528.)
2009-12-21 12:37:06 +00:00
Mark Dickinson 0b9293f28b Fix error message, for consistency with messages for % and //, and for consistency with trunk 2009-12-07 19:34:59 +00:00
Antoine Pitrou 074e5ed974 Merge in the new GIL. 2009-11-10 19:50:40 +00:00
Mark Dickinson 27a87a2aa2 Merged revisions 75697 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75697 | mark.dickinson | 2009-10-25 20:39:06 +0000 (Sun, 25 Oct 2009) | 3 lines

  Issue #1087418: Small performance boost for bitwise operations on longs.
  Initial patch by Gregory Smith;  some tweaks added.
........
2009-10-25 20:43:34 +00:00
Mark Dickinson 24f5785fea Merged revisions 75110 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75110 | mark.dickinson | 2009-09-28 17:52:40 +0100 (Mon, 28 Sep 2009) | 9 lines

  Style/consistency/nano-optimization nit:  replace occurrences of
    (high_bits << PyLong_SHIFT) + low_bits with
    (high_bits << PyLong_SHIFT) | low_bits
  in Objects/longobject.c.  Motivation:
   - shouldn't unnecessarily mix bit ops with arithmetic ops (style)
   - this pattern should be spelt the same way thoughout (consistency)
   - it's very very very slightly faster: no need to worry about
     carries to the high digit (nano-optimization).
........
2009-09-28 17:54:52 +00:00
Mark Dickinson 1f7e18cd74 Silence compiler warning 2009-09-24 18:31:17 +00:00
Mark Dickinson 741984dc17 Merged revisions 75003 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75003 | mark.dickinson | 2009-09-21 17:16:44 +0100 (Mon, 21 Sep 2009) | 1 line

  Silence MSVC compiler warnings.
........
2009-09-21 16:18:27 +00:00
Mark Dickinson cd06812971 Issue #6713 (continued): remove unused arbitrary-base conversion code
from _PyLong_Format.
2009-09-18 14:53:08 +00:00
Mark Dickinson 8accd6b38e Revert accidental changes to Objects/longobject.c 2009-09-17 19:39:12 +00:00
Mark Dickinson 2e72b0d603 Add some more module maintainers. 2009-09-17 19:37:28 +00:00
Mark Dickinson 2031d13172 Bypass long_repr and _PyLong_Format for str(n), repr(n) 2009-09-17 00:17:48 +00:00
Mark Dickinson 0a1efd0e4c Issue #6713: Improve performance of str(n) and repr(n) for integers n
(up to 3.1 times faster in tests), by special-casing base 10 in
_PyLong_Format.
2009-09-16 21:23:34 +00:00
Mark Dickinson 659c7b1bed Merged revisions 74769 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74769 | mark.dickinson | 2009-09-13 12:56:13 +0100 (Sun, 13 Sep 2009) | 3 lines

  Fix potential signed-overflow bug in _PyLong_Format;  also fix
  a couple of whitespace issues.
........
2009-09-13 12:06:08 +00:00
Mark Dickinson 7a49a8eb43 Merged revisions 74689 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74689 | mark.dickinson | 2009-09-06 21:51:37 +0100 (Sun, 06 Sep 2009) | 1 line

  Remove redundant assignment
........
2009-09-06 20:53:58 +00:00
Mark Dickinson 6bf1900e18 Merged revisions 72202 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72202 | mark.dickinson | 2009-05-02 18:55:01 +0100 (Sat, 02 May 2009) | 3 lines

  Remove unnecessary use of context for long getters.
  (Related to issue #5880).
........
2009-05-02 17:57:52 +00:00
Mark Dickinson 249b898ec7 Typo fix. Thanks Damien Diederen. 2009-04-27 19:41:00 +00:00
Mark Dickinson c630039edd Merged revisions 71772 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71772 | mark.dickinson | 2009-04-20 22:13:33 +0100 (Mon, 20 Apr 2009) | 5 lines

  Issue #3166: Make long -> float (and int -> float) conversions
  correctly rounded, using round-half-to-even.  This ensures that the
  value of float(n) doesn't depend on whether we're using 15-bit digits
  or 30-bit digits for Python longs.
........
2009-04-20 21:38:00 +00:00
Mark Dickinson 0bdab68475 Rewrap some long lines. 2009-04-02 18:41:40 +00:00
Mark Dickinson 17e4fddb57 Merged revisions 70542 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70542 | mark.dickinson | 2009-03-23 18:25:13 +0000 (Mon, 23 Mar 2009) | 14 lines

  Issue #5512: speed up the long division algorithm for Python longs.
  The basic algorithm remains the same; the most significant speedups
  come from the following three changes:

    (1) normalize by shifting instead of multiplying and dividing
    (2) the old algorithm usually did an unnecessary extra iteration of
        the outer loop; remove this.  As a special case, this means that
        long divisions with a single-digit result run twice as fast as
        before.
    (3) make inner loop much tighter.

  Various benchmarks show speedups of between 50% and 150% for long
  integer divisions and modulo operations.
........
2009-03-23 18:44:57 +00:00
Mark Dickinson bd7926478d Issue #4258: Make it possible to use 30-bit digits for PyLongs:
- new configure option --enable-big-digits
 - new structseq sys.int_info giving information about the internal format
By default, 30-bit digits are enabled on 64-bit machines but
disabled on 32-bit machines.
2009-03-18 20:06:12 +00:00
Mark Dickinson 134708ab14 Merged revisions 69974 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69974 | mark.dickinson | 2009-02-25 20:29:50 +0000 (Wed, 25 Feb 2009) | 3 lines

  Replace long with twodigits, to avoid depending
  on sizeof(digit) < sizeof(long)
........
2009-02-25 20:33:49 +00:00
Mark Dickinson 0d4785bc3b Fix more places in Objects/longobject.c where it's silently assumed that
sizeof(digit) < sizeof(int).
2009-02-15 17:27:41 +00:00
Mark Dickinson e441674a96 A few more type fixes for py3k that were missed in r69635 2009-02-15 15:14:57 +00:00
Mark Dickinson 5a74bf6354 Merged revisions 69634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69634 | mark.dickinson | 2009-02-15 10:13:41 +0000 (Sun, 15 Feb 2009) | 6 lines

  Issue #5260: Various portability and standards compliance fixes, optimizations
  and cleanups in Objects/longobject.c.  The most significant change is that
  longs now use less memory:  average savings are 2 bytes per long on 32-bit
  systems and 6 bytes per long on 64-bit systems.  (This memory saving already
  exists in py3k.)
........
2009-02-15 11:04:38 +00:00
Mark Dickinson 21776074cc Merged revisions 69498 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69498 | mark.dickinson | 2009-02-10 15:46:50 +0000 (Tue, 10 Feb 2009) | 6 lines

  Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
  negative arguments.  Previously, it raised TypeError.

  Thanks Lisandro Dalcin.
........
2009-02-10 16:13:25 +00:00
Mark Dickinson e94c679df0 Issue #1717: rename tp_compare to tp_reserved. I'll change the
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00