Closed
Description
Crash report
- Three-argument
pow()
with non-Decimal first argument does not work in the Python implementation.
>>> from decimal import Decimal
>>> pow(10, Decimal(2), 7)
Decimal('2')
>>> from _pydecimal import Decimal
>>> pow(10, Decimal(2), 7)
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
pow(10, Decimal(2), 7)
~~~^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for ** or pow(): 'int', 'Decimal', 'int'
But it works in the C implementation.
- Three-argument
pow()
with only Decimal third argument crashes in the C implementation.
>>> from decimal import Decimal
>>> pow(10, 2, Decimal(7))
python: ./Modules/_decimal/_decimal.c:139: find_state_left_or_right: Assertion `mod != NULL' failed.
Aborted (core dumped)
In the Python implementation it only raises TypeError, which is expected.