Sitelet https://github.com/python/cpython/issues/96848
Skip to content

Minor parsing issue with new -X int_max_str_digits option if PYTHONINTMAXSTRDIGITS #96848

Description

@vstinner

python -X int_max_str_digits command is invalid:

$ python -X int_max_str_digits
Fatal Python error: config_init_int_max_str_digits: -X int_max_str_digits: invalid limit; must be >= 640 or 0 for unlimited.
Python runtime state: preinitialized

But if PYTHONINTMAXSTRDIGITS environment variable is defined, the invalid option is no longer rejected:

$ PYTHONINTMAXSTRDIGITS=5000 python -X int_max_str_digits
Python 3.12.0a0 (heads/main:e37ac5fbb6, Sep 15 2022, 15:03:41) [GCC 12.2.1 20220819 (Red Hat 12.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

It's just because the valid variable in config_init_int_max_str_digits() is not initialized again in the -X option code path, after the env var is parsed.

I noticed this minor issue while backporting the change to Python 3.6 in Fedora for Red Hat.

cc @tiran @gpshead

Activity

  1. vstinner commented on Sep 15, 2022

    @vstinner
    MemberAuthor

    The code was introduced by the issue #95778.

  2. gpshead commented on Sep 15, 2022

    @gpshead
    Member

    Nice find. "Oops!" We're obviously missing an integration test for this situation. At least this scenario should be uncommon.

  3. added a commit that references this issue on Sep 26, 2022
  4. added a commit that references this issue on Sep 26, 2022
  5. added 4 commits that reference this issue on Sep 26, 2022
  6. 12 remaining items

  7. added 3 commits that reference this issue on Mar 20, 2024
  8. added a commit that references this issue on Mar 26, 2024
  9. added 3 commits that reference this issue on Apr 2, 2024
  10. added 2 commits that reference this issue on Apr 11, 2024
  11. added 2 commits that reference this issue on Apr 25, 2024
  12. added a commit that references this issue on Apr 23, 2025
  13. added a commit that references this issue on Jul 4, 2025
  14. added a commit that references this issue on Aug 12, 2025
  15. added a commit that references this issue on Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of life3.11only security fixes3.12only security fixes3.7 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifetype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions