New submission from Stefan Krah <[email protected]>:
It should not be possible to pass coefficients when constructing infinities
from tuples. Otherwise it looks like infinities can have payloads (which they
can't).
Example:
>>> import decimal, cdecimal
>>> d = decimal.Decimal((0, (4, 5, 3, 4), 'F'))
>>> d
Decimal('Infinity')
>>> d = cdecimal.Decimal((0, (4, 5, 3, 4), 'F'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cdecimal.InvalidOperation: [<class 'cdecimal.ConversionSyntax'>]
Also, the non-coefficient of infinities should preferably be represented as an
empty tuple:
>>> decimal.Decimal("Infinity").as_tuple()
DecimalTuple(sign=0, digits=(0,), exponent='F')
>>> cdecimal.Decimal("Infinity").as_tuple()
(0, (), 'F')
----------
components: Library (Lib)
messages: 97656
nosy: mark.dickinson, skrah
severity: normal
status: open
title: decimal.py: infinity coefficients in tuples
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7684>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com