mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-130104: Call __rpow__ in ternary pow() if necessary (GH-130251)
Previously it was only called in binary pow() and the binary power operator.
This commit is contained in:
parent
72da4a4458
commit
62ff86fa55
10 changed files with 74 additions and 18 deletions
|
@ -2440,12 +2440,12 @@ class Decimal(object):
|
|||
|
||||
return ans
|
||||
|
||||
def __rpow__(self, other, context=None):
|
||||
def __rpow__(self, other, modulo=None, context=None):
|
||||
"""Swaps self/other and returns __pow__."""
|
||||
other = _convert_other(other)
|
||||
if other is NotImplemented:
|
||||
return other
|
||||
return other.__pow__(self, context=context)
|
||||
return other.__pow__(self, modulo, context=context)
|
||||
|
||||
def normalize(self, context=None):
|
||||
"""Normalize- strip trailing 0s, change anything equal to 0 to 0e0"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue