gh-98417: Stop modifying PyConfig in sys.set_int_max_str_digits() · python/cpython@7115bfd · GitHub
Skip to content

Commit 7115bfd

Browse files
committed
gh-98417: Stop modifying PyConfig in sys.set_int_max_str_digits()
PyConfig is an input to interpreter initialization; the copy stored on PyInterpreterState records how the interpreter was initialized. The runtime int<->str digit limit already lives in PyInterpreterState.long_state.max_str_digits and that is what all readers use, so drop the write-back into interp->config.int_max_str_digits from _PySys_SetIntMaxStrDigits(). As a consequence, interpreters created after a runtime limit change now start from the initially-configured limit instead of inheriting the current runtime value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 384abb7 commit 7115bfd

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

Lib/test/test_int.py

Lines changed: 18 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:func:`sys.set_int_max_str_digits` no longer writes the new limit back into
2+
the interpreter's initialization configuration (:c:type:`PyConfig`). As a
3+
consequence, interpreters created after changing the limit at runtime now
4+
start with the initial configured limit rather than inheriting the runtime
5+
value.

Python/sysmodule.c

Lines changed: 0 additions & 3 deletions

0 commit comments

Comments
 (0)