[issue15783] decimal.localcontext(None) fails when using the C accelerator module
Stefan Krah
report at bugs.python.org
Fri Nov 16 18:22:18 CET 2012
Stefan Krah added the comment:
OK, here's a patch. Specifics:
o Except for the number methods, decimal.py and _decimal should behave
identically now.
o _decimal actually requires an additional context arg in same_quantum(),
compare_total(), compare_total_mag() and copy_sign(). This is for raising
InvalidOperation if the second operand is a very large integer and cannot
be converted exactly.
I've added the context arguments to the Python version to keep compatibility.
o For some reason decimal.py uses a context arg in canonical(), so I've
added it to the C version.
o localcontext(ctx=None) is pretty ugly. Perhaps we should make the
backwards incompatible switch to localcontext(context=None). I don't
care a lot though.
o I'd like to update the docstrings and the documentation in a separate
patch.
o The important idiom c.power(modulo=None, b=9, a=3) is now supported. :)
----------
Added file: http://bugs.python.org/file28004/issue15783-all.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15783>
_______________________________________
More information about the Python-bugs-list
mailing list