mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
gh-130230: Fix crash in pow() with only Decimal third argument (GH-130237)
This commit is contained in:
parent
4374e1de87
commit
b93b7e566e
3 changed files with 29 additions and 1 deletions
|
|
@ -4481,6 +4481,15 @@ class Coverage:
|
|||
self.assertIs(Decimal("NaN").fma(7, 1).is_nan(), True)
|
||||
# three arg power
|
||||
self.assertEqual(pow(Decimal(10), 2, 7), 2)
|
||||
if self.decimal == C:
|
||||
self.assertEqual(pow(10, Decimal(2), 7), 2)
|
||||
self.assertEqual(pow(10, 2, Decimal(7)), 2)
|
||||
else:
|
||||
# XXX: Three-arg power doesn't use __rpow__.
|
||||
self.assertRaises(TypeError, pow, 10, Decimal(2), 7)
|
||||
# XXX: There is no special method to dispatch on the
|
||||
# third arg of three-arg power.
|
||||
self.assertRaises(TypeError, pow, 10, 2, Decimal(7))
|
||||
# exp
|
||||
self.assertEqual(Decimal("1.01").exp(), 3)
|
||||
# is_normal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue