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
Fix for int(string, base) wrong answers (take 2) #42513
Comments
This incorporates patch bpo-1334979, adds test cases for A lookup table was added for the maximum number of Evaluation of each character has also been replaced by Baseline Python from CVS: Modified: 10.2% faster for 1-digit int Test program that takes 750k ints from [0, 2**32) 19.8% faster NOTE: This patch causes new errors in test_array and ====================================================================== Traceback (most recent call last):
File "Lib/test/test_array.py", line 187, in test_repr
self.assertEqual(a, eval(repr(a), {"array":
array.array}))
ValueError: invalid literal for long(): 10000000000.0
====================================================================== Traceback (most recent call last):
File "Lib/test/test_array.py", line 187, in test_repr
self.assertEqual(a, eval(repr(a), {"array":
array.array}))
ValueError: invalid literal for long(): 10000000000.0
test test_compile crashed -- exceptions.ValueError: |
Logged In: YES I forgot to add that these results were obtained on a PIIIm |
Logged In: YES Instead of:
Shoold be
while ((c = Py_CHARMASK(*str)) != '\0') { c = digitlookup[c];
And why not
}; |
Logged In: YES Thanks, funny_falcon - that corrected the problem with the The new patch is attached as python-mystrtoul4.tgz; it |
Logged In: YES This looks pretty good to me -- talk about every trick in the Note that the digitlimit vector is too cautious for bases that "N digits can't overflow" iff Assuming exact calculation of log(2**32, base) then The power-of-2 bases, and base 10, should be added to the |
Logged In: YES I cleaned up the digitlimit vector and test cases now |
Logged In: YES Tim, if it looks good can it be applied? |
Logged In: YES Thank you, Alan! A variant of the patch was checked in as Lib/test/test_builtin.py For future reference, note that C doesn't define whether an |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: