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

Fraction wrongfully gets casted into float when given as argument to __rpow__ #119189

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@retooth2

Description

@retooth2

Bug report

Bug description:

When using the** operator with a Fraction as a base and an object that implements__rpow__ as an exponent the fraction gets wrongfully casted into a float before being passed to__rpow__

fromfractionsimportFractionfoo=Fraction(4,3)classOne:def__rpow__(self,other):returnotherbar=foo**One()print(bar)print(type(bar))

Expected Output

4/3<class 'fractions.Fraction'>

Actual Output:

1.3333333333333333<class 'float'>

Tested with Python 3.12.3

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp