Repository navigation
Commit 3b1997a
committed
pythongh-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 and must
be treated as read-only afterwards. 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, restoring the Python 3.11 behavior.
Also document the read-only-after-init constraint on the PyConfig
declaration itself, per discussion on the issue.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UTM742RWwqsDkF5JGSsGWX1 parent 384abb7 commit 3b1997a
4 files changed
Lines changed: 35 additions & 4 deletions
File tree
- Include/cpython
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
735 | 753 | | |
736 | 754 | | |
737 | 755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4701 | 4701 | | |
4702 | 4702 | | |
4703 | 4703 | | |
4704 | | - | |
4705 | | - | |
4706 | 4704 | | |
4707 | 4705 | | |
4708 | | - | |
4709 | 4706 | | |
4710 | 4707 | | |
0 commit comments