This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fraction constructor should raise TypeError instead of AttributeError
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jyasskin Nosy List: jyasskin, rhettinger
Priority: normal Keywords: patch

Created on 2008-07-04 19:57 by rhettinger, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fractype.diff rhettinger, 2008-07-04 20:07 Patch with tests
Messages (2)
msg69267 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-04 19:57
>>> 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__'
msg69495 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-10 09:31
Applied in r64835.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47537
2008-07-10 09:31:28rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg69495
2008-07-04 20:08:00rhettingersetfiles: + fractype.diff
keywords: + patch
2008-07-04 19:57:22rhettingercreate