| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-96874) (GH-96877) (GH-97836)
[3.9] gh-95778: Mention sys.set_int_max_str_digits() in error message (GH-96874) (GH-96877)
When ValueError is raised if an integer is larger than the limit,
mention sys.set_int_max_str_digits() in the error message.
(cherry picked from commit e841ffc915e82e5ea6e3b473205417d63494808d)
Co-authored-by: Ned Deily <nad@python.org>
(cherry picked from commit 41188134bd2120f0cedd681ed88743c11c7f3742)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Converting between `int` and `str` in bases other than 2
(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) now
raises a `ValueError` if the number of digits in string form is above a
limit to avoid potential denial of service attacks due to the algorithmic
complexity. This is a mitigation for CVE-2020-10735
(https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735).
This new limit can be configured or disabled by environment variable, command
line flag, or :mod:`sys` APIs. See the `Integer String Conversion Length
Limitation` documentation. The default limit is 4300
digits in string form.
Patch by Gregory P. Smith [Google] and Christian Heimes [Red Hat] with feedback
from Victor Stinner, Thomas Wouters, Steve Dower, Ned Deily, and Mark Dickinson.
|
| |
|
|
| |
(GH-15962)
|
| |
|
|
|
|
|
| |
(GH-13860) (GH-13896)
(cherry picked from commit dc2476500d91082f0c907772c83a044bf49af279)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-9705)
The _PyLong_FromByteArray() call in int_from_bytes_impl() was
unchecked.
(cherry picked from commit 7bb9cd0a6766fd3e7b3c1e8f2315304ae192b34c)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Explicitly cast digits (Py_ssize_t) to double to fix the following
false-alarm warning from Coverity:
"fsize_z = digits * log_base_BASE[base] + 1;"
CID 1424951: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "9223372036854775783UL" and "4UL", and
then converting the integer quotient to type "double". Any remainder,
or fractional part of the quotient, is ignored.
|
| | |
|
| |
|
|
|
|
| |
* bpo-16055: Fixes incorrect error text for int('1', base=1000)
* bpo-16055: Address review comments
|
| |
|
|
|
| |
in int(), float() and complex() parsers.
This also speeds up parsing non-ASCII numbers by around 20%.
|
| |
|
|
| |
functions (GH-793)
|
| |
|
|
|
| |
underscores (#3827)
to integer with binary base.
|
| |
|
|
|
|
|
| |
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
|
| |
|
|
|
|
|
| |
(#680)
ValueError always is raised rather than OverflowError for negative counts.
Shifting zero with non-negative count always returns zero.
|
| | |
|
| | |
|
| |
|
| |
The docstring did not properly represent the fact that the argument to int() was positional-only.
|
| |
|
|
| |
and tuple(). (#518)
|
| | |
|
| |
|
|
| |
int(), bool(), float(), list() and tuple(). Specify the value as a
positional argument instead.
|
| |
|
|
| |
(10-20% for small integers).
|
| |
|
|
| |
Based on patch by Vajrasky Kok.
|
| |
|
|
|
|
| |
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
| |
functions.
|
| |
|
|
| |
UTF-8 represenatation of Unicode objects.
|
| |\
| |
| |
| |
| |
| | |
_PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
|
| | |\
| | |
| | |
| | |
| | |
| | | |
_PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
_PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
|
| | | |
| | |
| | |
| | | |
implementation. Patch by Adrian Wielgosik.
|
| | | |
| | |
| | |
| | | |
Thanks Oren Milman.
|
| | | |
| | |
| | |
| | | |
Thanks Oren Milman.
|
| |/ / |
|
| |\ \
| |/ |
|
| | |
| |
| |
| | |
compiled with NSMALLPOSINTS = 0.
|
| | | |
|
| | |
| |
| |
| | |
Thanks to Georg Brandl for the patch.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
allocate large amounts of memory.
|
| | |
| |
| |
| | |
storage requirements and relax restriction on converting large integers. Patch by Serhiy Storchaka.
|
| | |
| |
| |
| | |
long_invert. Thanks Oren Milman.
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
have caused off-by-one-ulp results on certain platforms.
|
| | |
| |
| |
| |
| | |
The z variable is known to be a fresh number which cannot be shared, Py_SIZE()
can be used directly to negate the number.
|
| |\ \
| |/ |
|