Skip to content

float binary ops accept only int/float — no __float__ coercion (Decimal(5) + 2.2 computed 7.2 instead of raising TypeError)#2736

Open
fgallaire wants to merge 1 commit into
brython-dev:masterfrom
fgallaire:float-ops-no-coercion
Open

float binary ops accept only int/float — no __float__ coercion (Decimal(5) + 2.2 computed 7.2 instead of raising TypeError)#2736
fgallaire wants to merge 1 commit into
brython-dev:masterfrom
fgallaire:float-ops-no-coercion

Conversation

@fgallaire

@fgallaire fgallaire commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
>>> Decimal(5) + 2.2
Decimal('7.2')                                                               # before
>>> Decimal(5) + 2.2
TypeError: unsupported operand type(s) for +: 'decimal.Decimal' and 'float'  # after

…al(5) + 2.2 computed 7.2 instead of raising TypeError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant