-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
type-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
Fraction.__pow__ does not accept the third argument which pow tries to pass to it:
>>> pow(Fraction(1), 1, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Fraction.__pow__() takes 2 positional arguments but 3 were given
Other number types don't do that, they support it when they can and print an error message if they don't want to, e.g.
>>> pow(Decimal("1"), 1, 1)
Decimal('0')
>>> pow(Decimal('1'), 1.1, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: pow() 3rd argument not allowed unless all arguments are integers
I'm not sure what fraction should do, maybe it should just continue not to support it? Or just accept the argument, and then print a better error message if modulo is not None?
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
type-featureA feature request or enhancementA feature request or enhancement