cpython
cpython copied to clipboard
gh-119189: Fix the fraction module so that __rpow__ works on arbitrary classes.
gh-119189: Fix the fraction module so that rpow works on arbitrary classes.
The fraction module implicitly casted float if __rpow__ was implemented in your class when raising a fraction to a power. Now we replace the cast to float and instead check if it is a float or complex and if the class isn't it will raise an exception.