Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issues with Decimal and three-argument pow() #130230

Closed
Assignees
serhiy-storchaka
Labels
3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-crashA hard crash of the interpreter, possibly with a core dump
@serhiy-storchaka

Description

@serhiy-storchaka

Crash report

  1. Three-argumentpow() with non-Decimal first argument does not work in the Python implementation.
>>>from decimalimport Decimal>>>pow(10, Decimal(2),7)Decimal('2')>>>from _pydecimalimport 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.

  1. Three-argumentpow() with only Decimal third argument crashes in the C implementation.
>>>from decimalimport 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.

Linked PRs

Metadata

Metadata

Labels

3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp