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
test_float fails for 'legacy' float repr style #50030
Comments
After: CC="gcc -DPY_NO_SHORT_FLOAT_REPR" ./configure && make test_format_testfile in test_float fails with: test.support.TestFailed: Traceback (most recent call last):
File "Lib/test/test_float.py", line 341, in test_format_testfile
self.assertEqual(fmt % float(arg), rhs)
AssertionError: '100000000000.0' != '1e+11' The problem is that for str(float), the new formatting code switches to A similar issue exists for repr: repr(1e16) should now produce '1e+16'. |
Here's a patch. Eric, do you have time to check this over for general |
On second thoughts, I think that repr shouldn't change: 'legacy' Here's a new patch, which leaves repr alone and fixes up the Misc/NEWS |
I agree that there should be 2 behaviors, not 3. This patch looks okay to me, and tests pass both with and without One nit: You don't need to use Py_CHARMASK when using the ISDIGIT macro |
Also, remove_trailing_zeros should go inside the #ifdef so it's not |
I seem to recall that despite the C standards, there are platforms around And my man page for isdigit says: COMPATIBILITY So I'm tempted to go the other way and say that all uses of isdigit should I'll fix the Py_CHARMASK and move remove_trailing_zeros inside the ifdef. |
I definitely think that if you go with isdigit, you need the macro. I've My actual suggestion is to go with isdigit and the macro everywhere in But for just this checkin, ISDIGIT is probably best. |
Committed, with the fixups Eric pointed out, in r71692. |
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: