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.
This commit is contained in:
Gregory P. Smith 2022-10-03 13:55:45 -07:00 • committed by GitHub
parent cfbc7dd910
commit b0f89cb431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 111 additions and 24 deletions

View file

@ -828,6 +828,24 @@ PyConfig
Default: ``0``.
.. c:member:: int int_max_str_digits
Configures the :ref:`integer string conversion length limitation
<int_max_str_digits>`. An initial value of ``-1`` means the value will
be taken from the command line or environment or otherwise default to
4300 (:data:`sys.int_info.default_max_str_digits`). A value of ``0``
disables the limitation. Values greater than zero but less than 640
(:data:`sys.int_info.str_digits_check_threshold`) are unsupported and
will produce an error.
Configured by the :option:`-X int_max_str_digits <-X>` command line
flag or the :envvar:`PYTHONINTMAXSTRDIGITS` environment varable.
Default: ``-1`` in Python mode. 4300
(:data:`sys.int_info.default_max_str_digits`) in isolated mode.
.. versionadded:: 3.12
.. c:member:: int isolated
If greater than ``0``, enable isolated mode: