Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update doc; add NEWS entry
  • Loading branch information
vstinner committed Sep 16, 2022
commit 87377fca9a4325d18d0db047c3dbb51603985c9a
4 changes: 2 additions & 2 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5493,15 +5493,15 @@ When an operation would exceed the limit, a :exc:`ValueError` is raised:
>>> _ = int('2' * 5432)
Traceback (most recent call last):
...
ValueError: Exceeds the limit (4300) for integer string conversion: value has 5432 digits.
ValueError: Exceeds the limit (4300) for integer string conversion: value has 5432 digits; use sys.set_int_max_str_digits() to increase the limit.
>>> i = int('2' * 4300)
>>> len(str(i))
4300
>>> i_squared = i*i
>>> len(str(i_squared))
Traceback (most recent call last):
...
ValueError: Exceeds the limit (4300) for integer string conversion: value has 8599 digits.
ValueError: Exceeds the limit (4300) for integer string conversion: value has 8599 digits; use sys.set_int_max_str_digits() to increase the limit.
>>> len(hex(i_squared))
7144
>>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
When :exc:`ValueError` is raised if an integer is larger than the limit,
mention the :`sys.set_int_max_str_digits` function in the error message.
Comment thread
vstinner marked this conversation as resolved.
Outdated
Patch by Victor Stinner.