python / python/cpython

IDLE: Handle repr(big_integer) value error

Open
#135,498 1 comment 0 reactions 1 assignee View on GitHub

@terryjreedy is already working on this.

Since Jun 14, 2025.

pending topic-IDLE type-feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.