[issue3287] Fraction constructor should raise TypeError instead of AttributeError

Raymond Hettinger report at bugs.python.org
Fri Jul 4 21:57:23 CEST 2008


New submission from Raymond Hettinger <rhettinger at users.sourceforge.net>:

>>> 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__'

----------
assignee: jyasskin
components: Library (Lib)
messages: 69267
nosy: jyasskin, rhettinger
severity: normal
status: open
title: Fraction constructor should raise TypeError instead of AttributeError
type: behavior
versions: Python 2.6, Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3287>
_______________________________________


More information about the Python-bugs-list mailing list