IDLE: Handle repr(big_integer) value error
@terryjreedy is already working on this.
Since Jun 14, 2025.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
(Spinoff of #135487.) In Shell
>>> 1<<15000
Traceback (most recent call last):
File "<pyshell#38>", line 1, in <module>
1<<15000
ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit
The error also occurs in Debugger. For debugger, I have already thought replacing reprlib.repr since debugger displays only about the first 40 chars of the repr string. First possibility: f"int(10**{log10(n)})". It returns a legal expression, but large-enough exponents overflow. Second: f"10**round({log10(n)}) # Approximately. This will evaluate to an order of magnitude approximation, which is often better than 100s or 1000s of digits. In Shell, the error message could follow as a comment. In debugger, I would like to add hovertips with more information.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.