summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-104/+111
|\ | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
| * Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-104/+111
| | | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
* | Silence expression result unused warnings with clang.Christian Heimes2013-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The PyObject_INIT() macros returns obj: ../cpython/Objects/methodobject.c:32:23: warning: expression result unused [-Wunused-value] PyObject_INIT(op, &PyCFunction_Type); ^~ ../cpython/Include/objimpl.h:139:69: note: expanded from macro 'PyObject_INIT' ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) ^ 1 warning generated.
* | Issue #1772673: The type of `char*` arguments now changed to `const char*`.Serhiy Storchaka2013-10-191-8/+8
| |
* | Issue #19171: speed some cases of 3-argument long pow().Tim Peters2013-10-051-4/+10
|\ \ | |/ | | | | | | | | | | | | | | | | Reduce the base by the modulus when the base is larger than the modulus. This can unboundedly speed the "startup costs" of doing modular exponentiation, particularly in cases where the base is much larger than the modulus. Original patch by Armin Rigo, inspired by https://github.com/pyca/ed25519. Merged from 3.3.
| * Issue #19171: speed some cases of 3-argument long pow().Tim Peters2013-10-051-4/+10
| | | | | | | | | | | | | | | | Reduce the base by the modulus when the base is larger than the modulus. This can unboundedly speed the "startup costs" of doing modular exponentiation, particularly in cases where the base is much larger than the modulus. Original patch by Armin Rigo, inspired by https://github.com/pyca/ed25519.
* | Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-50/+50
|\ \ | |/ | | | | error messages and comments.
| * Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-50/+50
| | | | | | | | error messages and comments.
* | Issue #18722: Remove uses of the "register" keyword in C code.Antoine Pitrou2013-08-131-12/+12
| |
* | Issue #16741: Fix an error reporting in int().Serhiy Storchaka2013-08-031-28/+59
|\ \ | |/
| * Issue #16741: Fix an error reporting in int().Serhiy Storchaka2013-08-031-27/+62
| |
* | Minor consistency fixes for some longobject.c exception messages:Mark Dickinson2013-08-031-4/+4
| | | | | | | | | | | | - replace 'long int' / 'long' by 'int' - fix capitalization of "Python" in PyLong_AsUnsignedLong - "is too large" -> "too large", for consistency with other messages.
* | Issue #18520: Add a new PyStructSequence_InitType2() function, same thanVictor Stinner2013-07-221-2/+4
| | | | | | | | | | | | | | | | PyStructSequence_InitType() except that it has a return value (0 on success, -1 on error). * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure * Fix also some calls to PyDict_SetItemString(): handle error
* | longobject.c: add an assertion to ensure that MEDIUM_VALUE() is only called onVictor Stinner2013-07-171-1/+2
| | | | | | | | small integers (0 or 1 digit)
* | Issue #18408: Rewrite NEGATE() macro in longobject.c to handle ↵Victor Stinner2013-07-171-24/+51
| | | | | | | | PyLong_FromLong() failure
* | Reuse Py_MIN and Py_MAX macros: remove duplicate MIN/MAX macrosVictor Stinner2013-06-041-9/+4
| | | | | | | | multiprocessing.h: remove unused MIN and MAX macros
* | Close #17694: Add minimum length to _PyUnicodeWriterVictor Stinner2013-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Add also min_char attribute to _PyUnicodeWriter structure (currently unused) * _PyUnicodeWriter_Init() has no more argument (except the writer itself): min_length and overallocate must be set explicitly * In error handlers, only enable overallocation if the replacement string is longer than 1 character * CJK decoders don't use overallocation anymore * Set min_length, instead of preallocating memory using _PyUnicodeWriter_Prepare(), in many decoders * _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
* | 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), mpdecimal (needs to build without Python.h).
| * 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), mpdecimal (needs to build without Python.h).
| | * 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 #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 #16772: in int(x, base), non-integer bases must have an __index__ method.Mark Dickinson2013-01-271-5/+0
| | |
* | | Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-141-0/+18
| | | | | | | | | | | | when result of PyLong_AsLong() narrowed to int without checks.
* | | Issue #16761: Raise TypeError when int() called with base argument only.Serhiy Storchaka2012-12-281-3/+9
|\ \ \ | |/ /
| * | Issue #16761: Raise TypeError when int() called with base argument only.Serhiy Storchaka2012-12-281-2/+8
| |\ \ | | |/
| | * Issue #16761: Raise TypeError when int() called with base argument only.Serhiy Storchaka2012-12-281-2/+8
| | |
* | | use more specific typeBenjamin Peterson2012-12-261-1/+1
| | |
* | | Test for issue16772 and redoes the previous fix to accept __index__-awareGregory P. Smith2012-12-261-4/+3
| | | | | | | | | | | | objects as the base by using PyNumber_AsSsize_t similar to round().
* | | Fixes issue #16772: int() constructor second argument (base) must be an int.Gregory P. Smith2012-12-251-0/+5
| | | | | | | | | | | | Consistent with the behavior in Python 2.
* | | Issue 16280: Drop questionable special-casing of null pointer in ↵Mark Dickinson2012-10-181-6/+0
| | | | | | | | | | | | PyLong_FromVoidPtr.
* | | Issue #16277: merge fix from 3.3Mark Dickinson2012-10-181-0/+8
|\ \ \ | |/ /
| * | Issue #16277: merge fix from 3.2Mark Dickinson2012-10-181-0/+8
| |\ \ | | |/
| | * Issue #16277: in PyLong_FromVoidPtr, add missing branch for sizeof(void*) <= ↵Mark Dickinson2012-10-181-0/+8
| | | | | | | | | | | | sizeof(long).
* | | Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unifiedChristian Heimes2012-10-171-6/+2
| | | | | | | | | | | | endianess detection and handling.
* | | Issue #14783: Merge changes from 3.3.Chris Jerdonek2012-10-071-6/+13
|\ \ \ | |/ /
| * | Issue #14783: Merge changes from 3.2.Chris Jerdonek2012-10-071-6/+13
| |\ \ | | |/
| | * 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 #16096: port fix from 3.3Mark Dickinson2012-10-061-3/+2
|\ \ \ | |/ /
| * | Issue #16096: Fix signed overflow in Objects/longobject.c. Thanks Serhiy ↵Mark Dickinson2012-10-061-3/+2
| | | | | | | | | | | | Storchaka.
* | | long_to_decimal_string_internal() doesn't need to write the final NULL characterVictor Stinner2012-10-041-1/+0
|/ /
* | Issue 15959: Merge from 3.2.Mark Dickinson2012-09-201-1/+1
|\ \ | |/
| * 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
| * 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
* | Fixed resource leak to scratch when _PyUnicodeWriter_Prepare failsChristian Heimes2012-09-101-1/+3
| |
* | Issue #14744: Fix compilation on WindowsVictor Stinner2012-05-291-2/+2
| |
* | Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args ↵Victor Stinner2012-05-291-88/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and str.format(args) * Formatting string, int, float and complex use the _PyUnicodeWriter API. It avoids a temporary buffer in most cases. * Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just keep a reference to the string if the output is only composed of one string * Disable overallocation when formatting the last argument of str%args and str.format(args) * Overallocation allocates at least 100 characters: add min_length attribute to the _PyUnicodeWriter structure * Add new private functions: _PyUnicode_FastCopyCharacters(), _PyUnicode_FastFill() and _PyUnicode_FromASCII() The speed up is around 20% in average.
* | long_to_decimal_string() and _PyLong_Format() check the consistency of newlyVictor Stinner2012-04-251-0/+2
| | | | | | | | created strings using _PyUnicode_CheckConsistency() in debug mode
* | Issue #14630: Merge fix from 3.2.Mark Dickinson2012-04-201-3/+1
|\ \ | |/