Message170035
Infinities do not have payloads. It's a bug in decimal.py that it
accepts non-empty coefficients when constructing infinities.
Since there was a corresponding unit test for as_tuple(), I've
kept the wrong representation for _decimal:
# XXX non-compliant infinity payload.
d = Decimal("Infinity")
self.assertEqual(d.as_tuple(), (0, (0,), 'F') )
But this unit test is only executed for the Python version:
# XXX coefficient in infinity should raise an error
if self.decimal == P:
d = Decimal( (0, (4, 5, 3, 4), 'F') )
self.assertEqual(d.as_tuple(), (0, (0,), 'F'))
d = Decimal( (1, (0, 2, 7, 1), 'F') )
self.assertEqual(d.as_tuple(), (1, (0,), 'F'))
My suggestion is to disallow non-empty tuples for decimal.py
and change the infinity tuple to (0, (), 'F'). |
|
Date |
User |
Action |
Args |
2012-09-08 06:50:46 | skrah | set | recipients:
+ skrah, mark.dickinson, hac.man |
2012-09-08 06:50:46 | skrah | set | messageid: <1347087046.72.0.347569613082.issue15882@psf.upfronthosting.co.za> |
2012-09-08 06:50:46 | skrah | link | issue15882 messages |
2012-09-08 06:50:45 | skrah | create | |
|