Skip to content

Commit

Permalink
[3.8] [3.10] Correct CVE-2020-10735 documentation (pythonGH-100306). (p…
Browse files Browse the repository at this point in the history
…ythonGH-100477)

(cherry picked from commit 1cf3d78)

Co-authored-by: Jeremy Paige <ucodery@gmail.com>.
(cherry picked from commit 88fe8d7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
  • Loading branch information
gpshead committed Jan 3, 2023
1 parent 266a502 commit bdf1a3e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4880,7 +4880,7 @@ to mitigate denial of service attacks. This limit *only* applies to decimal or
other non-power-of-two number bases. Hexadecimal, octal, and binary conversions
are unlimited. The limit can be configured.

The :class:`int` type in CPython is an abitrary length number stored in binary
The :class:`int` type in CPython is an arbitrary length number stored in binary
form (commonly known as a "bignum"). There exists no algorithm that can convert
a string to a binary integer or a binary integer to a string in linear time,
*unless* the base is a power of 2. Even the best known algorithms for base 10
Expand Down Expand Up @@ -4944,7 +4944,7 @@ and :class:`str` or :class:`bytes`:
* ``int(string)`` with default base 10.
* ``int(string, base)`` for all bases that are not a power of 2.
* ``str(integer)``.
* ``repr(integer)``
* ``repr(integer)``.
* any other string conversion to base 10, for example ``f"{integer}"``,
``"{}".format(integer)``, or ``b"%d" % integer``.

Expand Down Expand Up @@ -4972,7 +4972,7 @@ command line flag to configure the limit:
:envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`.
If both the env var and the ``-X`` option are set, the ``-X`` option takes
precedence. A value of *-1* indicates that both were unset, thus a value of
:data:`sys.int_info.default_max_str_digits` was used during initilization.
:data:`sys.int_info.default_max_str_digits` was used during initialization.

From code, you can inspect the current limit and set a new one using these
:mod:`sys` APIs:
Expand Down
4 changes: 2 additions & 2 deletions Python/clinic/sysmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,12 +1615,12 @@ sys_mdebug_impl(PyObject *module, int flag)
/*[clinic input]
sys.get_int_max_str_digits
Set the maximum string digits limit for non-binary int<->str conversions.
Return the maximum string digits limit for non-binary int<->str conversions.
[clinic start generated code]*/

static PyObject *
sys_get_int_max_str_digits_impl(PyObject *module)
/*[clinic end generated code: output=0042f5e8ae0e8631 input=8dab13e2023e60d5]*/
/*[clinic end generated code: output=0042f5e8ae0e8631 input=61bf9f99bc8b112d]*/
{
PyInterpreterState *interp = _PyInterpreterState_Get();
return PyLong_FromSsize_t(interp->int_max_str_digits);
Expand Down

0 comments on commit bdf1a3e

Please sign in to comment.