summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-111765: Move old PyFloat_* tests to ↵Miss Islington (bot)2023-11-071-65/+0
| | | | | | | Lib/test/test_capi/test_float.py (GH-111766) (GH-111818) (cherry picked from commit a077b2fbb88f5192bb47e514334f760bf08d0295) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.12] gh-109546: Add more tests for formatting floats and fractions ↵Miss Islington (bot)2023-10-021-2/+7
| | | | | | | | (GH-109548) (#109557) gh-109546: Add more tests for formatting floats and fractions (GH-109548) (cherry picked from commit beb5ec5817b645562ebbdd59f25683a93061c32c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)Sebastian Berg2023-05-101-4/+1
| | | | | | | | | | This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of using the standard `NAN` and `INFINITY` macros provided by C99. This change has the side-effect of fixing a bug on MIPS where the hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN rather than a quiet NaN. --------- Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* gh-95605: Fix `float(s)` error message when `s` contains only whitespace ↵Mark Dickinson2022-08-101-0/+4
| | | | | (GH-95665) This PR fixes the error message from float(s) in the case where s contains only whitespace.
* GH-94808: Cover handling non-finite numbers from round when ndigits is ↵Michael Droettboom2022-07-141-0/+5
| | | | provided (GH-94860)
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-131-1/+0
|
* bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)John Belmonte2022-04-111-12/+10
| | | | | | | | Add "z" format specifier to coerce negative 0 to zero. See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion. This covers `str.format()` and f-strings. Old-style string interpolation is not supported. Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-46906: Add PyFloat_Pack8() to the C API (GH-31657)Victor Stinner2022-03-111-1/+73
| | | | | | | | | | | | | | | | | | | | | | Add new functions to pack and unpack C double (serialize and deserialize): * PyFloat_Pack2(), PyFloat_Pack4(), PyFloat_Pack8() * PyFloat_Unpack2(), PyFloat_Unpack4(), PyFloat_Unpack8() Document these functions and add unit tests. Rename private functions and move them from the internal C API to the public C API: * _PyFloat_Pack2() => PyFloat_Pack2() * _PyFloat_Pack4() => PyFloat_Pack4() * _PyFloat_Pack8() => PyFloat_Pack8() * _PyFloat_Unpack2() => PyFloat_Unpack2() * _PyFloat_Unpack4() => PyFloat_Unpack4() * _PyFloat_Unpack8() => PyFloat_Unpack8() Replace the "unsigned char*" type with "char*" which is more common and easy to use.
* bpo-46852: Restore test_getformat() test (GH-31601)Victor Stinner2022-02-271-3/+11
|
* bpo-46852: Remove the float.__set_format__() method (GH-31585)Victor Stinner2022-02-251-70/+0
| | | | | | Remove the undocumented private float.__set_format__() method, previously known as float.__set_format__() in Python 3.7. Its docstring said: "You probably don't want to use this function. It exists mainly to be used in Python's test suite."
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-011-1/+2
|
* bpo-43413: Fix handling keyword arguments in subclasses of some buitin ↵Serhiy Storchaka2021-09-121-0/+27
| | | | | | | | classes (GH-26456) * Constructors of subclasses of some buitin classes (e.g. tuple, list, frozenset) no longer accept arbitrary keyword arguments. * Subclass of set can now define a __new__() method with additional keyword parameters without overriding also __init__().
* bpo-44954: Fix wrong result in float.fromhex corner case (GH-27834)Mark Dickinson2021-08-201-0/+14
|
* bpo-28395: Remove unnecessary semicolons in tests (GH-26868)Dong-hee Na2021-06-231-4/+4
|
* bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679)Serhiy Storchaka2021-06-121-0/+19
|
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)Inada Naoki2021-04-041-2/+2
| | | | | | | | | | | * Fix test_float * Fix _osx_support * Fix test_fstring * Fix test_gc * Fix test_gzip * Fix test_hashlib * Fix unrelated whitespace issue Co-authored-by: Ned Deily <nad@python.org>
* bpo-41873: Add vectorcall for float() (GH-22432)Dennis Sweeney2020-09-291-0/+3
|
* bpo-38629: implement __floor__ and __ceil__ for float type (GH-16985)Batuhan Taşkaya2019-12-151-0/+28
|
* bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)Serhiy Storchaka2019-06-011-0/+15
|
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)Serhiy Storchaka2019-03-051-9/+8
|
* bpo-35560: Remove assertion from format(float, "n") (GH-11288)Xtreak2019-01-071-0/+19
| | | | | Fix an assertion error in format() in debug build for floating point formatting with "n" format, zero padding and small width. Release build is not impacted. Patch by Karthikeyan Singaravelan.
* bpo-34087: Fix buffer overflow in int(s) and similar functions (GH-8274)INADA Naoki2018-07-141-0/+3
| | | | | | `_PyUnicode_TransformDecimalAndSpaceToASCII()` missed trailing NUL char. It caused buffer overflow in `_Py_string_to_number_with_underscores()`. This bug is introduced in 9b6c60cb.
* bpo-31979: Simplify transforming decimals to ASCII (#4336)Serhiy Storchaka2017-11-131-1/+1
| | | | | 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-0/+6
| | | | | 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-29773: Add more cases for testing string to float conversion errors. (#580)Serhiy Storchaka2017-03-091-8/+20
|
* bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() ↵Serhiy Storchaka2017-03-061-2/+2
| | | | and tuple(). (#518)
* bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)Serhiy Storchaka2017-03-051-0/+4
| | | | int(), bool(), float(), list() and tuple(). Specify the value as a positional argument instead.
* Issue #26331: Implement the parsing part of PEP 515.Brett Cannon2016-09-091-1/+23
| | | | Thanks to Georg Brandl for the patch.
* Issue #26983: float() now always return an instance of exact float.Serhiy Storchaka2016-06-031-8/+13
| | | | | | 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 #23640: int.from_bytes() no longer bypasses constructors for subclasses.Serhiy Storchaka2016-05-121-0/+18
|\
| * Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses.Serhiy Storchaka2016-05-121-0/+18
| |
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-241-1/+0
|/
* Issue #24731: Fixed crash on converting objects with special methodsSerhiy Storchaka2015-11-251-0/+15
|\ | | | | | | | | __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-0/+15
| | | | | | | | | | __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-2/+36
|\ \ | |/
| * Issue #24802: Copy bytes-like objects to null-terminated buffers if necessaryMartin Panter2015-11-071-2/+36
| | | | | | | | | | | | | | | | 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-0/+8
| | | | | | | | Vajrasky Kok.
* | Issue #21741: Update 147 test modules to use test discovery.Zachary Ware2015-04-131-14/+1
|/ | | | | | | I have compared output between pre- and post-patch runs of these tests to make sure there's nothing missing and nothing broken, on both Windows and Linux. The only differences I found were actually tests that were previously *not* run.
* fix up import styleBenjamin Peterson2015-03-091-5/+8
|
* remove redundant testBenjamin Peterson2015-03-061-5/+0
|
* fix potential refleak in PyFloat_AsDouble (closes #23590)Benjamin Peterson2015-03-061-0/+6
|
* Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-1/+1
|\
| * Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-1/+1
| |
* | #17080: improve error message of float/complex when the wrong type is passed.Ezio Melotti2013-11-071-0/+1
|/
* Remove untests for non-existent functionality.Mark Dickinson2012-04-291-10/+0
|
* Issue #14521: Make result of float('nan') and float('-nan') more consistent ↵Mark Dickinson2012-04-291-0/+13
| | | | across platforms. Further, don't rely on Py_HUGE_VAL for float('inf').
* merge 3.2Benjamin Peterson2011-10-281-0/+6
|\
| * bring is_integer into tested existenceBenjamin Peterson2011-10-281-0/+6
| |
* | #11565: Merge with 3.2.Ezio Melotti2011-03-161-2/+2
|\ \ | |/
| * #11565: Merge with 3.1.Ezio Melotti2011-03-161-2/+2
| |\