You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sys.set_int_max_str_digits ValueError Message is Inaccurate #127238
The sys.set_int_max_str_digits ValueError message is shown to be inaccurate in the following Python interpreter execution sequence:
>>> import sys
>>> sys.set_int_max_str_digits(maxdigits=639)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: maxdigits must be 0 or larger than 640
>>> sys.set_int_max_str_digits(maxdigits=640)
>>>
The sys.set_int_max_str_digits ValueError message states that "maxdigits" must be larger than "640." However, "sys.set_int_max_str_digits(maxdigits=640)" is a valid statement for Python to execute. Because argument "640" is valid for built-in function "sys.set_int_max_str_digits" and 640 is not larger than 640, this results in a discrepancy between what the ValueError message states as true and what is actually true.
Passing 639 raises the ValueError, so 640 is the lower limit as documented: "The lowest limit that can be configured is 640 digits as provided in sys.int_info.str_digits_check_threshold. Indeed (EDITED)
>>> sys.int_info.str_digits_check_threshold
640)
So, /larger than/at least/ in the error message, wherever it lives. (I am guessing that 640 = 8 lines of 80 digits.)
I would guess it's just a joke, referring to other famous quote (or to the myth about...) :D In Include/internal/pycore_long.h we have "640 digits should be enough for anyone." - gps
So, /larger than/at least/ in the error message
Here is a small pr, doing something like that: #127241
Activity
ZeroIntensity commentedon Nov 24, 2024
cc @skirpichev
terryjreedy commentedon Nov 25, 2024
Passing 639 raises the ValueError, so 640 is the lower limit as documented: "The lowest limit that can be configured is 640 digits as provided in sys.int_info.str_digits_check_threshold. Indeed (EDITED)
So, /larger than/at least/ in the error message, wherever it lives. (I am guessing that 640 = 8 lines of 80 digits.)
pythongh-127238: adjust error message for sys.set_int_max_str_digits()
skirpichev commentedon Nov 25, 2024
I would guess it's just a joke, referring to other famous quote (or to the myth about...) :D In
Include/internal/pycore_long.hwe have "640 digits should be enough for anyone." - gpsHere is a small pr, doing something like that: #127241
gh-127238: adjust error message for sys.set_int_max_str_digits() (#12…
pythongh-127238: adjust error message for sys.set_int_max_str_digits() (