@@ -791,10 +791,12 @@ _PyConfig_InitCompatConfig(PyConfig *config)
791791 config -> safe_path = 0 ;
792792 config -> _is_python_build = 0 ;
793793 config -> code_debug_ranges = 1 ;
794- /* config_init_int_max_str_digits() sets default limit */
795- config -> int_max_str_digits = -1 ;
796794}
797795
796+ /* Excluded from public struct PyConfig for backporting reasons. */
797+ /* default to unconfigured, _PyLong_InitTypes() does the rest */
798+ int _Py_global_config_int_max_str_digits = -1 ;
799+
798800
799801static void
800802config_init_defaults (PyConfig * config )
@@ -1019,7 +1021,6 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2)
10191021 COPY_ATTR (safe_path );
10201022 COPY_WSTRLIST (orig_argv );
10211023 COPY_ATTR (_is_python_build );
1022- COPY_ATTR (int_max_str_digits );
10231024
10241025#undef COPY_ATTR
10251026#undef COPY_WSTR_ATTR
@@ -1127,7 +1128,6 @@ _PyConfig_AsDict(const PyConfig *config)
11271128 SET_ITEM_INT (use_frozen_modules );
11281129 SET_ITEM_INT (safe_path );
11291130 SET_ITEM_INT (_is_python_build );
1130- SET_ITEM_INT (int_max_str_digits );
11311131
11321132 return dict ;
11331133
@@ -1781,9 +1781,6 @@ config_init_int_max_str_digits(PyConfig *config)
17811781 int maxdigits ;
17821782 int valid = 0 ;
17831783
1784- /* default to unconfigured, _PyLong_InitTypes() does the rest */
1785- config -> int_max_str_digits = -1 ;
1786-
17871784 const char * env = config_get_env (config , "PYTHONINTMAXSTRDIGITS" );
17881785 if (env ) {
17891786 if (!_Py_str_to_int (env , & maxdigits )) {
@@ -1797,7 +1794,7 @@ config_init_int_max_str_digits(PyConfig *config)
17971794 STRINGIFY (_PY_LONG_MAX_STR_DIGITS_THRESHOLD )
17981795 " or 0 for unlimited." );
17991796 }
1800- config -> int_max_str_digits = maxdigits ;
1797+ _Py_global_config_int_max_str_digits = maxdigits ;
18011798 }
18021799
18031800 const wchar_t * xoption = config_get_xoption (config , L"int_max_str_digits" );
@@ -1816,7 +1813,7 @@ config_init_int_max_str_digits(PyConfig *config)
18161813#undef _STRINGIFY
18171814#undef STRINGIFY
18181815 }
1819- config -> int_max_str_digits = maxdigits ;
1816+ _Py_global_config_int_max_str_digits = maxdigits ;
18201817 }
18211818 return _PyStatus_OK ();
18221819}
@@ -1884,7 +1881,7 @@ config_read_complex_options(PyConfig *config)
18841881 }
18851882 }
18861883
1887- if (config -> int_max_str_digits < 0 ) {
1884+ if (_Py_global_config_int_max_str_digits < 0 ) {
18881885 status = config_init_int_max_str_digits (config );
18891886 if (_PyStatus_EXCEPTION (status )) {
18901887 return status ;
0 commit comments