From b0f89cb4311b696f875e58f14258ce315be09bce Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Mon, 3 Oct 2022 13:55:45 -0700 Subject: 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. --- Python/sysmodule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Python/sysmodule.c') 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; -- cgit v1.2.3