[issue26208] decimal C module's exceptions don't match the Python version

2022-03-02 Thread Constantine Evans


Constantine Evans  added the comment:

Some other non-matching exceptions are unfriendly, but do not come from 
libmpdec and could be made to match without, I think, causing problems.  For 
example:

>>> format(_decimal.Decimal(1), "invalid")
...
ValueError: invalid format string
>>> format(_pydecimal.Decimal(1), "invalid")
...
ValueError: Invalid format specifier: invalid

Would it make sense to make a patch to make these match?

--
nosy: +const

___
Python tracker 
<https://bugs.python.org/issue26208>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46904] Python Decimal supports '#' format, C Decimal does not.

2022-03-02 Thread Constantine Evans


New submission from Constantine Evans :

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 #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.

--
components: Library (Lib)
messages: 414390
nosy: const
priority: normal
severity: normal
status: open
title: Python Decimal supports '#' format, C Decimal does not.
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46904>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com