Miss Islington (bot)
c721472fb8
bpo-34087: Fix buffer overflow in int(s) and similar functions (GH-8274)
...
`_PyUnicode_TransformDecimalAndSpaceToASCII()` missed trailing NUL char.
It caused buffer overflow in `_Py_string_to_number_with_underscores()`.
This bug is introduced in 9b6c60cb
.
(cherry picked from commit 16dfca4d82
)
Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
2018-07-13 20:58:12 -07:00
Serhiy Storchaka
9b6c60cbce
bpo-31979: Simplify transforming decimals to ASCII ( #4336 )
...
in int(), float() and complex() parsers.
This also speeds up parsing non-ASCII numbers by around 20%.
2017-11-13 21:23:48 +02:00
Benjamin Peterson
2bb69a5b4e
bpo-31373: remove overly strict float range checks ( #3486 )
...
This undoes a853a8ba78
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.
2017-09-10 23:50:46 -07:00
Serhiy Storchaka
9e6ac83aca
bpo-29773: Add more cases for testing string to float conversion errors. ( #580 )
2017-03-09 20:07:58 +02:00
Serhiy Storchaka
2e5642422f
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). ( #518 )
2017-03-06 17:01:06 +02:00
Serhiy Storchaka
58d23e6806
bpo-29695: Deprecated using bad named keyword arguments in builtings: ( #486 )
...
int(), bool(), float(), list() and tuple(). Specify the value as a
positional argument instead.
2017-03-06 00:53:39 +02:00
Brett Cannon
a721abac29
Issue #26331 : Implement the parsing part of PEP 515.
...
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Serhiy Storchaka
16931c3559
Issue #26983 : float() now always return an instance of exact float.
...
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.
2016-06-03 21:42:55 +03:00
Serhiy Storchaka
1f364438ad
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:39:32 +03:00
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:37:58 +03:00
Serhiy Storchaka
e437a10d15
Issue #23277 : Remove unused imports in tests.
2016-04-24 21:41:02 +03:00
Serhiy Storchaka
f9afda57ad
Issue #24731 : Fixed crash on converting objects with special methods
...
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
2015-11-25 15:52:04 +02:00
Serhiy Storchaka
15095800a3
Issue #24731 : Fixed crash on converting objects with special methods
...
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
2015-11-25 15:47:01 +02:00
Martin Panter
eeb896c411
Issue #24802 : Copy bytes-like objects to null-terminated buffers if necessary
...
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.
2015-11-07 02:32:21 +00:00
Martin Panter
61d6e4ae9d
Issue #24802 : Merge null termination fixes from 3.4 into 3.5
2015-11-07 02:56:11 +00:00
Steve Dower
cb39d1f466
Issue 19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok.
2015-04-15 16:10:59 -04:00
Zachary Ware
38c707e7e0
Issue #21741 : Update 147 test modules to use test discovery.
...
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.
2015-04-13 15:00:43 -05:00
Benjamin Peterson
101447b3fe
fix up import style
2015-03-09 10:37:50 -04:00
Benjamin Peterson
c19ed37579
remove redundant test
2015-03-06 09:10:26 -05:00
Benjamin Peterson
a915723dc7
fix potential refleak in PyFloat_AsDouble ( closes #23590 )
2015-03-06 09:08:44 -05:00
Zachary Ware
101d9e7250
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:44:27 -06:00
Zachary Ware
9fe6d86709
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:20:35 -06:00
Ezio Melotti
a5b9599538
#17080 : improve error message of float/complex when the wrong type is passed.
2013-11-07 19:18:34 +02:00
Mark Dickinson
89e6d3896a
Remove untests for non-existent functionality.
2012-04-29 19:17:05 +01:00
Mark Dickinson
e383e82e04
Issue #14521 : Make result of float('nan') and float('-nan') more consistent across platforms. Further, don't rely on Py_HUGE_VAL for float('inf').
2012-04-29 15:31:56 +01:00
Benjamin Peterson
29037720d1
merge 3.2
2011-10-28 19:44:00 -04:00
Benjamin Peterson
b3b8ba6121
bring is_integer into tested existence
2011-10-28 19:42:48 -04:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Ezio Melotti
b88ed1549e
#11565 : Merge with 3.2.
2011-03-16 11:38:59 +02:00
Eli Bendersky
67ebabd152
Removed fcmp and FUZZ from test.support, following the discussion on python-dev:
...
http://mail.python.org/pipermail/python-dev/2011-January/107735.html
2011-02-25 10:14:17 +00:00
Eric Smith
3ab08cadae
Issue #10624 : Use support.requires_IEEE_754 in all appropriate tests.
2010-12-04 15:17:38 +00:00
Mark Dickinson
0169af1534
Merged revisions 87032 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87032 | mark.dickinson | 2010-12-04 12:25:30 +0000 (Sat, 04 Dec 2010) | 3 lines
Issue #10596 : Fix float.__mod__ to have the same behaviour as
float.__divmod__ with respect to signed zeros.
........
2010-12-04 13:04:18 +00:00
Mark Dickinson
33154388f9
Backout broken backport. (Sorry.)
2010-12-04 12:42:18 +00:00
Mark Dickinson
11e77ffcbc
Merged revisions 87032 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87032 | mark.dickinson | 2010-12-04 12:25:30 +0000 (Sat, 04 Dec 2010) | 3 lines
Issue #10596 : Fix float.__mod__ to have the same behaviour as
float.__divmod__ with respect to signed zeros.
........
2010-12-04 12:38:19 +00:00
Mark Dickinson
d2a9b20efa
Issue #10596 : Fix float.__mod__ to have the same behaviour as
...
float.__divmod__ with respect to signed zeros.
2010-12-04 12:25:30 +00:00
Alexander Belopolsky
942af5a9a4
Issue #10557 : Fixed error messages from float() and other numeric
...
types. Added a new API function, PyUnicode_TransformDecimalToASCII(),
which transforms non-ASCII decimal digits in a Unicode string to their
ASCII equivalents.
2010-12-04 03:38:46 +00:00
Eric Smith
984bb58000
Issue #7094 : Add alternate ('#') flag to __format__ methods for float, complex and Decimal. Allows greater control over when decimal points appear. Added to make transitioning from %-formatting easier. '#g' still has a problem with Decimal which I'll fix soon.
2010-11-25 16:08:06 +00:00
Ezio Melotti
19f2aeba67
Merged revisions 86596 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424 : Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 01:30:29 +00:00
Ezio Melotti
b3aedd4862
#9424 : Replace deprecated assert* methods in the Python test suite.
2010-11-20 19:04:17 +00:00
Brian Curtin
a813a638ef
Merged revisions 86003 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86003 | brian.curtin | 2010-10-30 19:03:45 -0500 (Sat, 30 Oct 2010) | 2 lines
Fix ResourceWarning. Use context manager to properly close file.
........
2010-10-31 00:05:24 +00:00
Brian Curtin
076623bf0a
Fix ResourceWarning. Use context manager to properly close file.
2010-10-31 00:03:45 +00:00
Mark Dickinson
388122d43b
Issue #9337 : Make float.__str__ identical to float.__repr__.
...
(And similarly for complex numbers.)
2010-08-04 20:56:28 +00:00
Benjamin Peterson
e401c6842a
Merged revisions 82461 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r82461 | benjamin.peterson | 2010-07-02 18:05:27 -0500 (Fri, 02 Jul 2010) | 1 line
don't require the presence of __getformat__ or __setformat__; use requires_IEEE_754 globally
........
2010-07-02 23:25:44 +00:00
Mark Dickinson
6ded1d5687
Merged revisions 82117 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r82117 | mark.dickinson | 2010-06-20 19:50:19 +0100 (Sun, 20 Jun 2010) | 1 line
Merge test_strtod and test_float string-to-float conversion tests.
........
2010-06-20 20:01:04 +00:00
Mark Dickinson
dc787d2055
Issue #8188 : Introduce a new scheme for computing hashes of numbers
...
(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.
2010-05-23 13:33:13 +00:00
Mark Dickinson
5daab45158
Merged revisions 79804 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79804 | mark.dickinson | 2010-04-05 19:07:51 +0100 (Mon, 05 Apr 2010) | 5 lines
Use a more robust infinity check in _Py_HashDouble.
This fixes a test_decimal failure on FreeBSD 8.0. (modf apparently
doesn't follow C99 Annex F on FreeBSD.)
........
2010-04-05 18:09:39 +00:00
Georg Brandl
1b37e8728c
Merged revisions 78093 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line
Remove unused imports in test modules.
........
2010-03-14 10:45:50 +00:00
Mark Dickinson
c2d8689150
Merged revisions 78166 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78166 | mark.dickinson | 2010-02-12 21:16:38 +0000 (Fri, 12 Feb 2010) | 1 line
Check that 'd' isn't allowed as an exponent specifier in inputs to the float function.
........
2010-02-12 21:18:34 +00:00
Ezio Melotti
b58e0bd8bb
use assert[Not]In where appropriate
2010-01-23 15:40:09 +00:00