Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fraction constructor should raise TypeError instead of AttributeError #47537

Closed
rhettinger opened this issue Jul 4, 2008 · 2 comments
Closed
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 3287
Nosy @rhettinger
Files
  • fractype.diff: Patch with tests
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-07-10.09:31:28.198>
    created_at = <Date 2008-07-04.19:57:22.559>
    labels = ['type-bug', 'library']
    title = 'Fraction constructor should raise TypeError instead of AttributeError'
    updated_at = <Date 2008-07-10.09:31:28.135>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2008-07-10.09:31:28.135>
    actor = 'rhettinger'
    assignee = 'jyasskin'
    closed = True
    closed_date = <Date 2008-07-10.09:31:28.198>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2008-07-04.19:57:22.559>
    creator = 'rhettinger'
    dependencies = []
    files = ['10811']
    hgrepos = []
    issue_num = 3287
    keywords = ['patch']
    message_count = 2.0
    messages = ['69267', '69495']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'jyasskin']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3287'
    versions = ['Python 2.6', 'Python 3.0']

    @rhettinger
    Copy link
    Contributor Author

    >> from fractions import *
    >> Fraction(3.1)

    Traceback (most recent call last):
      File "<pyshell#14>", line 1, in <module>
        Fraction(3.1)
      File "C:\Python26\lib\fractions.py", line 100, in __new__
        numerator = numerator.__index__()
    AttributeError: 'float' object has no attribute '__index__'

    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 4, 2008
    @rhettinger
    Copy link
    Contributor Author

    Applied in r64835.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant