This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients hac.man, mark.dickinson, skrah
Date 2012-09-08.06:50:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347087046.72.0.347569613082.issue15882@psf.upfronthosting.co.za>
In-reply-to
Content
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').
History
Date User Action Args
2012-09-08 06:50:46skrahsetrecipients: + skrah, mark.dickinson, hac.man
2012-09-08 06:50:46skrahsetmessageid: <1347087046.72.0.347569613082.issue15882@psf.upfronthosting.co.za>
2012-09-08 06:50:46skrahlinkissue15882 messages
2012-09-08 06:50:45skrahcreate