Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.7] gh-96848: Fix -X int_max_str_digits option parsing (#96988) #97576

Open
wants to merge 1 commit into
base: 3.7
Choose a base branch
from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 26, 2022

Fix command line parsing: reject "-X int_max_str_digits" option with no value (invalid) when the PYTHONINTMAXSTRDIGITS environment variable is set to a valid limit.

(cherry picked from commit 4135166)

Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.

(cherry picked from commit 4135166)
@vstinner
Copy link
Member Author

vstinner commented Sep 28, 2022

Ah, Windows (x64) failed with a time issue:

FAIL: test_denial_of_service_prevented_str_to_int (test.test_int.IntStrDigitLimitsTests)
Regression test: ensure we fail before performing O(N**2) work.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\test\test_int.py", line 654, in test_denial_of_service_prevented_str_to_int
    self.assertLess(seconds_to_fail_extra_huge, seconds_to_convert/8)
AssertionError: 0.015625 not less than 0.013671875

I re-run the failed job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants