mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
Issue #10650: Remove the non-standard 'watchexp' parameter from the
Decimal.quantize() method in the Python version. It had never been present in the C version.
This commit is contained in:
parent
5c2ac8c1c6
commit
b151f8f60b
4 changed files with 8 additions and 32 deletions
|
@ -2523,7 +2523,7 @@ class Decimal(object):
|
|||
end -= 1
|
||||
return _dec_from_triple(dup._sign, dup._int[:end], exp)
|
||||
|
||||
def quantize(self, exp, rounding=None, context=None, watchexp=True):
|
||||
def quantize(self, exp, rounding=None, context=None):
|
||||
"""Quantize self so its exponent is the same as that of exp.
|
||||
|
||||
Similar to self._rescale(exp._exp) but with error checking.
|
||||
|
@ -2546,16 +2546,6 @@ class Decimal(object):
|
|||
return context._raise_error(InvalidOperation,
|
||||
'quantize with one INF')
|
||||
|
||||
# if we're not watching exponents, do a simple rescale
|
||||
if not watchexp:
|
||||
ans = self._rescale(exp._exp, rounding)
|
||||
# raise Inexact and Rounded where appropriate
|
||||
if ans._exp > self._exp:
|
||||
context._raise_error(Rounded)
|
||||
if ans != self:
|
||||
context._raise_error(Inexact)
|
||||
return ans
|
||||
|
||||
# exp._exp should be between Etiny and Emax
|
||||
if not (context.Etiny() <= exp._exp <= context.Emax):
|
||||
return context._raise_error(InvalidOperation,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue