summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-31373: remove overly strict float range checks (#3486)Benjamin Peterson2017-09-111-2/+2
| | | | | This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 except for the pytime.c parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be rounded into finite floats. Tests were added to very this behavior.
* bpo-31373: fix undefined floating-point demotions (#3396)Benjamin Peterson2017-09-071-4/+6
|
* Update Argument Clinic generated code for bpo-29878. (#1001)Serhiy Storchaka2017-04-051-1/+1
|
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-10/+4
|
* bpo-29793: Convert some builtin types constructors to Argument Clinic. (#615)Serhiy Storchaka2017-03-191-17/+16
|
* bpo-20185: Convert float object implementation to Argument Clinic. (#543)Serhiy Storchaka2017-03-111-156/+213
| | | Based on patch by Vajrasky Kok.
* bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() ↵Serhiy Storchaka2017-03-061-8/+3
| | | | and tuple(). (#518)
* bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)Serhiy Storchaka2017-03-051-0/+6
| | | | int(), bool(), float(), list() and tuple(). Specify the value as a positional argument instead.
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-1/+1
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-3/+3
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-2/+2
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #26331: Implement the parsing part of PEP 515.Brett Cannon2016-09-091-23/+36
| | | | Thanks to Georg Brandl for the patch.
* Issue #11734: Add support for IEEE 754 half-precision floats to the struct ↵Mark Dickinson2016-09-031-1/+183
| | | | module. Original patch by Eli Stevens.
* Issue #26983: float() now always return an instance of exact float.Serhiy Storchaka2016-06-031-16/+30
| | | | | | The deprecation warning is emitted if __float__ returns an instance of a strict subclass of float. In a future versions of Python this can be an error.
* Issue #27005: Fixed the call of PyObject_CallFunctionObjArgs().Serhiy Storchaka2016-05-121-1/+1
|
* Issue #27005: Optimized the float.fromhex() class method for exact float.Serhiy Storchaka2016-05-121-6/+5
|
* Issue #26200: Restored more safe usages of Py_SETREF.Serhiy Storchaka2016-04-111-2/+2
|\
* \ Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-2/+2
|\ \ | |/
* | Clean up float.as_integer_ratio().Serhiy Storchaka2015-12-291-20/+16
| |
* | Issue #25971: Optimized creating Fractions from floats by 2 times and fromSerhiy Storchaka2015-12-291-6/+6
|/ | | | | | Decimals by 3 times. Unified error messages in float.as_integer_ratio(), Decimal.as_integer_ratio(), and Fraction constructors.
* Issue #24731: Fixed crash on converting objects with special methodsSerhiy Storchaka2015-11-251-1/+1
|\ | | | | | | | | __bytes__, __trunc__, and __float__ returning instances of subclasses of bytes, int, and float to subclasses of bytes, int, and float correspondingly.
| * Issue #24731: Fixed crash on converting objects with special methodsSerhiy Storchaka2015-11-251-1/+1
| | | | | | | | | | __bytes__, __trunc__, and __float__ returning instances of subclasses of bytes, int, and float to subclasses of bytes, int, and float correspondingly.
* | Issue #24802: Merge null termination fixes from 3.4 into 3.5Martin Panter2015-11-071-0/+15
|\ \ | |/
| * Issue #24802: Copy bytes-like objects to null-terminated buffers if necessaryMartin Panter2015-11-071-0/+15
| | | | | | | | | | | | | | | | This avoids possible buffer overreads when int(), float(), compile(), exec() and eval() are passed bytes-like objects. Similar code is removed from the complex() constructor, where it was not reachable. Patch by John Leitch, Serhiy Storchaka and Martin Panter.
* | Issue 19933: Provide default argument for ndigits in round. Patch by ↵Steve Dower2015-04-151-2/+3
| | | | | | | | Vajrasky Kok.
* | merge 3.4 (#23590)Benjamin Peterson2015-03-061-0/+1
|\ \ | |/
| * fix potential refleak in PyFloat_AsDouble (closes #23590)Benjamin Peterson2015-03-061-0/+1
| |
* | Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-1/+7
|\ \ | |/ | | | | and PyObject_AsWriteBuffer().
| * Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-1/+7
| | | | | | | | and PyObject_AsWriteBuffer().
* | Removed redundant casts to `char *`.Serhiy Storchaka2014-09-281-2/+2
|/ | | | Corresponding functions now accept `const char *` (issue #1772673).
* 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 #3158: doctest can now find doctests in functions and methodsZachary Ware2013-11-241-1/+1
| | | | | | | | written in C. As a part of this, a few doctests have been added to the builtins module (on hex(), oct(), and bin()), a doctest has been fixed (hopefully on all platforms) on float, and test_builtins now runs doctests in builtins.
* #17080: improve error message of float/complex when the wrong type is passed.Ezio Melotti2013-11-071-2/+3
|
* #19069: merge with 3.3.Ezio Melotti2013-10-051-11/+11
|\
| * #19069: use imperative mood in float object docstrings. Patch by Marco Buttu.Ezio Melotti2013-10-051-11/+11
| |
* | Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-4/+4
|\ \ | |/ | | | | error messages and comments.
| * Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-4/+4
| | | | | | | | error messages and comments.
* | Issue #18722: Remove uses of the "register" keyword in C code.Antoine Pitrou2013-08-131-2/+2
| |
* | Issue #18520: Add a new PyStructSequence_InitType2() function, same thanVictor Stinner2013-07-221-3/+6
| | | | | | | | | | | | | | | | 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
* | 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
* Fix a few typos and a double semicolon. Patch by Eitan Adler.Ezio Melotti2013-01-271-1/+1
|
* Issue #14785: Add sys._debugmallocstats() to help debug low-level memory ↵David Malcolm2012-06-221-0/+10
| | | | allocation issues
* Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args ↵Victor Stinner2012-05-291-7/+20
| | | | | | | | | | | | | | | | | 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.
* Issue #14435: Remove special block allocation code from floatobject.cKristján Valur Jónsson2012-03-301-131/+27
| | | | | | PyFloatObjects are now allocated using PyObject_MALLOC like all other internal types, but maintain a limited freelist of objects at hand for performance. This will result in more consistent memory usage by Python.
* Merge 3.2 -> default (issue 13889)Mark Dickinson2012-01-271-0/+5
|\
| * Issue #13889: Add missing _Py_SET_53BIT_PRECISION_* calls around uses of ↵Mark Dickinson2012-01-271-0/+5
| | | | | | | | dtoa.c functions in float round.
* | Issue #13088: Add shared Py_hexdigits constant to format a number into base 16Victor Stinner2011-10-141-1/+1
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-15/+4
| |