-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Python Decimal supports '#' format, C Decimal does not. #91060
Comments
Decimal as implemented in _pydecimal supports the '#' alternate form in format strings, though this does not appear to be documented: as with floats, it causes a decimal point to be included regardless of value. Decimal as implemented in cdecimal, as it uses libmpdec, does not. This is a rather minor discrepancy; I hadn't actually intended to have # in my format string at all, but it had ended up there and was causing errors for half of the users of my library. # also could be useful for decimals, as it can be for floats. Like bpo-45739, it's unclear to me whether this is a discrepancy that should be corrected by implementing # for cdecimal, removing # support for _pydecimal, or just documenting the inconsistency. |
I agree that the Python and C versions of Decimal should be consistent. The support in the Python version definitely was intentional, and I'd be reluctant to remove it. So options are: (a) do nothing, (b) document the discrepancy, or (c) fix cdecimal. #58046 is somewhat related. |
This is fixed by applying the general format patch in #114563. |
…trings (GH-114879) Immediate merits: * eliminate complex workarounds for 'z' format support (NOTE: mpdecimal recently added 'z' support, so this becomes efficient in the long term.) * fix 'z' format memory leak * fix 'z' format applied to 'F' * fix missing '#' format support Suggested and prototyped by Stefan Krah. Fixes gh-114563, gh-91060 Co-authored-by: Stefan Krah <[email protected]>
please close-- fIxed in PR #114879 |
…ormat strings (GH-114879) (GH-115353) Immediate merits: * eliminate complex workarounds for 'z' format support (NOTE: mpdecimal recently added 'z' support, so this becomes efficient in the long term.) * fix 'z' format memory leak * fix 'z' format applied to 'F' * fix missing '#' format support Suggested and prototyped by Stefan Krah. Fixes gh-114563, gh-91060 (cherry picked from commit 72340d1) Co-authored-by: John Belmonte <[email protected]> Co-authored-by: Stefan Krah <[email protected]>
…unsupported format strings (pythonGH-114879) (pythonGH-115353) Immediate merits: * eliminate complex workarounds for 'z' format support (NOTE: mpdecimal recently added 'z' support, so this becomes efficient in the long term.) * fix 'z' format memory leak * fix 'z' format applied to 'F' * fix missing 'GH-' format support Suggested and prototyped by Stefan Krah. Fixes pythongh-114563, pythongh-91060 (cherry picked from commit 72340d1) (cherry picked from commit 09c98e4) Co-authored-by: John Belmonte <[email protected]> Co-authored-by: Stefan Krah <[email protected]>
…ormat strings (GH-114879) (GH-115384) Immediate merits: * eliminate complex workarounds for 'z' format support (NOTE: mpdecimal recently added 'z' support, so this becomes efficient in the long term.) * fix 'z' format memory leak * fix 'z' format applied to 'F' * fix missing 'GH-' format support Suggested and prototyped by Stefan Krah. Fixes gh-114563, gh-91060 (cherry picked from commit 72340d1) (cherry picked from commit 09c98e4) Co-authored-by: Stefan Krah <[email protected]>
…rmat strings (pythonGH-114879) Immediate merits: * eliminate complex workarounds for 'z' format support (NOTE: mpdecimal recently added 'z' support, so this becomes efficient in the long term.) * fix 'z' format memory leak * fix 'z' format applied to 'F' * fix missing '#' format support Suggested and prototyped by Stefan Krah. Fixes pythongh-114563, pythongh-91060 Co-authored-by: Stefan Krah <[email protected]>
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: