diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-10-03 13:55:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 13:55:45 -0700 |
commit | b0f89cb4311b696f875e58f14258ce315be09bce (patch) | |
tree | c387a1482f5b7c1a12061cf0f755835cf95a6a71 /Python/sysmodule.c | |
parent | cfbc7dd91059cb663c7fe13c661665943495ed7f (diff) | |
download | cpython-b0f89cb4311b696f875e58f14258ce315be09bce.tar.gz cpython-b0f89cb4311b696f875e58f14258ce315be09bce.zip |
gh-96512: Move int_max_str_digits setting to PyConfig (#96944)
It had to live as a global outside of PyConfig for stable ABI reasons in
the pre-3.12 backports.
This removes the `_Py_global_config_int_max_str_digits` and gets rid of
the equivalent field in the internal `struct _is PyInterpreterState` as
code can just use the existing nested config struct within that.
Adds tests to verify unique settings and configs in subinterpreters.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 653b5a55e88..584a8be7094 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_FromSsize_t(interp->int_max_str_digits); + return PyLong_FromLong(interp->config.int_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->int_max_str_digits = maxdigits; + tstate->interp->config.int_max_str_digits = maxdigits; Py_RETURN_NONE; } else { PyErr_Format( @@ -2810,7 +2810,7 @@ set_flags_from_config(PyInterpreterState *interp, PyObject *flags) SetFlag(preconfig->utf8_mode); SetFlag(config->warn_default_encoding); SetFlagObj(PyBool_FromLong(config->safe_path)); - SetFlag(_Py_global_config_int_max_str_digits); + SetFlag(config->int_max_str_digits); #undef SetFlagObj #undef SetFlag return 0; |