mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-98417: Store int_max_str_digits on the Interpreter State (GH-98418)
This commit is contained in:
parent
52fcba6512
commit
9c8dde0fa5
4 changed files with 13 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue