summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
Commit message (Collapse)AuthorAgeFilesLines
* closes bpo-39415: Remove unused codes from longobject.c complexobject.c ↵Miss Islington (bot)2020-01-221-37/+0
| | | | | | | floatobject.c. (GH-18105) (cherry picked from commit 0d5eac8c327251f8edde5261cee43975d81311f6) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* [3.8] bpo-37206: Unrepresentable default values no longer represented as ↵Serhiy Storchaka2019-09-141-3/+3
| | | | | | | | | | None. (GH-13933) (GH-16141) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all. (cherry picked from commit 279f44678c8b84a183f9eeb85e0b086228154497) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895) ↵Paul Ganssle2019-09-121-1/+1
| | | | (GH-15961)
* bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)Serhiy Storchaka2019-06-011-0/+9
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-2/+2
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36957: Add _PyLong_Rshift() and _PyLong_Lshift(). (GH-13416)Serhiy Storchaka2019-05-191-2/+2
|
* bpo-36793: Remove unneeded __str__ definitions. (GH-13081)Serhiy Storchaka2019-05-061-1/+1
| | | | Classes that define __str__ the same as __repr__ can just inherit it from object.
* bpo-35713: Split _Py_InitializeCore into subfunctions (GH-11650)Victor Stinner2019-01-221-1/+2
| | | | | | | | | | | | | | * Split _Py_InitializeCore_impl() into subfunctions: add multiple pycore_init_xxx() functions * Preliminary sys.stderr is now set earlier to get an usable sys.stderr ealier. * Move code into _Py_Initialize_ReconfigureCore() to be able to call it from _Py_InitializeCore(). * Split _PyExc_Init(): create a new _PyBuiltins_AddExceptions() function. * Call _PyExc_Init() earlier in _Py_InitializeCore_impl() and new_interpreter() to get working exceptions earlier. * _Py_ReadyTypes() now returns _PyInitError rather than calling Py_FatalError(). * Misc code cleanup
* bpo-35059: PyObject_INIT() casts to PyObject* (GH-10674)Victor Stinner2018-11-231-1/+1
| | | | | | PyObject_INIT() and PyObject_INIT_VAR() now cast their first argument to PyObject*, as done in Python 3.7. Revert partially commit b4435e20a92af474f117b78b98ddc6f515363af5.
* bpo-35059: Convert PyObject_INIT() to function (GH-10077)Victor Stinner2018-10-261-1/+1
| | | | | * Convert PyObject_INIT() and PyObject_INIT_VAR() macros to static inline functions. * Fix usage of these functions: cast to PyObject* or PyVarObject*.
* Fix typo and edit for clarity in the docstrings of sys.float_info. (GH-2251)Stefano Taschini2018-03-261-3/+2
|
* bpo-31979: Simplify transforming decimals to ASCII (#4336)Serhiy Storchaka2017-11-131-4/+3
| | | | | in int(), float() and complex() parsers. This also speeds up parsing non-ASCII numbers by around 20%.
* 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.