summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) ↵Antoine Pitrou2013-02-091-2/+2
| | | | | | | | in the interpreter. I've left a couple of them in: zlib (third-party lib), getaddrinfo.c (doesn't include Python.h, and probably obsolete), _sre.c (legitimate use for the re.LOCALE flag).
* Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-0/+18
| | | | | | when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
* Issue #16761: Raise TypeError when int() called with base argument only.Serhiy Storchaka2012-12-281-2/+8
|
* Issue #16277: in PyLong_FromVoidPtr, add missing branch for sizeof(void*) <= ↵Mark Dickinson2012-10-181-0/+8
| | | | sizeof(long).
* Issue #14783: Improve int() docstring and also str(), range(), and slice().Chris Jerdonek2012-10-071-6/+13
| | | | | | This commit rewrites the docstring for int() to incorporate the documentation changes made in issue #16036. It also switches the docstrings for int(), str(), range(), and slice() to use multi-line signatures.
* Issue 15959: Fix type mismatch for quick{_neg}_int_allocs. Thanks Serhiy ↵Mark Dickinson2012-09-201-1/+1
| | | | Storchaka.
* Fix out of bounds read in long_new() for empty bytes with an explicit base. ↵Christian Heimes2012-09-121-2/+2
| | | | int(b'', somebase) calls PyLong_FromString() with char* of length 1 but the function accesses the first argument at offset 1. CID 715359
* Issue #14630: Fix an incorrect access of ob_digit[0] for a zero instance of ↵Mark Dickinson2012-04-201-3/+1
| | | | an int subclass.
* Issue #12963: PyLong_AsSize_t() now returns (size_t)-1 in all error cases.Stefan Krah2011-09-121-3/+3
|
* #11565: Merge with 3.1.Ezio Melotti2011-03-161-1/+1
|\
| * #11565: Fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-161-2/+2
| |
* | #11515: Merge with 3.1.Ezio Melotti2011-03-151-1/+1
|\ \ | |/
| * #11515: fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-151-1/+1
| |
| * Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou2010-05-091-3334/+3334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines 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. ........ ................
| * Issue #8328: Silence Visual Studio warnings.Stefan Krah2010-04-071-2/+2
| |
| * Merged revisions 78918,78920 via svnmerge fromMark Dickinson2010-04-061-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r78918 | mark.dickinson | 2010-03-13 11:34:40 +0000 (Sat, 13 Mar 2010) | 4 lines 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. ........ r78920 | mark.dickinson | 2010-03-13 13:23:05 +0000 (Sat, 13 Mar 2010) | 3 lines Issue #8014: Fix incorrect error checks in structmember.c, and re-enable previously failing test_structmember.py tests. ........
| * Merged revisions 74771 via svnmerge fromMark Dickinson2009-09-131-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74771 | mark.dickinson | 2009-09-13 13:06:08 +0100 (Sun, 13 Sep 2009) | 10 lines 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. ........ ................
| * Merged revisions 74691 via svnmerge fromMark Dickinson2009-09-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74691 | mark.dickinson | 2009-09-06 21:53:58 +0100 (Sun, 06 Sep 2009) | 9 lines 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 ........ ................
* | Fix indentation in Objects/longobject.cMark Dickinson2010-12-041-3/+3
| |
* | Issue #10557: Fixed error messages from float() and other numericAlexander Belopolsky2010-12-041-7/+24
| | | | | | | | | | | | types. Added a new API function, PyUnicode_TransformDecimalToASCII(), which transforms non-ASCII decimal digits in a Unicode string to their ASCII equivalents.
* | Include structseq.h in Python.h, and remove now-redundant includes in ↵Georg Brandl2010-11-301-1/+0
| | | | | | | | individual sources.
* | follow up to #9778: define and use an unsigned hash typeBenjamin Peterson2010-10-231-3/+3
| |
* | make hashes always the size of pointers; introduce Py_hash_t #9778Benjamin Peterson2010-10-171-2/+2
| |
* | Fix naming inconsistency.Mark Dickinson2010-06-071-2/+2
| |
* | Issue #2844: Make int('42', n) consistently raise ValueError forMark Dickinson2010-05-261-9/+20
| | | | | | | | invalid integers n (including n = -909).
* | Issue #8817: Expose round-to-nearest variant of divmod in _PyLong_Divmod_NearMark Dickinson2010-05-261-111/+140
| | | | | | | | for use by the datetime module; also refactor long_round to use this function.
* | Issue #8188: Introduce a new scheme for computing hashes of numbersMark Dickinson2010-05-231-10/+29
| | | | | | | | | | | | (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.
* | Merged revisions 81037 via svnmerge fromMark Dickinson2010-05-101-33/+39
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 81036 via svnmerge fromMark Dickinson2010-05-101-102/+101
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-3745/+3745
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 80961 via svnmerge fromMark Dickinson2010-05-081-5/+2
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 79885 via svnmerge fromStefan Krah2010-04-071-7/+7
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 79856 via svnmerge fromMark Dickinson2010-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 79843-79844 via svnmerge fromMark Dickinson2010-04-061-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ........
* | Remove out-of-date comment about making ints and longs hash equal.Mark Dickinson2010-03-191-3/+0
| |
* | Issue #8014: Fix PyLong_As<c-integer-type> methods not to produce anMark Dickinson2010-03-131-5/+20
| | | | | | | | | | internal error on non-integer input: they now raise TypeError instead. This is needed for attributes declared via PyMemberDefs.
* | Move docstrings for long.to_bytes and long.from_bytes after the ↵Mark Dickinson2010-01-301-27/+27
| | | | | | | | corresponding functions.
* | Merged revisions 77842 via svnmerge fromMark Dickinson2010-01-301-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | 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. ........
* | simplify string comparison of from_bytes/to_bytesBenjamin Peterson2010-01-091-20/+6
| |
* | Issue #1023290: Added API for the conversion of longs to bytes and vice-versa.Alexandre Vassalotti2010-01-091-0/+199
| |
* | Merged revisions 77234 via svnmerge fromMark Dickinson2010-01-021-221/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 77062 via svnmerge fromMark Dickinson2009-12-271-30/+250
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Keep PyLong_AsLongAndOverflow documentation and implementation in syncMark Dickinson2009-12-211-9/+10
| | | | | | | | | | between py3k and trunk; merge new tests from trunk to py3k. (See issue #7528.)
* | Fix error message, for consistency with messages for % and //, and for ↵Mark Dickinson2009-12-071-1/+1
| | | | | | | | consistency with trunk
* | Merge in the new GIL.Antoine Pitrou2009-11-101-4/+1
| |
* | Merged revisions 75697 via svnmerge fromMark Dickinson2009-10-251-66/+100
| | | | | | | | | | | | | | | | | | | | | | 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. ........
* | Merged revisions 75110 via svnmerge fromMark Dickinson2009-09-281-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). ........
* | Silence compiler warningMark Dickinson2009-09-241-1/+2
| |
* | Merged revisions 75003 via svnmerge fromMark Dickinson2009-09-211-2/+3
| | | | | | | | | | | | | | | | | | | | 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. ........
* | Issue #6713 (continued): remove unused arbitrary-base conversion codeMark Dickinson2009-09-181-99/+34
| | | | | | | | from _PyLong_Format.