Skip to content

Benchmark test fails for large numbers in decimal module #108346

@CharlieZhao95

Description

@CharlieZhao95

Bug report

Checklist

  • I am confident this is a bug in CPython, not a bug in a third-party project
  • I have searched the CPython issue tracker,
    and am confident this bug has not been reported before

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.13.0a0 (heads/demo/parser:a794ebeb02, Aug 22 2023, 11:44:58) [GCC 11.3.0]

A clear and concise description of the bug:

There are some tests in the decimal module related to large numbers, they may fail due to the patch of CVE-2020-10735 (large int<->str conversions). Here is a benchmark in decimal.

cd ./Modules/_decimal/tests
../../../python bench.py

Output:

...
# ======================================================================
#                               Factorial
# ======================================================================

n = 100000

cdecimal:
calculation time: 0.942886s
conversion time: 0.002155s

Traceback (most recent call last):
  File "/home/github/cpython/Modules/_decimal/tests/bench.py", line 121, in <module>
    sy = str(y)
         ^^^^^^
ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions