[issue12079] decimal.py: TypeError precedence in fma()
Roundup Robot devnull@devnull added the comment: New changeset 825b4278a055 by Mark Dickinson in branch 'default': Issue #12079: Decimal(0).fma(Decimal('inf'), 'not a number') should give a TypeError, not a Decimal.InvalidOperation http://hg.python.org/cpython/rev/825b4278a055 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
Mark Dickinson dicki...@gmail.com added the comment: It turns out that this is as simple as moving the _convert_other call to the top of the Decimal.fma method. (For some reason I was confusing this with the subtleties involved in making sure that an InvalidOperation arising from the multiplication part of the fma takes precedence over an InvalidOperation coming from a signalling nan in the addend.) Fixed. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
New submission from Stefan Krah stefan-use...@bytereef.org: Hi, I think that TypeError should take precedence over InvalidOperation in these two cases: Decimal('Infinity').fma(Decimal('0'), (3.91224318126786e+19+0j)) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python3.2/decimal.py, line 1879, in fma 'INF * 0 in fma') File /usr/local/lib/python3.2/decimal.py, line 3926, in _raise_error raise error(explanation) decimal.InvalidOperation: INF * 0 in fma Decimal('1').fma(Decimal('snan'), 1.22) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python3.2/decimal.py, line 1871, in fma return context._raise_error(InvalidOperation, 'sNaN', other) File /usr/local/lib/python3.2/decimal.py, line 3926, in _raise_error raise error(explanation) decimal.InvalidOperation: sNaN -- components: Library (Lib) messages: 136014 nosy: mark.dickinson, rhettinger, skrah priority: normal severity: normal status: open title: decimal.py: TypeError precedence in fma() type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
Mark Dickinson dicki...@gmail.com added the comment: Yes, I agree. Do you have a patch? I guess the only mildly tricky part here is making sure that the patch doesn't cause fma(2, 3, snan) (for example) to raise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
Mark Dickinson dicki...@gmail.com added the comment: cause fma(2, 3, snan) ... Gah! That was nonsense. Please ignore. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
Stefan Krah stefan-use...@bytereef.org added the comment: Ok, I'll write a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12079] decimal.py: TypeError precedence in fma()
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12079 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com