summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-10-19 20:27:46 (GMT)
committerGitHub <noreply@github.com>2022-10-19 20:27:46 (GMT)
commit9c8dde0fa5309ae9f83a4faa07f062fcd84df4cf (patch)
tree16f0ebdbd2b3c82e8c84af9a94e13b0e2fb1ba5d /Python
parent52fcba651288ac1c0f9b1fb71379f1dad54ee1da (diff)
downloadcpython-9c8dde0fa5309ae9f83a4faa07f062fcd84df4cf.zip
cpython-9c8dde0fa5309ae9f83a4faa07f062fcd84df4cf.tar.gz
cpython-9c8dde0fa5309ae9f83a4faa07f062fcd84df4cf.tar.bz2
gh-98417: Store int_max_str_digits on the Interpreter State (GH-98418)
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c2
-rw-r--r--Python/sysmodule.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index c550f13..4195a9d 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -480,6 +480,8 @@ interpreter_update_config(PyThreadState *tstate, int only_update_path_config)
}
}
+ tstate->interp->long_state.max_str_digits = config->int_max_str_digits;
+
// Update the sys module for the new configuration
if (_PySys_UpdateConfig(tstate) < 0) {
return -1;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 2c66415..7081456 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1717,7 +1717,7 @@ sys_get_int_max_str_digits_impl(PyObject *module)
/*[clinic end generated code: output=0042f5e8ae0e8631 input=8dab13e2023e60d5]*/
{
PyInterpreterState *interp = _PyInterpreterState_GET();
- return PyLong_FromLong(interp->config.int_max_str_digits);
+ return PyLong_FromLong(interp->long_state.max_str_digits);
}
/*[clinic input]
@@ -1734,7 +1734,7 @@ sys_set_int_max_str_digits_impl(PyObject *module, int maxdigits)
{
PyThreadState *tstate = _PyThreadState_GET();
if ((!maxdigits) || (maxdigits >= _PY_LONG_MAX_STR_DIGITS_THRESHOLD)) {
- tstate->interp->config.int_max_str_digits = maxdigits;
+ tstate->interp->long_state.max_str_digits = maxdigits;
Py_RETURN_NONE;
} else {
PyErr_Format(