mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Merge 3.3.
This commit is contained in:
commit
8031d0dfd4
8 changed files with 625 additions and 233 deletions
|
@ -2594,7 +2594,7 @@ class Decimal(object):
|
|||
ans = ans._fix(context)
|
||||
return ans
|
||||
|
||||
def same_quantum(self, other):
|
||||
def same_quantum(self, other, context=None):
|
||||
"""Return True if self and other have the same exponent; otherwise
|
||||
return False.
|
||||
|
||||
|
@ -2912,7 +2912,7 @@ class Decimal(object):
|
|||
except TypeError:
|
||||
return 0
|
||||
|
||||
def canonical(self, context=None):
|
||||
def canonical(self):
|
||||
"""Returns the same Decimal object.
|
||||
|
||||
As we do not have different encodings for the same number, the
|
||||
|
@ -2932,7 +2932,7 @@ class Decimal(object):
|
|||
return ans
|
||||
return self.compare(other, context=context)
|
||||
|
||||
def compare_total(self, other):
|
||||
def compare_total(self, other, context=None):
|
||||
"""Compares self to other using the abstract representations.
|
||||
|
||||
This is not like the standard compare, which use their numerical
|
||||
|
@ -3005,7 +3005,7 @@ class Decimal(object):
|
|||
return _Zero
|
||||
|
||||
|
||||
def compare_total_mag(self, other):
|
||||
def compare_total_mag(self, other, context=None):
|
||||
"""Compares self to other using abstract repr., ignoring sign.
|
||||
|
||||
Like compare_total, but with operand's sign ignored and assumed to be 0.
|
||||
|
@ -3027,7 +3027,7 @@ class Decimal(object):
|
|||
else:
|
||||
return _dec_from_triple(1, self._int, self._exp, self._is_special)
|
||||
|
||||
def copy_sign(self, other):
|
||||
def copy_sign(self, other, context=None):
|
||||
"""Returns self with the sign of other."""
|
||||
other = _convert_other(other, raiseit=True)
|
||||
return _dec_from_triple(other._sign, self._int,
|
||||
|
@ -4180,7 +4180,7 @@ class Context(object):
|
|||
"""
|
||||
if not isinstance(a, Decimal):
|
||||
raise TypeError("canonical requires a Decimal as an argument.")
|
||||
return a.canonical(context=self)
|
||||
return a.canonical()
|
||||
|
||||
def compare(self, a, b):
|
||||
"""Compares values numerically.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue