You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python Decimal supports '#' format, C Decimal does not. #91060
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:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-03-02.23:39:51.993>labels= ['type-bug', 'library', '3.10', '3.11']
title="Python Decimal supports '#' format, C Decimal does not."updated_at=<Date2022-03-03.00:03:06.014>user='https://github.com/cgevans'
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.
Activity
cgevans commentedon Mar 2, 2022
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.
mdickinson commentedon Apr 12, 2022
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.
skrah commentedon Jan 28, 2024
This is fixed by applying the general format patch in #114563.
gh-114563: C decimal falls back to pydecimal for unsupported format s…
belm0 commentedon Feb 12, 2024
please close-- fIxed in PR #114879
[3.12] gh-114563: C decimal falls back to pydecimal for unsupported f…
[3.11] [3.12] pythongh-114563: C decimal falls back to pydecimal for …
[3.11] gh-114563: C decimal falls back to pydecimal for unsupported f…
pythongh-114563: C decimal falls back to pydecimal for unsupported fo…