Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
Bug description:
Fraction.__pow__ does not accept the third argument whichpow 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 givenOther 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 integersI'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